Skip to content
Create account
or
Sign in
The Stripe Docs logo
/
Ask AI
Create account
Sign in
Get started
Payments
Revenue
Platforms and marketplaces
Money management
Developer resources
Overview
Billing
OverviewAbout the Billing APIs
Subscriptions
    Overview
    How subscriptions work
    Get started
    Quickstart
    Plan an integration
    Build an integration
    Use cases
    About subscriptions
    Enable billing mode
    Configure subscription events
    Entitlements
    Subscription invoices
    Subscription schedules
    Recurring pricing models
    Strong Customer Authentication (SCA)
    Set up subscriptions
    Configure collection methods
    Embed a pricing table
    Set billing cycles
    Manage subscriptions
    Migrate subscriptions to Stripe
    Set product or subscription quantities
    Mixed interval subscriptions
    Backdate subscriptions
    Set trial periods
    Handle subscriptions with deferred payment
    Apply coupons
    Modify subscriptions
    Manage subscription payment methods
      ACH Direct Debit
      Amazon Pay
      Bacs Direct Debit in the UK
      Bank transfer
      BECS Direct Debit in Australia
      Cash App Pay
      Klarna
      PayPal
      Revolut Pay
      Korean Cards
      Kakao Pay
      Naver Pay
      Pre-authorized debit in Canada
      SEPA Direct Debit in the EU
      iDEAL with SEPA Direct Debit
      Bancontact with SEPA Direct Debit
    Analytics
    Manage subscriptions on iOS
Invoicing
Usage-based billing
Quotes
Customer management
Billing with other products
Revenue recovery
Automations
Test your integration
Tax
Overview
Use Stripe tax
Manage compliance
Reporting
Overview
Select a report
Configure reports
Reports API
Reports for multiple accounts
Revenue recognition
Data
Overview
Business and product data use cases
SchemaData freshness
Sigma
Data Pipeline
Import external data
HomeRevenueSubscriptionsManage subscription payment methods

Set up a subscription with SEPA Direct Debit

Learn how to create and charge a subscription with SEPA Direct Debit.

Stripe sample

Check out the sample on GitHub or explore the demo.

A Checkout Session represents the details of your customer’s intent to purchase. You create a Checkout Session when your customer wants to start a subscription. After redirecting your customer to a Checkout Session, Stripe presents a payment form where your customer can complete their purchase. Once your customer has completed a purchase, they will be redirected back to your site.

Set up Stripe
Server-side

Install the Stripe client of your choice:

Command Line
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
# Available as a gem sudo gem install stripe
Gemfile
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
# If you use bundler, you can add this line to your Gemfile gem 'stripe'

Install the Stripe CLI (optional). The CLI provides webhook testing, and you can run it to create your products and prices.

Command Line
homebrew
Install from source
No results
# Install Homebrew to run this command: https://brew.sh/ brew install stripe/stripe-cli/stripe # Connect the CLI to your dashboard stripe login

For additional install options, see Get started with the Stripe CLI.

Create the pricing model
Dashboard
Stripe CLI

Create your products and their prices in the Dashboard or with the Stripe CLI.

This example uses a fixed-price service with two different service-level options: Basic and Premium. For each service-level option, you need to create a product and a recurring price. (If you want to add a one-time charge for something like a setup fee, create a third product with a one-time price. To keep things simple, this example doesn’t include a one-time charge.)

In this example, each product bills at monthly intervals. The price for the Basic product is 5 EUR. The price for the Premium product is 15 EUR.

Go to the Add a product page and create two products. Add one price for each product, each with a monthly recurring billing period:

  • Premium product: Premium service with extra features

    • Price: Flat rate | 15 EUR
  • Basic product: Basic service with minimum features

    • Price: Flat rate | 5 EUR

After you create the prices, record the price IDs so you can use them in other steps. Price IDs look like this: price_G0FvDp6vZvdwRZ.

When you’re ready, use the Copy to live mode button at the top right of the page to clone your product from a sandbox to live mode.

For other pricing models, see Billing examples.

Create a Checkout Session
Client-side
Server-side

