Swish Widget - Integration Flow
The swish payment widget API is a fast way to get Start with Swish Payment. You initiate a Swish Payment via the Rest API and redirect the User to the RedirectURL received in the Response. We take care of the rest.
API REF - Initiates a swish payment for using the widget solution.API
Overview of Process
1. Initiate the Swish Payment
The request is similar to other Payment Widget Request for other Payment Methods, in order to try to simplify and harmonise between Payment Methods.
We highly recommend our newest API Payment Requests - A single endpoint for all payment methods, where you can define Payment Method in the Request or let the Users choose Payment Method in the Payment Request Widget.
curl --request POST \
--url 'https://b2b.payer.se/api/v2/payments/mobile/swish/initiate' \
--header 'Authorization: Bearer {token}' \
--data '{
"additionalReference": "{string}",
"amount": 1000,
"backToShopURL": "https://merchants.com/",
"callbackURL": "https://merchants.com/callback",
"countryCode": "SE",
"currencyCode": "SEK",
"externalPaymentReference": "a67b2f94-6388-4412-8515-62b71f9288db",
"languageCode": "sv",
"message": "Payment of order 1337.",
"orderId": "{int64}",
"redirectOnFailURL": "https://merchants.com/fail",
"redirectOnSuccessURL": "https://merchants.com/success"
}'
2. Redirect the User to the Swish Widget
Redirect the customer to the url
received in the response. The PaymentId is the main Id used in other Endpoints to fetch status, initiate Refunds etc.
{
"payment": {
....
},
.....
},
"externalPaymentReference": "{string}",
"id": "{int64}",
"orderId": "{int64}",
"paymentOperations": [
{
"createdDate": "{date-time}",
"description": "{string}",
"expiryDate": "2019-01-01",
"operationId": "{string}",
......
}
],
"status": "{string}",
},
"url": "https://b2b.payer.se/payment/widget/swish/128587e6-33cf-4805-9643-3af5745fefa8"
}
The User can Choose to Scan the QR Code with their Swish App or Use the Swish App on their device if they are on their own device.
3. Redirect after Payment, Callbacks and Events
After the User has completed the Swish Payment in their Swish App, the User is redirected back to the redirectOnSuccessURL set in Step 1.
Options and alternatives
The redirectOnSuccessURL, redirectOnFailURL and backToShopURL is used for redirect of the User based on the Payment Result.
The CallbackURL for fast callbacks to your application and use cases for apps not involved in the redirect flow.
There is also an option to use the Events API and subscribe to Payments Events for other systems to get updated for new statuses.
Swish Payments in Production
Before you can initiate Swish Payments in Production, contact Payer for information on how to connect your Swish E-Commerce Number to Payer's Partner Swish Number.
Swish Payments in Test Environment
To simplify for your testing we've simulated the Swish Payment connection so you don't need to download and install any Swish Testing Kit on your device.
###