Testing Guide
This guide covers how to test your Swish integration through the Ping Payments API.
The Ping Payments sandbox environment is backed by two Swish testing tools: the Merchant Swish Simulator (MSS) and the Swish Sandbox App. Both are available by default — no additional setup is required on your end.
How Testing Works
When you send Swish payment requests to the Ping Payments sandbox environment, the requests are routed through Swish's test infrastructure. You use the exact same API format as production — the only difference is the environment you're pointing at.
Merchant Swish Simulator (MSS)
MSS is the default and recommended test backend. It validates your requests and returns simulated responses, including callbacks to your callback URL. No mobile app, test accounts, or customer interaction is needed — it works out of the box.
- A valid payment request results in a callback with
COMPLETEDstatus. - An invalid request returns an error response.
Simulating Errors
You can trigger specific error scenarios by including a Swish error code in the message field of your payment request. When MSS detects a known error code in the message, it simulates that error instead of returning a successful payment.
Example: Simulating a Declined Payment
{
"currency": "SEK",
"method": "e_commerce",
"order_items": [
{
"amount": 10000,
"merchant_id": "{{merchantId}}",
"name": "Test Product"
}
],
"provider": "swish",
"total_amount": 10000,
"provider_method_parameters": {
"phone_number": "0739000001",
"message": "DS24"
}
}This will result in a callback with ABORTED status (customer canceled).
Example: Successful Payment
Use a normal message (without an error code) for a successful flow:
{
"provider_method_parameters": {
"phone_number": "0739000001",
"message": "Order 12345"
}
}This will result in a callback with COMPLETED status.
Available Error Codes
| Error Code | Simulated Scenario | Expected Ping Status |
|---|---|---|
DS24 | Customer canceled the payment | ABORTED |
BANKIDCL | BankID identification failed | CRASHED |
ACMT03 | Payer not enrolled in Swish | CRASHED |
ACMT01 | Counterpart is not activated | CRASHED |
ACMT07 | Payee not enrolled in Swish | CRASHED |
RF07 | Transaction declined | DECLINED |
Swish Sandbox App
The Sandbox App provides a more complete testing experience. It simulates the full payment flow including the customer-side experience — opening the Swish app, confirming with BankID, etc. This is useful for verifying m-commerce flows (QR codes, deep links) and recurring consent signing.
Using the Sandbox App requires two test mobile applications:
- Swish Sandbox App — simulates the Swish app
- BankID Test App — simulates BankID authentication
You will also need test accounts from Swish to use the Sandbox App. Contact Ping Payments and we will help you order these from Swish.
From your integration's perspective, the API calls are identical. The difference is that with the Sandbox App, a test user can walk through the full customer experience on their phone instead of the payment being auto-completed by the simulator.
Updated 6 days ago