Sign in
Create account
Sign in
Home
Payments
Business operations
Financial services
Developer tools
Security
All products
Home
Payments
Business operations
Home
Payments
Business operations
Financial services
Developer tools
Support
Overview
Overview
Bank debits
Bank redirects
Bancontact
EPS
FPX
giropay
iDEAL
Przelewy24
Accept a payment
Sofort
Bank transfers
Buy now pay later
Vouchers
Wallets
Testing
HomePaymentsBank redirectsPrzelewy24

Accept a Przelewy24 payment

Learn how to accept Przelewy24 (P24), the most popular payment method in Poland.

Przelewy24 with Sources

Stripe recommends using Payment Intents or Checkout to accept Przelewy24 payments. If you’re using the Sources API, see Przelewy24 payments with Sources.

Przelewy24 is a single use payment method where customers are required to authenticate their payment. Customers pay with Przelewy24 by redirecting from your website, authorizing the payment, then returning to your website where you get immediate notification on whether the payment succeeded or failed.

Set up Stripe
Server-side

First, you need a Stripe account. Register now.

Use our official libraries for access to the Stripe API from your application:

Terminal
# Available as a gem sudo gem install stripe
Gemfile
# If you use bundler, you can add this line to your Gemfile gem 'stripe'

Create a PaymentIntent
Server-side

A PaymentIntent represents your intent to collect payment from a customer and tracks the lifecycle of the payment process.

Create a PaymentIntent on your server and specify the amount to collect, and eur or pln as the currency. If you have an existing Payment Intents integration, add p24 to the list of payment method types.

Terminal
curl https://api.stripe.com/v1/payment_intents \ -u
sk_test_4eC39HqLyjWDarjtT1zdp7dc
: \ -d "amount"=1099 \ -d "currency"="pln" \ -d "payment_method_types[]"="p24"

Instead of passing the entire PaymentIntent object to your app, return its client secret. The PaymentIntent’s client secret is a unique key that lets you confirm the payment and update payment details on the client, without allowing manipulation of sensitive information, like the payment amount.

Statement descriptors with Przelewy24

You can also set a custom statement descriptor before confirming the PaymentIntent. For Przelewy24, the statement descriptor is limited to 14 characters. It’s visible on your customer’s bank records with the format P24-XXX-XXX-XXX {statement_descriptor}, where P24-XXX-XXX-XXX is a unique reference for the payment.

Collect payment method details
Client-side

Collect payment information on the client with Stripe Elements. Elements is a set of prebuilt UI components for collecting payment details.

A Stripe Element contains an iframe that securely sends the payment information to Stripe over an HTTPS connection. The checkout page address must also start with https:// rather than http:// for your integration to work.

You can test your integration without using HTTPS. Enable it when you’re ready to accept live payments.

Set up Stripe Elements

Stripe Elements is automatically available as a feature of Stripe.js. Include the Stripe.js script on your payment page by adding it to the head of your HTML file. Always load Stripe.js directly from js.stripe.com to remain PCI compliant. Do not include the script in a bundle or host a copy of it yourself.

checkout.html
<head> <title>Checkout</title> <script src="https://js.stripe.com/v3/"></script> </head>

Create an instance of Elements with the following JavaScript on your checkout page:

var stripe = Stripe(
'pk_test_TYooMQauvdEDq54NiTphI7jx'
); var elements = stripe.elements();

Add and configure an p24Bank Element

Elements needs a place to live in your payment form. Create empty DOM nodes (containers) with unique IDs in your payment form and then pass those IDs to Elements.

checkout.html
<form id="payment-form"> <div class="form-row"> <label for="accountholder-name"> Name </label> <input id="accountholder-name" name="accountholder-name"> </div> <div class="form-row"> <!-- Using a label with a for attribute that matches the ID of the Element container enables the Element to automatically gain focus when the customer clicks on the label. --> <label for="p24-bank-element"> P24 Bank </label> <div id="p24-bank-element"> <!-- A Stripe Element will be inserted here. --> </div> </div> <button>Submit Payment</button> <!-- Used to display form errors. --> <div id="error-message" role="alert"></div> </form>

When the form above has loaded, create an instance of an p24Bank Element and mount it to the Element container created above:

