Accept a SEPA Direct Debit payment
Learn to accept SEPA Direct Debit payments.
Note
When processing SEPA Direct Debit payments using the Stripe Creditor ID, we recommend you use the pre-built checkout page to collect SEPA Direct Debit mandates.
Accepting SEPA Direct Debit payments on your website consists of creating an object to track a payment, collecting payment method information and mandate acknowledgement, and submitting the payment to Stripe for processing. Stripe uses this payment object, the PaymentIntent, to track and handle all the states of the payment until the payment completes.
You can also set up a SEPA Direct Debit PaymentMethod by having your customer authenticate their bank details with Bancontact, iDEAL, or Sofort.
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 SEPA Direct Debit account for future payments, it must be attached to a Customer.
You should 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 will enable 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.
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 eur
currency (SEPA Direct Debit doesn’t support other currencies). If you already have an integration using the Payment Intents API, add sepa_
to the list of payment method types for your PaymentIntent. Specify the id of the Customer.
To save the SEPA Direct Debit account for reuse, set the setup_future_usage parameter to off_
. SEPA Direct Debit only accepts an off_
value for this parameter.
Collect payment method details and mandate acknowledgmentClient-side
You’re ready to collect payment information on the client with Stripe Elements. Elements is a set of pre-built 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
Submit the payment to StripeClient-side
Rather than sending the entire PaymentIntent object to the client, use its client secret from step 3. This is different from your API keys that authenticate Stripe API requests.
The client secret should still 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.
Confirm the PaymentIntent succeeded
SEPA Direct Debit is a delayed notification payment method, so funds are not immediately available. When the payment has been submitted successfully, the PaymentIntent
status is updated from requires_
to processing
. After the payment has succeeded, the PaymentIntent status is updated from processing
to succeeded
.
The following events are sent when the PaymentIntent status is updated:
Event | Description | Next steps |
---|---|---|
payment_ | The customer’s payment was submitted to Stripe successfully. | Wait for the initiated payment to succeed or fail. |
payment_ | The customer’s payment succeeded. | Fulfill the goods or services that the customer purchased. |
payment_ | The customer’s payment was declined. | Contact the customer through email or push notification and request another payment method. |
We recommend using webhooks to confirm the charge has succeeded and to notify the customer that the payment is complete.
Note that because setup_future_usage and customer were set, the PaymentMethod will be attached to the Customer object once the payment enters the processing
state. This attachment happens regardless of whether payment eventually succeeds or fails.
Test the integration
Stripe provides several test numbers you can use to make sure your integration is ready for production. Use the SEPA Direct Debit test numbers when testing your Checkout integration with SEPA Direct Debit.
Test IBANs
OptionalValidate the IBAN Element
The IBAN Element validates user input as it is typed. To help your customers catch mistakes, you should listen to change events on the IBAN Element and display any errors:
The change event contains other parameters that can help to build a richer user experience. Refer to the Stripe.js reference for more detail.
OptionalConfigure customer debit date
You can control the date that Stripe debits a customer’s bank account using the target date. The target date must be at least three days in the future and no more than 15 days from the current date.
The target date schedules money to leave the customer’s account on the target date. You can cancel a PaymentIntent created with a target date up to three business days before the configured date.
Target dates that meet one of the following criteria delay the debit until next available business day:
- Target date falls on a weekend, a bank holiday, or other non-business day.
- Target date is fewer than three business days in the future.
This parameter operates on a best-effort basis. Each customer’s bank might process debits on different dates, depending on local bank holidays or other reasons.
OptionalCustomise mandate references with a prefix
You can customise SEPA Direct Debit mandate references to simplify mandate identification. To do this, provide the optional payment_
value. We add the reference_
to the beginning of a unique sequence to ensure the entire reference remains unique.
The reference_
must meet these requirements:
- Maximum length: 12 characters
- Must begin with a number or an uppercase letter
- Allowed characters:
- Uppercase letters
- Numbers
- Spaces
- Special characters:
.
,/
,&
,-
,_
- Can’t begin with
STRIPE
Include any desired delimiter in the prefix, as we don’t add one by default. We trim trailing spaces to a maximum of one space. With a valid prefix, the resulting reference is always 24 characters long.
The generated reference looks like EX4MPL3-19CNCI920C2M02O3
.
Error Code | Message |
---|---|
invalid_ | The reference_ must be at most 12 characters long and can only contain uppercase letters, numbers, spaces, or the special characters / , _ , - , & , and . . It can’t begin with STRIPE . |