Add a checkout button to your website that calls a server-side endpoint to create a Checkout Session.

index.html
<html> <head> <title>Checkout</title> </head> <body> <form action="/create-checkout-session" method="POST"> <button type="submit">Checkout</button> </form> </body> </html>

Checkout Session parameters

See Create a Checkout Session for a complete list of parameters that can be used.

Create a Checkout Session with the ID of an existing Price. Ensure that mode is set to subscription and you pass at least one recurring price. You can add one-time prices in addition to recurring prices. After creating the Checkout Session, redirect your customer to the URL returned in the response.

Command Line
cURL
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
curl https://api.stripe.com/v1/checkout/sessions \ -u
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:
\ -d "payment_method_types[]"="sepa_debit" \ -d "line_items[][price]"=
{{PRICE_ID}}
\ -d "line_items[][quantity]"=1 \ -d "mode"="subscription" \ -d "success_url"="https://example.com/success?session_id={CHECKOUT_SESSION_ID}" \ -d "cancel_url"="https://example.com/cancel" \

When your customer successfully completes their payment, they’re redirected to the success_url, a page on your website that informs the customer that their payment was successful. Make the Session ID available on your success page by including the {CHECKOUT_SESSION_ID} template variable in the success_url as in the above example.

When your customer clicks on your logo in a Checkout Session without completing a payment, Checkout redirects them back to your website by navigating to the cancel_url. Typically, this is the page on your website that the customer viewed prior to redirecting to Checkout.

Checkout Sessions expire 24 hours after creation by default.

From your Dashboard, enable the payment methods you want to accept from your customers. Checkout supports several payment methods.

Caution

Don’t rely on the redirect to the success_url alone for detecting payment initiation, as:

  • Malicious users could directly access the success_url without paying and gain access to your goods or services.
  • Customers may not always reach the success_url after a successful payment—they might close their browser tab before the redirect occurs.

Confirm the payment is successful

When your customer completes a payment, Stripe redirects them to the URL that you specified in the success_url parameter. Typically, this is a page on your website that informs your customer that their payment was successful.

However, SEPA Direct Debit is a delayed notification payment method, which means that funds aren’t immediately available. Because of this, delay order fulfillment until the funds are available. After the payment succeeds, the underlying PaymentIntent status changes from processing to succeeded.

You can confirm the payment is successful in several ways:

Successful payments appear in the Dashboard’s list of payments. When you click a payment, it takes you to the payment details page. The Checkout summary section contains billing information and the list of items purchased, which you can use to manually fulfill the order.

Note

Stripe can help you keep up with incoming payments by sending you email notifications whenever a customer successfully completes one. Use the Dashboard to configure email notifications.

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
Account NumberDescription
AT611904300234573201The PaymentIntent status transitions from processing to succeeded.
AT321904300235473204The PaymentIntent status transitions from processing to succeeded after at least three minutes.
AT861904300235473202The PaymentIntent status transitions from processing to requires_payment_method.
AT051904300235473205The PaymentIntent status transitions from processing to requires_payment_method after at least three minutes.
AT591904300235473203The PaymentIntent status transitions from processing to succeeded, but a dispute is immediately created.
AT981904300000343434The payment fails with a charge_exceeds_source_limit failure code due to payment amount causing account to exceed its weekly payment volume limit.
AT601904300000121212The payment fails with a charge_exceeds_weekly_limit failure code due to payment amount exceeding account's transaction volume limit.
AT981904300002222227The payment fails with an insufficient_funds failure code.

OptionalAdding a one-time setup fee
Server-side

In addition to passing recurring prices, you can add one-time prices in subscription mode. These are only included on the initial invoice created by the subscription. This is useful for adding setup fees or other one-time fees associated with a subscription. You can add a one-time price to an existing product or create a new product with a new price.

