Accept Swish payments using our APIs, and build your own payment form to have full control over the look and feel of your checkout page.
Requirements
Requirement | Description |
---|---|
Integration type | Make sure that you have an existing API-only integration. |
Setup steps | Before you begin, add Swish in your test Customer Area. |
Build your payment form for Swish
Show Swish as an available payment method in your payment form. You do not need to collect any information from the shopper in your payment form.
We provide a Swish logo which you can use on your payment form. For more information, refer to Downloading logos.
You can also submit a /paymentMethods request specifying:
countryCode
: SEamount.currency
: SEK.
In the response, you receive paymentMethod.type
: swish.
Make a payment
When a shopper chooses to pay with Swish mobile, you need to redirect them to the Swish app, depending on how they are accessing your site:
- For shoppers on desktop or laptop, present a QR code.
- For shoppers on mobile, present a button that redirects to the Swish app.
- For shoppers on tablet, you can present a QR code or a button that redirects to the Swish app, or both.
We recommend that you use screen size to determine whether the shopper is accessing your site on mobile, desktop, or tablet.
-
From your server, make a /payments request, providing:
paymentMethod.type
: swish-
returnUrl
: The URL where the shopper is redirected back to after completing the payment.
The following code sample is a /payments request for a Swish payment.
The /payments response contains:
action.qrCodeData
: Use this to present the QR code.action.url
: Use this to redirect the shopper to the Swish app.
Present QR code
- Use the
qrCodeData
from theaction
object to render the QR code on your checkout page. - When the shopper completes the payment, we'll send a webhook informing you of the payment result.
Redirect shopper
- Use the
url
from theaction
object to redirect the shopper to the Swish app. - When the shopper completes the payment, we'll send a webhook informing you of the payment result.
Test and go live
When you make a Swish payment in the test environment, the payment is authorised within 15 seconds. You can simulate different refusal scenarios, as outlined in the Merchant Swish Simulator, by adding the error code to the shopperStatement
property. For example, "shopperStatement": "FF08"
.
Check the status of Swish test payments in your Customer Area > Transactions > Payments.
To accept live Swish payments, you must submit a request for Swish in your live Customer Area.