var options = { // Custom styling can be passed to options when creating an Element style: { base: { padding: '10px 12px', color: '#32325d', fontSize: '16px', '::placeholder': { color: '#aab7c4' }, }, }, }; // Create an instance of the p24Bank Element var p24Bank = elements.create('p24Bank', options); // Add an instance of the p24Bank Element into // the `p24-bank-element` <div> p24Bank.mount('#p24-bank-element');

Elements are completely customizable. You can style Elements to match the look and feel of your site, providing a seamless checkout experience for your customers. It’s also possible to style various input states (e.g., when the Element has focus).

Submit the payment to Stripe
Client-side

Rather than sending the entire PaymentIntent object to the client, use its client secret. This is different from your API keys that authenticate Stripe API requests. The client secret should be handled carefully because it can complete the charge. Do not log it, embed it in URLs, or expose it to anyone but the customer.

Use stripe.confirmP24Payment to handle the redirect away from your page and to complete the payment. Add a return_url to this function to indicate where Stripe should redirect the user after they complete the payment on their bank’s website or mobile application.

client.js
var form = document.getElementById('payment-form'); var accountholderName = document.getElementById('accountholder-name'); var accountholderEmail = document.getElementById('accountholder-email'); form.addEventListener('submit', function(event) { event.preventDefault(); // Redirects away from the client stripe.confirmP24Payment( '{{PAYMENT_INTENT_CLIENT_SECRET}}', { payment_method: { p24: p24Bank, billing_details: { name: accountholderName.value, email: accountholderEmail.value, }, }, payment_method_options: { p24: { // In order to be able to pass the `tos_shown_and_accepted` parameter, you must // ensure that the P24 regulations and information obligation consent // text is clearly visible to the customer. See // stripe.com/docs/payments/p24/accept-a-payment#requirements // for directions. tos_shown_and_accepted: true, } }, return_url: 'https://your-website.com/checkout/complete', } ); });

The return_url should correspond to a page on your website that provides the status of the payment, by verifying the status of the PaymentIntent when rendering the return page. When Stripe redirects the customer to the return_url, the following URL query parameters are provided to verify status. You may also append your own query parameters when providing the return_url. They will persist through the redirect process.

ParameterDescription
payment_intentThe unique identifier for the PaymentIntent
payment_intent_client_secretThe client secret of the PaymentIntent object

You can find details about the bank account the customer used to complete the payment on the resulting Charge under the payment_method_details property.

{ "charges": { "data": [ { "payment_method_details": { "p24": { "bank": "inteligo", "reference": "P24 123-456-789", "verified_name": "JENNY ROSEN" }, "type": "p24" }, "id": "src_16xhynE8WzK49JbAs9M21jaR", "object": "source", "amount": 1099,

Test your integration

Select any bank in the P24 bank list with your test API keys. After confirming the payment, you’re redirected to a test page with options to succeed or fail the payment. You can test the successful payment case by authenticating the payment on the redirect page. The PaymentIntent will transition from requires_action to succeeded.

To test the case where the user fails to authenticate, select any bank with your test API keys. On the redirect page, click Fail test payment. Your PaymentIntent will transition from requires_action to requires_payment_method.

OptionalHandle post-payment events
Server-side

OptionalHandle P24 Bank Element changes
Client-side

OptionalHandle P24 redirect manually
Server-side

OptionalStore the customer's bank preference
Client-side

Przelewy24 requirements

Przelewy24 requires customers to agree to their Terms of Service in order to successfully authorize the transaction. This means that the customer will first be redirected to a Przelewy24 page where they can accept these terms. In order to skip the intermediate page, you are required to present the Przelewy24 terms on your website, and collect consent on their behalf. When you have done that, you will be able to set the p24[tos_shown_and_accepted] payment method option.

RequirementDetails

Present a hyperlinked Przelewy24 Terms of Service standard wording with hyperlinks.

The following text should be clearly visible to the customer, with hyperlinks included:

  • Standard wording in Polish (hyperlinked): Oświadczam, że zapoznałem się z regulaminem i obowiązkiem informacyjnym serwisu Przelewy24.
  • Standard wording in English (hyperlinked): I declare that I have familiarized myself with the regulations and information obligation of the Przelewy24 service.

Bank values

Bank nameValue
Alior Bankalior_bank
Bank Milleniumbank_millennium
Bank Nowy BFG S.A.bank_nowy_bfg_sa
Bank PEKAO S.Abank_pekao_sa
Banki SpBdzielczebanki_spbdzielcze
Blik via redirectblik
BNP Paribasbnp_paribas
BOZboz
CitiHandlowyciti_handlowy
Credit Agricolecredit_agricole
EnveloBankenvelobank
e-Transfer Poctowy24etransfer_pocztowy24
Getin Bankgetin_bank
IdeaBankideabank
INGing
inteligointeligo
mBank-mtransfermbank_mtransfer
Nest Przelewnest_przelew
Noble Paynoble_pay
PBac z iPKO (PKO+BP)pbac_z_ipko
Plus Bankplus_bank
Santander-przelew24santander_przelew24
T-Mobile Usbugi Bankowetmobile_usbugi_bankowe
Toyota Banktoyota_bank
Volkswagen Bankvolkswagen_bank
Was this page helpful?
Questions? Contact us.
Developer tutorials on YouTube.
You can unsubscribe at any time. Read our privacy policy.
On this page
Set up Stripe
Create a PaymentIntent
Collect payment method details
Submit the payment to Stripe
Test your integration
Handle post-payment events
Handle P24 Bank Element changes
Handle P24 redirect manually
Store the customer's bank preference
Przelewy24 requirements
Bank values