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 COMPLETED status.
  • 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 CodeSimulated ScenarioExpected Ping Status
DS24Customer canceled the paymentABORTED
BANKIDCLBankID identification failedCRASHED
ACMT03Payer not enrolled in SwishCRASHED
ACMT01Counterpart is not activatedCRASHED
ACMT07Payee not enrolled in SwishCRASHED
RF07Transaction declinedDECLINED

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.