Bacs Direct Debit payments
Accept Bacs Direct Debit payments from customers with a UK bank account.
Accepting Bacs Direct Debit payments on your website consists of creating an object to track a payment, collecting payment method information and mandate acknowledgement, submitting the payment to Stripe for processing, and verifying your customer’s bank account.
Stripe uses this payment object, the PaymentIntent, to track and handle all the states of the payment until the payment completes.
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 or retrieve a CustomerServer-side
To reuse a bank account for future payments, it must be attached to a Customer.
Create a Customer
object when your customer creates an account with your business. Associating the ID of the Customer
object with your own internal representation of a customer enables you to retrieve and use the stored payment method details later.
Create a new Customer
or retrieve an existing Customer
to associate with this payment. Include the following code on your server to create a new Customer
:
Collect payment method details
Note
The Bacs Direct Debit scheme rules require that your customer accept a mandate in order for Stripe to debit their account. The Payment Element collects this mandate when accepting the customer’s payment details, so you don’t need to take any action to comply with this requirement.
You’re ready to collect payment details on the client with the Payment Element. The Payment Element is a prebuilt UI component that simplifies collecting payment details for a variety of payment methods.
The Payment Element contains an iframe that securely sends payment information to Stripe over an HTTPS connection. Avoid placing the Payment Element within another iframe because some payment methods require redirecting to another page for payment confirmation.
The checkout page address must start with https://
rather than http://
for your integration to work. You can test your integration without using HTTPS, but remember to enable it when you’re ready to accept live payments.
You can customize the Payment Element to match the design of your site by passing the appearance object into options
when creating the Elements
provider.
Collect addresses
By default, the Payment Element only collects the necessary billing address details. To collect a customer’s full billing address (to calculate the tax for digital goods and services, for example) or shipping address, use the Address Element.
Create a PaymentIntentServer-side
Run custom business logic immediately before payment confirmation
Navigate to step 5 in the finalize payments guide to run your custom business logic immediately before payment confirmation. Otherwise, follow the steps below for a simpler integration, which uses stripe.
on the client to both confirm the payment and handle any next actions.
Submit the payment to StripeClient-side
Use stripe.confirmPayment to complete the payment using details from the Payment Element.
Provide a return_url to this function to indicate where Stripe redirects the user after they complete the payment. Your user might be initially redirected to an intermediate site, such as a bank authorization page, before being redirected to the return_
. Card payments immediately redirect to the return_
when a payment is successful.
If you don’t want to redirect for card payments after payment completion, you can set redirect to if_
. This only redirects customers that check out with redirect-based payment methods.
Handle post-payment events
Bacs Direct Debit is a delayed notification payment method, so funds aren’t immediately available.
Timelines
With Bacs Direct Debit, it can take several business days for funds to become available in your Stripe balance. The number of business days it takes for funds to become available is called the settlement timing. Payments submitted after the daily cutoff are processed on the next business day.
It takes 4 business days to confirm the success or failure of a Bacs Direct Debit payment when a mandate is already in place and 7 business days when you must collect a new mandate.
In some cases, the bank might notify us of a payment failure after the payment has been marked as successful in your Stripe account. In this case the payment failure is identified as a dispute with the appropriate reason code.
The following table describes the settlement timings for Bacs Direct Debit payments that Stripe offers.
Settlement type | Payment Success | Funds Available | Cutoff time |
---|---|---|---|
Standard Settlement | T+3 at 21:00 UTC | T+4 at 00:00 UTC | 20:00 Europe/London |
Set up webhooks
Stripe sends multiple events during the payment process and after the payment is complete. Use the Dashboard webhook tool or follow the webhook guide 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.
For Bacs Direct Debit you need to handle the payment_intent.succeeded event to confirm that the payment has succeeded. Stripe also recommends handling the payment_intent.processing, and payment_intent.payment_failed events.
To test webhooks locally, you can use Stripe CLI. After you have it installed, you can forward events to your server:
stripe listen --forward-to localhost:4242/webhook Ready! Your webhook signing secret is '{{WEBHOOK_SIGNING_SECRET}}' (^C to quit)
Learn more about setting up webhooks.
Test the integration
There are several test bank account numbers you can use in a sandbox to make sure this integration is ready.
Sort code | Account number | Description |
---|---|---|
108800 | 00012345 | The payment succeeds and the PaymentIntent transitions from processing to succeeded . |
108800 | 90012345 | The payment succeeds after three minutes and the PaymentIntent transitions from processing to succeeded . |
108800 | 33333335 | The payment is accepted but then immediately fails with a debit_ failure code and the PaymentIntent transitions from processing to requires_ . The Mandate becomes inactive and the PaymentMethod can not be used again. |
108800 | 93333335 | The payment fails after three minutes with a debit_ failure code and the PaymentIntent transitions from processing to requires_ . The Mandate becomes inactive and the PaymentMethod can not be used again. |
108800 | 22222227 | The payment fails with an insufficient_ failure code and the PaymentIntent transitions from processing to requires_ . The Mandate remains active and the PaymentMethod can be used again. |
108800 | 92222227 | The payment fails after three minutes with an insufficient_ failure code and the PaymentIntent transitions from processing to requires_ . The Mandate remains active and the PaymentMethod can be used again. |
108800 | 55555559 | The payment succeeds after three minutes and the PaymentIntent transitions from processing to succeeded , but a dispute is immediately created. |
108800 | 00033333 | Payment Method creation succeeds, but the Mandate is refused by the customer’s bank and immediately transitions to inactive. |
108800 | 00044444 | The request to set up Bacs Direct Debit fails immediately due to an invalid account number and the customer is prompted to update their information before submitting. Payment details are not collected. |
108800 | 34343434 | The payment fails with a charge_ failure code due to the payment amount causing the account to exceed its weekly payment volume limit. |
108800 | 12121212 | The payment fails with a charge_ failure code due to the payment amount exceeding the account’s transaction volume limit. |
You can test using any of the account numbers provided above. However, because Bacs Direct Debit payments take several days to process, use the test account numbers that operate on a three-minute delay to better simulate the behavior of live payments.
Note
By default, Stripe automatically sends emails to the customer when payment details are initially collected and each time a debit will be made on their account. These notifications aren’t sent in sandboxes.
Payment failures
Payments can fail for a variety of reasons. The reason for a failure is available through charge.failure_code. Only payments with certain failure codes may be retried. If a payment can’t be retried, we recommend reaching out to the customer and asking them to pay again using a different bank account or a different payment method.
Below is a list of failure codes we currently send for Bacs Direct Debit. We may add more at any time, so in developing and maintaining your code, you should not assume that only these types exist.
Failure code | Description | Retryable |
---|---|---|
account_ | The bank account has been closed. | No |
bank_ | The account has been transferred to a new Payment Service Provider (PSP). Check if you have been notified of the new PSP’s details. If not, you must collect a new mandate from the customer. | No |
debit_ | The customer has notified their bank that this payment was unauthorized or there is no mandate held by the paying bank. | No |
generic_ | This payment could not be processed. | Yes |
insufficient_ | The customer’s account has insufficient funds to cover this payment. | Yes |
invalid_ | The account number is not valid. This could mean it is not for a GBP account or that the account can’t process Direct Debit payments. | No |
To retry a payment, confirm the PaymentIntent again using the same PaymentMethod.
To ensure success, we recommend reaching out to the payer before retrying a payment.