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
About Stripe payments
Upgrade your integration
Payments analytics
Online payments
OverviewFind your use caseManaged Payments
Use Payment Links
Build a checkout page
Build an advanced integration
Build an in-app integration
Payment Methods
Add payment methods
    Overview
    Payment method integration options
    Manage default payment methods in the Dashboard
    Payment method types
    Cards
    Bank debits
    Bank redirects
      Bancontact
      BLIK
      EPS
      FPX
      iDEAL
      Przelewy24
      Sofort
        Remove and replace SOFORT
        Accept a payment
        Save bank details during payment
        Set up future payments
      TWINT
    Bank transfers
    Credit transfers (Sources)
    Buy now, pay later
    Real-time payments
    Vouchers
    Wallets
    Enable local payment methods by country
    Custom payment methods
Manage payment methods
Faster checkout with Link
Payment interfaces
Payment Links
Checkout
Web Elements
In-app Elements
Payment scenarios
Custom payment flows
Flexible acquiring
Orchestration
In-person payments
Terminal
Other Stripe products
Financial Connections
Crypto
Climate
HomePaymentsAdd payment methodsBank redirectsSOFORT

Accept a Sofort payment

Learn how to accept Sofort, a common payment method in Europe.

Copy page

Warning

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

Caution

We recommend that you follow the Accept a payment guide unless you need to use manual server-side confirmation, or your integration requires presenting payment methods separately. If you’ve already integrated with Elements, see the Payment Element migration guide.

Sofort is a single use, delayed notification payment method that requires customers to authenticate their payment. Customers pay with Sofort by redirecting from your app to their bank’s portal to authenticate the payment. It typically takes 2 to 14 days to receive notification of success or failure.

Note

To accept Sofort, you must comply with the Sofort Terms of Service.

Set up Stripe
Server-side
Client-side

First, you need a Stripe account. Register now.

Server-side

This integration requires endpoints on your server that talk to the Stripe API. Use the official libraries for access to the Stripe API from your server:

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'

Client-side

The Stripe iOS SDK is open source, fully documented, and compatible with apps supporting iOS 13 or above.

To install the SDK, follow these steps:

  1. In Xcode, select File > Add Package Dependencies… and enter https://github.com/stripe/stripe-ios-spm as the repository URL.
  2. Select the latest version number from our releases page.
  3. Add the StripePaymentsUI product to the target of your app.

Note

For details on the latest SDK release and past versions, see the Releases page on GitHub. To receive notifications when a new release is published, watch releases for the repository.

Configure the SDK with your Stripe publishable key on app start. This enables your app to make requests to the Stripe API.

