Pay by Bank paymentsInvite only
Learn how to accept Pay by Bank payments.
Caution
We recommend that you follow the Accept a payment guide unless you need to use manual server-side confirmation, or your integration requires presenting payment methods separately. If you’ve already integrated with Elements, see the Payment Element migration guide.
Pay by Bank is a single use payment method where customers must authenticate their payment. Pay by Bank redirects customers from your website, authorizes the payment, and returns them to your website. You receive notification of whether a payment succeeded or failed within a few seconds.
Note
Pay by Bank is a delayed notification payment method, which means that funds are not immediately available after payment. A payment typically takes 5 seconds to arrive in your account.
Set up StripeServer-side
First, you need a Stripe account. Register now.
Use our official libraries for access to the Stripe API from your application:
Create a PaymentIntentServer-side
A PaymentIntent is an object that represents your intent to collect payment from a customer and tracks the lifecycle of the payment process through each stage.
First, create a PaymentIntent
on your server and specify the amount to collect and the gbp
currency (Pay by Bank doesn’t support other currencies). If you already have an integration using the Payment Intents API, add pay_by_bank
to the list of payment method types for your PaymentIntent
. Stripe enables the functionality that automatic_payment_methods
provides by default in the latest version of the API.
- You can either use the automatic_payment_methods attribute or add
pay_by_bank
to payment method types. - Regardless of which option you choose, make sure to enable Pay by Bank on the
- payment methods settings page in the Dashboard.
You can manage payment methods from the Dashboard. Stripe handles the return of eligible payment methods based on factors such as the transaction’s amount, currency, and payment flow. Make sure to enable Pay by Bank on the payment methods settings page in the Dashboard. To manually specify payment method types, add pay_by_bank
to payment method types.
Requirements
- The minimum amount is 0.50 GBP and the maximum amount is 10,000 GBP. (Reach out to us if you want to increase the maximum limit.)
- Enter a
statement_descriptor
(optional). This is the merchant name shown on the customer’s bank statement. It has a limit of 18 characters and consists only of alphanumeric values and spaces. If this field is left blank, a shortened version of the Stripe statement descriptors appears on the bank statement.
Retrieve the client secret
The PaymentIntent includes a client secret that the client side uses to securely complete the payment process. You can use different approaches to pass the client secret to the client side.
Submit the payment to StripeClient-side
When a customer clicks to pay with Pay by Bank, use Stripe.js to submit the payment to Stripe. Stripe.js is the foundational JavaScript library for building payment flows. It automatically handles complexities like the redirect described below, and enables you to extend your integration to other payment methods. Include the Stripe.js script on your checkout page by adding it to the head
of your HTML file.
<head> <title>Checkout</title> <script src="https://js.stripe.com/v3/"></script> </head>
Create an instance of Stripe.js with the following JavaScript on your checkout page.
You also need to specify the beta flag, pay_by_bank_beta_1
, to use Pay by Bank with Stripe.js.
// Set your publishable key. Remember to change this to your live publishable key in production! // See your keys here: https://dashboard.stripe.com/apikeys const stripe = Stripe(
, {betas: ['pay_by_bank_beta_1']} );'pk_test_TYooMQauvdEDq54NiTphI7jx'
Confirm with Stripe.js
Rather than sending the entire PaymentIntent object to the client, use its client secret from step 2. This is different from your API keys that authenticate Stripe API requests.
Handle the client secret carefully because it can confirm the payment. Don’t log it, embed it in URLs, or expose it to anyone but the customer.
Use stripe.confirmPayByBankPayment to handle the redirect away from your page and to complete the payment. Add a return_url
to this function to instruct Stripe where to redirect the user after they complete the payment.
const {error} = await stripe.confirmPayByBankPayment( '{{PAYMENT_INTENT_CLIENT_SECRET}}', { return_url: 'https://example.com/checkout/complete', } );
When your customer submits a payment, Stripe redirects them to the return_url
and includes the following URL query parameters. The return page can use them to get the status of the PaymentIntent so it can display the payment status to the customer.
When you specify the return_url
, you can also append your own query parameters for use on the return page.
Parameter | Description |
---|---|
payment_intent | The unique identifier for the PaymentIntent . |
payment_intent_client_secret | The client secret of the PaymentIntent object. |
When the customer is redirected back to your site, you can use the payment_intent_client_secret
to query for the PaymentIntent and display the transaction status to your customer.
Test your integration
When using your test API keys, you’re redirected to a test page with options to authorize or fail the payment.
- Click Authorize test payment to test the case when the payment is successful. The PaymentIntent transitions from
requires_action
tosucceeded
. - Click Fail test payment to test the case when the customer fails to authenticate. The PaymentIntent transitions from
requires_action
torequires_payment_method
.
Handle post-payment events
Stripe sends a payment_intent.succeeded event when the payment completes. Use the Dashboard, a custom webhook, or a partner solution to receive these events and run actions, like sending an order confirmation email to your customer, logging the sale in a database, or starting a shipping workflow.
Listen for these events rather than waiting on a callback from the client. On the client, the customer could close the browser window or quit the app before the callback executes, and malicious clients could manipulate the response. Setting up your integration to listen for asynchronous events also makes it easier to accept more payment methods in the future. Check out our guide to payment methods to see the differences between all supported payment methods.
Manually
Use the Stripe Dashboard to view all your Stripe payments, send email receipts, handle payouts, or retry failed payments.
Custom code
Build a webhook handler to listen for events and build custom asynchronous payment flows. Test and debug your webhook integration locally with the Stripe CLI.
Prebuilt apps
Handle common business events, like automation or marketing and sales, by integrating a partner application.
Fulfill the orderServer-side
Use a method such as webhooks to handle order fulfillment. When a customer completes payment, the PaymentIntent
transitions to succeeded
and emits the payment_intent.succeeded webhook event.
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": { "pay_by_bank": { "bank_account_details_type": "sort_code", "sort_code": { "account_holder_name": "John Doe", "account_number_last4": "1820", "sort_code": "040004" } }, "type": "pay_by_bank" },
If a customer cancels the payment flow, the PaymentIntent
emits the payment_intent.payment_failed webhook event and returns to a status of requires_payment_method
.