Swish paymentsInvite only
Learn how to accept Swish, a popular payment method in Sweden.
Swish is a single-use payment method used in Sweden. It allows customers to authenticate and approve payments using the Swish mobile app and the Swedish BankID mobile app.
You get immediate notification on whether the payment succeeded or failed.
Required notices
To comply with Swish rules, you must display the following text in your payment flow on the screen before the customer authorises the Swish payment:
- For English localisations: “Stripe Technology Europe Limited (“Stripe”) has acquired the claim for payment. Therefore, your payment will be made to Stripe.”
- For Swedish localisations: “Stripe Technology Europe Limited (“Stripe”) har övertagit fordran på betalning. Din betalning görs därför till Stripe.”
- For other languages, an equivalent translation of the above.
If you integrate Swish through a Stripe-hosted payment form or UI component such as Checkout or the Payment Element, Stripe displays this notice for you.
Set up StripeServer-side
Use our official libraries for access to the Stripe API from your application:
Create a PaymentIntentServer-side
A PaymentIntent is an object that represents your intent to collect a 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 currency. If you already have an integration using the Payment Intents API, add swish
to the list of payment method types for your PaymentIntent
.
Note
You can set the order reference to display to your customer in the Swish application.
Response
{ "id": "pi_12345", "amount": 6000, "client_secret": "pi_12345_secret_abcdef", "currency": "sek", "payment_method": "pm_12345", "payment_method_types": [ "swish" ], "payment_method_options": { "swish": { "reference": "Order-123", }, }, "status": "requires_confirmation" }
Retrieve the client secret
The PaymentIntent includes a client secret that the client side uses to securely complete the payment process. You can use different approaches to pass the client secret to the client side.
Confirm the PaymentIntent
Use the PaymentIntent id from step 2 to confirm the PaymentIntent. This declares that the customer intends to pay with the specified PaymentMethod. After the PaymentIntent is confirmed, it initiates a payment. The return_url indicates where Stripe redirects the user after they complete the payment.
Initiate the Swish payment by confirming the Payment Intent. Include a return_
to redirect your customer to after they complete the payment.
Response
{ "id": "pi_12345", "amount": 6000, "currency": "sek", "payment_method": "pm_12345", "next_action": { "swish_handle_redirect_or_display_qr_code": { "hosted_instructions_url": "https://stripe.com/hiu-pi_123", "qr_code": { "data": "abc123", "image_url_png": "https://qr.stripe.com/qr_123.png", "image_url_svg": "https://qr.stripe.com/qr_123.svg" } }, "type": "swish_handle_redirect_or_display_qr_code" }, "payment_method_types": [ "swish" ], "payment_method_options": { "swish": { "reference": "Order-123", }, }, "status": "requires_action" }
To authorise the payment, redirect your customer to the URL in the next_action[swish_handle_redirect_or_display_qr_code][hosted_instructions_url] field or load this page in an iframe. This page presents both QR code and a button to redirect to the Swish app.
Desktop users can scan the QR code using the Swish app, after which they can authorise the payment.
Users on mobile devices can click a button which redirects to the Swish app, where they can authorise the payment.
Note
Your customer has 3 minutes to authorise the payment in the Swish app, after which the payment fails and the Payment Intent transitions to requires_
.
Fulfill the orderServer-side
Use a method such as webhooks to handle order fulfilment. When a customer completes payment, the status of the PaymentIntent
transitions to succeeded
and sends the payment_intent.succeeded webhook event. If a customer doesn’t pay, the PaymentIntent
sends the payment_intent.payment_failed webhook event and returns to a status of requires_
.
Failed payments
Swish uses multiple data points to decide when to decline a transaction (for example, there aren’t enough funds in the customer’s bank account, or the customer has clicked Cancel in the app).
In these cases, the PaymentMethod is detached and the PaymentIntent object’s status automatically transitions to requires_
.
Other than a payment being declined, for a Swish PaymentIntent with a status of requires_
, customers must complete the payment within 3 minutes. If no action is taken after 3 minutes, the PaymentMethod is detached and the PaymentIntent object’s status automatically transitions to requires_
.