AppDelegate.swift
Swift
import UIKit import StripePaymentsUI @main class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { StripeAPI.defaultPublishableKey =
"pk_test_TYooMQauvdEDq54NiTphI7jx"
// do any other necessary launch configuration return true } }

Note

Use your test keys while you test and develop, and your live mode keys when you publish your app.

Create a PaymentIntent
Server-side

A PaymentIntent represents your intent to collect payment from a customer and tracks the lifecycle of the payment process.

Server-side

Create a PaymentIntent on your server and specify the amount to collect and the eur currency (Sofort doesn’t support other currencies). If you have an existing Payment Intents integration, add sofort to the list of payment method types.

Command Line
cURL
curl https://api.stripe.com/v1/payment_intents \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d amount=1099 \ -d currency=eur \ -d "payment_method_types[]"=sofort

Changing the preferred language

By default, Stripe presents the Sofort authorization page in a language based on the specified country code. You can customize this to the language preferred by your customer by specifying it as part of the request and changing the value of the preferred_language property. The supported values are de, en, es, it, fr, nl, and pl.

Command Line
cURL
curl https://api.stripe.com/v1/payment_intents \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d amount=1099 \ -d currency=eur \ -d "payment_method_types[]"=sofort \ -d "payment_method_options[sofort][preferred_language]"=de

Instead of passing the entire PaymentIntent object to your app, return its client secret. The PaymentIntent’s client secret is a unique key that lets you confirm the payment and update payment details on the client, without allowing manipulation of sensitive information, like payment amount.

Client-side

On the client, request a PaymentIntent from your server and store its client secret.

CheckoutViewController.swift
Swift
View full sample
class CheckoutViewController: UIViewController { var paymentIntentClientSecret: String? func startCheckout() { // Request a PaymentIntent from your server and store its client secret } }

Submit the payment to Stripe
Client-side

When a customer taps to pay with Sofort, confirm the PaymentIntent to complete the payment. Configure a STPPaymentIntentParams object with the PaymentIntent client secret from your server. Sofort requires that you collect the country code of your customer’s bank and pass it in the STPPaymentMethodSofortParams.

Rather than sending the entire PaymentIntent object to the client, use its client secret. This is different from your API keys that authenticate Stripe API requests. The client secret is a string that lets your app access important fields from the PaymentIntent (for example, status) while hiding sensitive ones (for example, customer).

Set up a return URL

The iOS SDK can present a webview in your app to complete the Sofort payment. When authentication is finished, the webview can automatically dismiss itself instead of having your customer close it. To enable this behavior, configure a custom URL scheme or universal link and set up your app delegate to forward the URL to the SDK.

Swift
// This method handles opening custom URL schemes (for example, "your-app://stripe-redirect") func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool { let stripeHandled = StripeAPI.handleURLCallback(with: url) if (stripeHandled) { return true } else { // This was not a Stripe url – handle the URL normally as you would } return false } // This method handles opening universal link URLs (for example, "https://example.com/stripe_ios_callback") func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool { if userActivity.activityType == NSUserActivityTypeBrowsingWeb { if let url = userActivity.webpageURL { let stripeHandled = StripeAPI.handleURLCallback(with: url) if (stripeHandled) { return true } else { // This was not a Stripe url – handle the URL normally as you would } } } return false }

Call STPPaymentHandler confirmPayment to complete the payment.

Swift
let paymentIntentParams = STPPaymentIntentParams(clientSecret: paymentIntentClientSecret) let sofort = STPPaymentMethodSofortParams() sofort.country = "DE" paymentIntentParams.paymentMethodParams = STPPaymentMethodParams(sofort: sofort, billingDetails: nil, metadata: nil) paymentIntentParams.returnURL = "payments-example://stripe-redirect" STPPaymentHandler.shared().confirmPayment(paymentIntentParams, with: self) { (handlerStatus, paymentIntent, error) in switch handlerStatus { case .succeeded: // Payment succeeded // ... case .canceled: // Payment canceled // ... case .failed: // Payment failed // ... @unknown default: fatalError() } }

Handle post-payment events

As Sofort is a delayed notification payment method, the PaymentIntent’s status remains in a payment_intent.processing state for up to 14 days from its creation (also known as the cutoff date). In a sandbox, the PaymentIntent’s status remains in the processing state for three minutes to simulate this.

  • Stripe recommends fulfilling purchases during the processing state. On average, you can expect approximately 0.2% of Sofort payment attempts to fail after entering the processing state. This only applies to Sofort payments due to its low payment failure rate and doesn’t apply to other delayed notification payment methods.
  • You may prefer to fulfil orders only after receiving the payment_intent.succeeded event. Stripe sends this event after the payment attempt is confirmed and the funds are guaranteed.
  • If a customer doesn’t pay, Stripe sends the payment_intent.failed event and the PaymentIntent returns to a status of requires_payment_method.

Use the Dashboard, a custom webhook, or a partner solution 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.

Manually

Use the Stripe Dashboard to view all your Stripe payments, send email receipts, handle payouts, or retry failed payments.

  • View your test payments in the Dashboard

Custom code

Build a webhook handler to listen for events and build custom asynchronous payment flows. Test and debug your webhook integration locally with the Stripe CLI.

  • Build a custom webhook

Prebuilt apps

Handle common business events, like automation or marketing and sales, by integrating a partner application.

Disputed payments

The risk of fraud or unrecognized payments is low because the customer must authenticate the payment with their bank. As a result, you won’t have disputes that turn into chargebacks, with funds withdrawn from your Stripe account.

Failed attempts

If a payment attempt hasn’t been confirmed within the cut-off time, the PaymentIntent object’s status automatically transitions from processing to requires_payment_method. Additionally, if the funds are received after the cut-off date, the customer is automatically refunded.

On average, you can expect approximately 0.2% of Sofort payment attempts to fail. This may vary based on your industry or customer base. Depending on your average payment amount, the type of products or service you provide, and the risk associated with your business, you may prefer to fulfill orders only after receiving the payment_intent.succeeded event.

Refunds

Sofort only accepts refund requests within 180 days from the date of the original payment. After 180 days, it’s no longer possible to refund the payment.

You can submit a refund against pending charges that haven’t been confirmed yet. If you create a full or partial refund when a PaymentIntent’s status is processing, the refund occurs only after the PaymentIntent’s status is succeeded. If the PaymentIntent’s status is requires_payment_method after a payment attempt fails, full and partial refunds are marked as cancelled because the money never left the customer’s bank account.

Was this page helpful?
YesNo
Need help? Contact Support.
Join our early access programme.
Check out our changelog.
Questions? Contact Sales.
LLM? Read llms.txt.
Powered by Markdoc