Command Line
curl
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
curl https://api.stripe.com/v1/checkout/sessions \ -u
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:
\ -d "payment_method_types[]"="sepa_debit" \ -d "line_items[0][price]"="{{RECURRING_PRICE_ID}}" \ -d "line_items[0][quantity]"=1 \ -d "line_items[1][price]"="{{ONE_TIME_PRICE_ID}}" \ -d "line_items[1][quantity]"=1 \ -d "mode"="subscription" \ -d "success_url"="https://example.com/success?session_id={CHECKOUT_SESSION_ID}" \ -d "cancel_url"="https://example.com/cancel"

OptionalCreate prices and products inline
Server-side

In addition to passing existing price IDs, you can create new prices at Checkout session creation. First, define a Product and then create a Checkout Session using the product ID. Make sure to pass price_data with the unit_amount, currency, and recurring details:

Command Line
curl
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
curl https://api.stripe.com/v1/checkout/sessions \ -u
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:
\ -d "payment_method_types[]"=sepa_debit \ -d line_items[0][price_data][unit_amount]=5000 \ -d line_items[0][price_data][currency]=eur \ -d line_items[0][price_data][product]=
{{PRODUCT_ID}}
\ -d line_items[0][price_data][recurring][interval]=month \ -d line_items[0][quantity]=1 \ -d mode=subscription \ -d success_url="https://example.com/success?session_id={CHECKOUT_SESSION_ID}" \ -d cancel_url="https://example.com/cancel"

If you also need to create products inline, you can do so with product_data:

Command Line
curl
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
curl https://api.stripe.com/v1/checkout/sessions \ -u
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:
\ -d "payment_method_types[]"=sepa_debit \ -d "line_items[][price_data][currency]"=eur \ -d "line_items[][price_data][product_data][name]"=T-shirt \ -d "line_items[][price_data][unit_amount]"=2000 \ -d "line_items[][quantity]"=1 \ -d "mode"="subscription" \ -d success_url="https://example.com/success?session_id={CHECKOUT_SESSION_ID}" \ -d cancel_url="https://example.com/cancel"

OptionalExisting customers
Server-side

If you have previously created a Customer object to represent a customer, use the customer argument to pass their Customer ID when creating a Checkout Session. This ensures that all objects created during the Session are associated with the correct Customer object.

When you pass a Customer ID, Stripe also uses the email stored on the Customer object to prefill the email field on the Checkout page. If the customer changes their email on the Checkout page, it will be updated on the Customer object after a successful payment.

Command Line
curl
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
curl https://api.stripe.com/v1/checkout/sessions \ -u
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:
\ -d "customer"=
{{CUSTOMER_ID}}
-d "payment_method_types[]"="sepa_debit" \ -d "line_items[][price]"=
{{PRICE_ID}}
\ -d "line_items[][quantity]"=1 \ -d "mode"="subscription" \ -d "success_url"="https://example.com/success" \ -d "cancel_url"="https://example.com/cancel"

OptionalPrefill customer data
Server-side

If you’ve already collected your customer’s email and want to prefill it in the Checkout Session for them, pass customer_email when creating a Checkout Session.

Command Line
curl
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
curl https://api.stripe.com/v1/checkout/sessions \ -u
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:
\ -d customer_email="customer@example.com" \ -d "payment_method_types[]"=sepa_debit \ -d "line_items[][price]"=
{{PRICE_ID}}
\ -d "line_items[][quantity]"=1 \ -d mode=subscription \ -d success_url="https://example.com/success" \ -d cancel_url="https://example.com/cancel"

OptionalHandling trials
Server-side

You can use trial_end or trial_period_days on the Checkout session to specify the duration of the trial period. In this example we use trial_period_days to create a Checkout session for a subscription with a 30 days trial.

Command Line
curl
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
curl https://api.stripe.com/v1/checkout/sessions \ -u
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:
\ -d "payment_method_types[]"=sepa_debit \ -d "line_items[][price]"=
{{PRICE_ID}}
\ -d "line_items[][quantity]"=1 \ -d "subscription_data[trial_period_days]"=30 \ -d mode=subscription \ -d success_url="https://example.com/success?session_id={CHECKOUT_SESSION_ID}" \ -d cancel_url="https://example.com/cancel"

Checkout displays the following information automatically for subscriptions with trials:

  • Trial period
  • Frequency and amount of charges after trial expiration

