Commerce Payments

This guide covers everything you need to know to integrate Swish commerce payments through the Ping Payments API.

Swish is a Swedish mobile payment system. Commerce payments come in two flavors:

  • E-Commerce: The customer provides their phone number at checkout and receives a push notification in the Swish app.
  • M-Commerce: The customer is on a mobile device and is redirected directly to the Swish app (or scans a QR code).

Supported Currency

SEK — Swish only supports Swedish Krona.

M-Commerce Payments

In the m-commerce flow, the customer's phone number is not known upfront. Instead, the API returns a URL and token that can be used to open the Swish app directly (via deep link) or to generate a QR code.

Customer on mobile: Use the returned url deep link to open the Swish app directly on the customer's device.

Customer on desktop: Set use_qr_code to true and display the returned QR code. The customer scans it with their phone to open the Swish app.

Flow

  1. You initiate a payment with provider: "swish" and method: "m_commerce".
  2. The response contains a url (Swish app deep link) and a payment_request_token.
  3. If the customer is on mobile, redirect them to the url to open the Swish app. If the customer is on desktop, display the QR code (requires use_qr_code: true).
  4. Customer confirms the payment with BankID in the Swish app.
  5. Payment status is delivered via the standard Ping Payments callback.

Required Parameters

ParameterTypeDescription
messagestringMessage shown to the payer in the Swish app. Max 50 characters. Allowed characters: 0-9 A-Z a-z Å Ä Ö å ä ö ! ? ( ) , - . : ; " @ and space.

Optional Parameters

ParameterTypeDefaultDescription
use_qr_codebooleanfalseSet to true to generate a QR code for the payment
qr_formatstring"transparent_svg"QR code image format. One of: transparent_svg, transparent_png, solid_jpg, solid_svg, solid_png
qr_sizeinteger300QR code image size in pixels. Minimum 300
qr_borderinteger1QR code border size in pixels. Range: 14

Example Request

{
  "currency": "SEK",
  "method": "m_commerce",
  "order_items": [
    {
      "amount": 10000,
      "merchant_id": "{{merchantId}}",
      "name": "Product A"
    }
  ],
  "provider": "swish",
  "total_amount": 10000,
  "provider_method_parameters": {
    "message": "Order #12345",
    "use_qr_code": true,
    "qr_format": "solid_png",
    "qr_size": 400
  }
}

Example Response

{
  "id": "15c44587-7ebb-43a3-b437-8d00e5f8df7a",
  "provider_method_response": {
    "url": "swish://paymentrequest?token=abc123...",
    "payment_request_token": "abc123...",
    "qr_code": "<base64-encoded image data>"
  }
}
FieldDescription
urlDeep link URL to open the Swish app on the customer's device
payment_request_tokenToken identifying the payment request. Can be used to build custom Swish URLs
qr_codeBase64-encoded QR code image. Only present if use_qr_code was true

E-Commerce Payments

In the e-commerce flow, the customer enters their Swish-connected phone number during checkout. A push notification is sent to the customer's Swish app, where they confirm the payment using BankID.

Flow

  1. Customer enters their phone number at checkout.
  2. You initiate a payment with provider: "swish" and method: "e_commerce".
  3. Swish sends a push notification to the customer's Swish app.
  4. Customer opens the Swish app and confirms the payment with BankID.
  5. Payment status is delivered via the standard Ping Payments callback.

Required Parameters

ParameterTypeDescription
phone_numberstringSwish-connected phone number of the payer. Swedish format, e.g. "0739000001" or "+46739000001"
messagestringMessage shown to the payer in the Swish app. Max 50 characters. Allowed characters: 0-9 A-Z a-z Å Ä Ö å ä ö ! ? ( ) , - . : ; " @ and space

Example Request

{
  "currency": "SEK",
  "method": "e_commerce",
  "order_items": [
    {
      "amount": 10000,
      "merchant_id": "{{merchantId}}",
      "name": "Product A"
    }
  ],
  "provider": "swish",
  "total_amount": 10000,
  "provider_method_parameters": {
    "phone_number": "0739000001",
    "message": "Order #12345"
  }
}

Example Response

{
  "id": "15c44587-7ebb-43a3-b437-8d00e5f8df7a"
}

The e-commerce response contains no additional provider_method_response fields. The payment is confirmed entirely through the Swish app push notification.


Refunds

Swish commerce payments support refunds through the standard Ping Payments refund flow. Refunds are processed asynchronously.