Set up a subscription with SEPA Direct Debit
Learn how to create and charge a subscription with SEPA Direct Debit.
Learn how to create and charge for a subscription with SEPA Direct Debit.
Note
If you’re a new user, use the Payment Element instead of using Stripe Elements as described in this guide. The Payment Element provides a low-code integration path with built-in conversion optimisations. For instructions, see Build a subscription.
Create a product and priceDashboard
Products represent the item or service you’re selling. Prices define how much and how frequently you charge for a product. This includes how much the product costs, what currency you accept, and whether it’s a one-off or recurring charge. If you only have a few products and prices, create and manage them in the Dashboard.
This guide uses a stock photo service as an example and charges customers a 15 EUR monthly subscription. To model this:
- Go to the Products page and click Create product.
- Enter a Name for the product. You can optionally add a Description and upload an image of the product.
- Select a Product tax code. Learn more about product tax codes.
- Select Recurring. Then enter 15 for the price and select EUR as the currency.
- Choose whether to Include tax in price. You can either use the default value from your tax settings or set the value manually. In this example, select Auto.
- Select Monthly for the Billing period.
- Click More pricing options. Then select Flat rate as the pricing model for this example. Learn more about flat rate and other pricing models.
- Add an internal Price description and Lookup key to organise, query and update specific prices in the future.
- Click Next. Then click Add product.
After you create the product and the price, record the price ID so you can use it in subsequent steps. The pricing page displays the ID and it looks similar to this: price_
.
Create a customerServer-side
A subscription needs a customer so it can re-use payment methods and track recurring payments. Create a Customer
object when your customer creates an account with your business.
Create the subscriptionServer-side
Create the subscription using the customer and price IDs. Return to the client side the client_
from either the latest invoice’s confirmation_secret.client_secret or, for subscriptions that don’t collect a payment up front, the pending_setup_intent. Additionally, set:
- payment_behavior to
default_
to simplify collection of the SEPA Direct Debit mandate.incomplete - save_default_payment_method to
on_
to save the payment method as the default for the subscription when the payment succeeds. Saving a default payment method increases the success rate of future subscription payments.subscription
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 method details to StripeClient-side
Use confirmSepaDebitPayment or, for subscriptions that don’t collect a payment up front, confirmSepaDebitSetup to confirm the subscription and create a SEPA Direct Debit PaymentMethod. Include the customer’s name and email address in the payment_
properties.
Set the default payment methodServer-side
You need to add a stored payment method to the customer so future payments are successful. You do this by setting the payment method you just collected at the top level of the Customer object and as the default payment method for invoices:
Manage subscription statusClient-side
When the initial payment succeeds, the status of the subscription is active
and no further action is needed. When payments fail, the status is changed to the Subscription status configured in your automatic collection settings. Notify the customer after a failure and charge them with a different payment method.
Note
SEPA Direct Debit payments are never automatically retried, even if you have a retry schedule configured for other payment methods.
Test the integration
You can test your integration using the IBANs below. The payment method details are successfully collected for each IBAN but exhibit different behavior when charged.
Test IBANs
OptionalSet the billing period
When you create a subscription, it automatically sets the billing cycle by default. For example, if a customer subscribes to a monthly plan on 7 September, they’re billed on the 7th of every month after that. Some businesses prefer to set the billing cycle manually so that they can charge their customers at the same time each cycle. The billing cycle anchor argument allows you to do this.
Setting the billing cycle manually automatically charges the customer a pro rata amount for the time between the subscription being created and the billing cycle anchor. If you don’t want to charge customers for this time, you can set the proration_behavior argument to none
. You can also combine the billing cycle anchor with trial periods to give users free access to your product and then charge them a pro rata amount.
OptionalSubscription trials
Free trials allow customers access to your product for a period of time for free. Using free trials is different from setting proration_behavior to none
because you can customise how long the free period lasts. Pass a timestamp in trial end to set the trial period.
You can also combine a billing cycle anchor with a free trial. For example, say it’s September 15 and you want to give your customer a free trial for seven days and then start the normal billing cycle on October 1. You can set the free trial to end on September 22 and the billing cycle anchor to October 1. This gives the customer a free trial for seven days and then charges a prorated amount for the time between the trial ending and October 1. On October 1, you charge them the normal subscription amount for their first full billing cycle.
OptionalCreate SEPA Direct Debit payments using other payment methods
You can create SEPA Direct Debit payments using other payment methods such as Bancontact, iDEAL, and Sofort. Using these payment methods requires a few additional steps. For iDEAL:
- Use an idealBank Element to collect payment information.
- Confirm the subscription using confirmIdealPayment or, for subscriptions that don’t collect a payment up front, confirmIdealSetup.
- List the customer’s payment methods, find the SEPA Direct Debit payment method, and set it as the customer’s default payment method.
For Bancontact and Sofort, substitute:
confirmIdealPayment
for confirmBancontactPayment or confirmSofortPaymentconfirmIdealSetup
for confirmBancontactSetup or confirmSofortSetup