Docs » Payment Link Edit on GitHub

Payment Link

Use this API to generate payment links. This API is designed to be fault-tolerant and forgiving. Here is some pseudocode to show how simple it is:

POST https://api.scanpay.dk/v1/new
Authorization: Basic MTE1MzpZSFpJVUdRdzZOa0NJWWEzbUc2Q1djZ1NobmwxM3h1STdPREZVWXVNeTBqNzkwUTZUaHdCRWp4ZldGWHdKWjBX
{
    "items": [
        {
            "total": "159.90 DKK"
        }
    ]
}

This is the absolute minimum you can send to create a payment link. The more information you include the better we can protect your business against fraud.

Request Headers

The request endpoint is: https://api.scanpay.dk/v1/new

HTTP/1.1 headersDescription
Authorization: Basic MTE1MzpZSFpJVUdRdzZOa0NJWWEzbUc2Q1djZ1NobmwxM3h1STdPREZVWXVNeTBqNzkwUTZUaHdCRWp4ZldGWHdKWjBXHTTP Basic authentication. Read more.
X-Cardholder-IP: 47.105.175.99The IPv4 or IPv6 address of the customer.

Request Fields

All request fields are listed below. All fields are optional.

JSON fieldsDescription
"orderid": "1234zx"A unique ID that you choose. Never reuse IDs or your synchronization may behave in unexpected ways.
"successurl": "http://blixen.dk/success"Redirect to this URL after succesful payment. If omitted we will show a generic success message.
"items": [
    {
        "name": "iPhone 8 64GB Grå",
        "quantity": 2,
        "total": "12998 DKK",
        "sku": "sjk23"
    },
    {
        "name": "Grønt iPhone cover",
        "quantity": 2,
        "total": "399.9986 DKK"
    }
]
An array with items.
  • name: The name of the item.
  • quantity: The number of items (integer).
  • total: The line total (i.e. unit-price x quantity) with an ISO 4217 currency code.
  • sku: A SKU for this particular product.
In this example the grand total is 13397.9986 DKK. Most acquires only support 2 digits after the decimal point. If this is the case we will truncate to 13397.99.
"billing": {
    "name": "Øjvind Jakobsen",
    "company": "Karen Blixen Museet ApS",
    "vatin": "DK14915508",
    "gln": "5790002195341",
    "email": "øjvind@blixen.dk",
    "phone": "+45 45571057",
    "address": ["Rungsted Strandvej 111"],
    "city": "Rungsted Kyst",
    "zip": "2960",
    "state": "Hovedstaden",
    "country": "DK"
},
"shipping": {
    "name": "Thomas Fasti Dinesen",
    "company": "Karen Blixen Museet ApS",
    "email": "thomas@dinesen.dk",
    "phone": "0045 45571057",
    "address": [
        "Att. Thomas Fasti Dinesen",
        "Rungsted Strandvej 111"
    ],
    "city": "Rungsted Kyst",
    "zip": "2960",
    "state": "",
    "country": "DK"
}
Customer billing and shipping address.
  • name: The full name.
  • company: Legal company name.
  • vatin: EU VAT identification number.
  • gln: Global Location Number or European Article Numbering (EAN-number).
  • email: E-mail address.
  • phone: Phone number with country prefix.
  • address: An address array where each element is a new line.
  • zip: Postal code.
  • city: City.
  • state: State or region.
  • country: Two-letter country code (ISO 3166-1).
"language": "da"Preferred language for the payment window. We fallback to the Accept-Language header.
"autocapture": trueAutomatically capture the payment. Default is false.
"lifetime": "2d 12h 30m"Set payment link lifetime in days (d), hours (h) or minutes (m). Default is "1h" and max is "30d"

Response Fields

Successful responses have a 200 HTTP status code with the following JSON field:

JSON fieldDescription
"url": "https://betal.scanpay.dk/9qdvbx2r"The returned payment link.

MobilePay

Redirect customers to MobilePay Online by appending a ?go=mobilepay query string to the payment link. This will only work if MobilePay is enabled (here) and if your acquirer supports MobilePay.

Examples

Here are a few examples. We recommend that you take a look at our official client libraries.

curl https://api.scanpay.dk/v1/new \
  -u 'Your scanpay API key' \
  --data-binary '{
      "orderid": "a766409",
      "language": "da",
      "successurl": "http://blixen.dk/success",
      "items": [
          {
              "name": "Pink Floyd: The Dark Side Of The Moon",
              "quantity": 2,
              "total": "199.98 DKK",
              "sku": "fadf23"
          },
          {
              "name": "巨人宏偉的帽子",
              "quantity": 2,
              "total": "199.98 DKK",
              "sku": "124"
          }
      ],
      "billing": {
          "name": "Øjvind Jakobsen",
          "company": "Karen Blixen Museet ApS",
          "vatin": "DK14915508",
          "gln": "5790002195341",
          "email": "øjvind@blixen.dk",
          "phone": "+45 45571057",
          "address": ["Rungsted Strandvej 111"],
          "city": "Rungsted Kyst",
          "zip": "2960",
          "state": "Hovedstaden",
          "country": "DK"
      },
      "shipping": {
          "name": "Thomas Fasti Dinesen",
          "company": "Karen Blixen Museet ApS",
          "email": "thomas@dinesen.dk",
          "phone": "0045 45571057",
          "address": [
              "Att. Thomas Fasti Dinesen",
              "Rungsted Strandvej 111"
          ],
          "city": "Rungsted Kyst",
          "zip": "2960",
          "state": "",
          "country": "DK"
      }
  }'