Skip to content
Create account
or
Sign in
The Stripe Docs logo
/
Ask AI
Create account
Sign in
Get started
Payments
Finance automation
Platforms and marketplaces
Money management
Developer tools
Get started
Payments
Finance automation
Get started
Payments
Finance automation
Platforms and marketplaces
Money management
Overview
Billing
    Overview
    About the Billing APIs
    Subscriptions
      Overview
      Quickstart
      Use cases
      Build your integration
      Subscription features
        Subscription invoices
        Subscription schedules
        Subscription pricing
        Recurring pricing models
        Embed a pricing table
        Start subscriptions
        Set quantities
        Set billing cycles
        Backdate subscriptions
        Subscribe to multiple items
        Set trial periods
        Apply coupons
        Migrate subscriptions to Stripe
        How credit prorations are calculated
        Subscription payments
        Subscription payment methods
          ACH Direct Debit
          Amazon Pay
          Bacs Direct Debit in the UK
          Bank transfer
          BECS Direct Debit in Australia
          Cash App Pay
          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
          Sofort with SEPA Direct Debit
        Integrate with third-party payment processing
        Collection methods
        Share a link to update payment details
        Strong Customer Authentication (SCA)
        Manage subscriptions
        Modify subscriptions
        Manage pending updates
      Analytics
    Invoicing
    Usage-based billing
    Connect and Billing
    Tax and Billing
    Quotes
    Revenue recovery
    Automations
    Scripts
    Revenue recognition
    Customer management
    Entitlements
    Test your integration
Tax
Reporting
Data
Startup incorporation
HomeFinance automationBillingSubscriptionsSubscription featuresSubscription payment methods

Set up a subscription with Sofort and SEPA Direct Debit

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

Copy page

Warning

SOFORT has been discontinued as of March 31, 2025. For more information, read our support page.

Sofort is a single use payment method that requires customers to authenticate each payment. After your customer authenticates the payment, Stripe saves your customer’s IBAN in a SEPA Direct Debit payment method. You can then use the SEPA Direct Debit payment method to accept future payments.

Stripe sample

Check out the sample on GitHub or explore the demo.

With this integration, Stripe charges the first Subscription payment through Sofort to collect your customer’s bank details. If you’re offering a free trial, Stripe charges your customer 1 EUR through Sofort to collect their bank details and immediately refunds it.

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. After your customer completes a purchase, they’re redirected back to your site.

Set up Stripe
Server-side

Install the Stripe client of your choice:

Command Line
Ruby
# Available as a gem sudo gem install stripe
Gemfile
Ruby
# 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 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: Standard pricing | 15 EUR
  • Basic product: Basic service with minimum features

    • Price: Standard pricing | 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>

Session parameters

See Create a Checkout Session for a complete list of parameters that you can use.

Create a Checkout Session with the ID of an existing Price. Make sure that the mode is set to subscription and that 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.

When creating a Session, you can specify payment_method_types or have Stripe automatically pick payment methods based on your Dashboard settings. If you don’t specify payment_method_types, you must turn on Sofort recurring payments in the Dashboard. This enables SEPA Direct Debit for recurring Sofort payments only, but doesn’t turn on SEPA Direct Debit payments as a stand alone payment method.

Command Line
cURL
curl https://api.stripe.com/v1/checkout/sessions \ -u
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:
\ -d "payment_method_types[]"="sofort" \ -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.

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 is successful.

Sofort is a delayed notification payment method, which means that funds aren’t immediately available. A Sofort payment takes up to 14 business days to make the funds available. Because of this possibility, you might want to delay order fulfillment until the funds are available. After the payment succeeds, the underlying PaymentIntent status changes from processing to succeeded.

Stripe recommends fulfilling orders during the processing state. On average, approximately 0.2% of Sofort payments fail after entering the processing state.

There are several ways you can confirm the payment is successful:

Successful payments appear in the Dashboard’s list of payments. Click a payment to open 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

Using your test API keys, select Sofort as the payment method and click the Subscribe button. After confirming, you’re redirected to a test page with options to authorize or fail the payment. Sofort payments remain pending for 3 minutes in a sandbox.

  • Click Authorize test payment to test the case when the setup is successful.
  • Click Fail test payment to test the case when the customer fails to authenticate.

OptionalCreate a trial for your subscription

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