For more information on compliance requirements, visit the Billing or support guide.

OptionalTax rates
Server-side

You can specify tax rates (Sales, VAT, GST, and others) in Checkout Sessions to apply taxes to subscriptions.

  • Use fixed tax rates when you know the exact tax rate to charge your customers before they start the checkout process (for example, you only sell to customers in the UK and always charge 20% VAT).
  • With the Prices API, you can use dynamic tax rates when you require more information from your customer (for example, their billing or shipping address) before determining the tax rate to charge. With dynamic tax rates, you create tax rates for different regions (for example, a 20% VAT tax rate for customers in the UK and a 7.25% sales tax rate for customers in California, US) and Stripe attempts to match your customer’s location to one of those tax rates.

Set subscription_data.default_tax_rates to apply a default tax rate to a subscription started with Checkout.

Command Line
curl
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
curl https://api.stripe.com/v1/checkout/sessions \ -u
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:
\ -d "payment_method_types[]"=sepa_debit \ -d "line_items[][price]"=
{{PRICE_ID}}
\ -d "line_items[][quantity]"=1 \ -d "subscription_data[default_tax_rates][]"="{{TAX_RATE_ID}}" \ -d mode=subscription \ -d success_url="https://example.com/success" \ -d cancel_url="https://example.com/cancel"

You can also specify line_items.tax_rates or subscription_data.items.tax_rates to apply tax rates to specific plans or invoice line items.

Command Line
curl
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
curl https://api.stripe.com/v1/checkout/sessions \ -u
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:
\ -d "payment_method_types[]"="sepa_debit" \ -d "line_items[][price]"=
{{PRICE_ID}}
\ -d "line_items[][quantity]"=1 \ -d "line_items[][tax_rates][0]"="{{TAX_RATE_ID}}" \ -d "mode"="subscription" \ -d "success_url"="https://example.com/success" \ -d "cancel_url"="https://example.com/cancel"

You can use Stripe’s data exports to populate the periodic reports required for remittance. Visit Tax reporting and remittance for more information.

OptionalAdding coupons
Server-side

You can apply coupons to subscriptions in a Checkout Session by setting discounts. This coupon overrides any coupon on the customer. If you’re creating a subscription with an existing customer, any coupon associated with the customer is applied to the subscription’s invoices.

Command Line
curl
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
curl https://api.stripe.com/v1/checkout/sessions \ -u
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:
\ -d "payment_method_types[]"=sepa_debit \ -d "line_items[][price]"=
{{PRICE_ID}}
\ -d "line_items[][quantity]"=1 \ -d "discounts[][coupon]"="{{COUPON_ID}}" \ -d "mode"="subscription" \ -d success_url="https://example.com/success" \ -d cancel_url="https://example.com/cancel"

Adding customer-facing promotion codes

You can also enable user-redeemable Promotion Codes using the allow_promotion_codes parameter in Checkout Sessions. When allow_promotion_codes is enabled on a Checkout Session, Checkout includes a promotion code redemption box for your customers to use. Create your coupons and promotion codes through the Dashboard or API in order for your customers to redeem them in Checkout.

Command Line
curl
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
curl https://api.stripe.com/v1/checkout/sessions \ -u
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:
\ -d "payment_method_types[]"="sepa_debit" \ -d "line_items[0][price_data][unit_amount]"=2000 \ -d "line_items[0][price_data][currency]"="eur" \ -d "line_items[0][price_data][product]=
{{PRODUCT_ID}}
"
\ -d "line_items[0][price_data][recurring][interval]=month" \ -d "line_items[0][quantity]"=1 \ -d "allow_promotion_codes"="true" \ -d "mode"="subscription" \ -d "success_url"="https://example.com/success" \ -d "cancel_url"="https://example.com/cancel"

See also

  • Customize your integration
  • Manage subscriptions with the customer portal
Was this page helpful?
YesNo
  • Need help? Contact Support.
  • Join our early access program.
  • Check out our changelog.
  • Questions? Contact Sales.
  • LLM? Read llms.txt.
  • Powered by Markdoc