Edit

Getting started

This is the entirety of our API:

https://api.scanpay.dk/v2/{shopid}:pay/new
https://api.scanpay.dk/v2/{shopid}:pay:{payid}/expire
https://api.scanpay.dk/v2/{shopid}:trn:{trnid}/capture
https://api.scanpay.dk/v2/{shopid}:trn:{trnid}/refund
https://api.scanpay.dk/v2/{shopid}:trn:{trnid}/void
https://api.scanpay.dk/v2/{shopid}:sub:{subid}/charge
https://api.scanpay.dk/v2/{shopid}:sub:{subid}/renew
https://api.scanpay.dk/v2/{shopid}:sub:{subid}/invalidate
https://api.scanpay.dk/v2/{shopid}:seq:{prevseq}

What it all means will be covered in the API overview section.

How do I use it?

First, you (the merchant) create a payment link:

curl -u {apikey} -d '{"items":[{"total":"99.95DKK"}]}' https://api.scanpay.dk/v2/{shopid}:pay/new
{
  "url": "https://betal.scanpay.dk/q3z3amhrkmyrgk6i",
  "id": "q3z3amhrkmyrgk6i"
}

You then redirect the customer (payer) to the returned URL. The payer, in turn, enters his credit card information in our payment window and clicks the "Pay" button.

Now that the order has been paid, a transaction has been created in our transaction database. Let's retrieve the information:

curl -u {apikey} https://api.scanpay.dk/v2/{shopid}:seq:0
{
  "changes": [
    {
      "type": "transaction",
      "id": 1,
      "rev": 1,
      "locked": null,
      "method": {
        "type": "card",
        "id": "JlVFYo77jukOmuAmy6PavAjClA61pM0ydR2rAhCs7lw",
        "card": {
          "brand": "visa",
          "last4": "1111"
        }
      },
      "services": [
        "clearhaus"
      ],
      "info": {
        "ip": "198.51.100.2",
        "ndisplay": 1,
        "nfail": 0
      },
      "time": {
        "created": 1761139386,
        "authorized": 1761139415
      },
      "orderid": "",
      "billing": {
        "name": "",
        "company": "",
        "vatin": "",
        "gln": "",
        "email": "",
        "phone": "",
        "address": [],
        "city": "",
        "zip": "",
        "state": "",
        "country": ""
      },
      "shipping": {
        "name": "",
        "company": "",
        "email": "",
        "phone": "",
        "address": [],
        "city": "",
        "zip": "",
        "state": "",
        "country": ""
      },
      "items": [
        {
          "quantity": 1,
          "total": "99.95 DKK",
          "name": "",
          "sku": ""
        }
      ],
      "acts": [],
      "totals": {
        "attempted": "99.95 DKK",
        "authorized": "99.95 DKK",
        "captured": "0 DKK",
        "refunded": "0 DKK",
        "voided": "0 DKK",
        "left": "99.95 DKK"
      }
    }
  ],
  "seq": 1
}

You'll notice that almost none of it is filled out. That's because we didn't fill it out when we made the payment link. However more importantly, you now have access to the transaction ID (highlighted above), with which you can capture the authorization:

curl -u {apikey} -d '{"total":"99.95DKK","index":0}' https://api.scanpay.dk/v2/{shopid}:trn:1/capture
{}

And as you can tell, that returned absolutely nothing of use, except to say that the capture was successful. So let's go and get the updated transaction data. Last time we called seq with a value of 0 and it told us that next time we need to call it with a value of 1:

curl -u {apikey} https://api.scanpay.dk/v2/{shopid}:seq:1
{
  "changes": [
    {
      "type": "transaction",
      "id": 1,
      "rev": 2,
      "locked": null,
      "method": {
        "type": "card",
        "id": "JlVFYo77jukOmuAmy6PavAjClA61pM0ydR2rAhCs7lw",
        "card": {
          "brand": "visa",
          "last4": "1111"
        }
      },
      "services": [
        "clearhaus"
      ],
      "info": {
        "ip": "198.51.100.2",
        "ndisplay": 1,
        "nfail": 0
      },
      "time": {
        "created": 1761139386,
        "authorized": 1761139415
      },
      "orderid": "",
      "billing": {
        "name": "",
        "company": "",
        "vatin": "",
        "gln": "",
        "email": "",
        "phone": "",
        "address": [],
        "city": "",
        "zip": "",
        "state": "",
        "country": ""
      },
      "shipping": {
        "name": "",
        "company": "",
        "email": "",
        "phone": "",
        "address": [],
        "city": "",
        "zip": "",
        "state": "",
        "country": ""
      },
      "items": [
        {
          "quantity": 1,
          "total": "99.95 DKK",
          "name": "",
          "sku": ""
        }
      ],
      "acts": [
        {
          "act": "capture",
          "time": 1761139447,
          "apikey": "{apikey identifier}",
          "total": "99.95 DKK",
          "history": []
        }
      ],
      "totals": {
        "attempted": "99.95 DKK",
        "authorized": "99.95 DKK",
        "captured": "99.95 DKK",
        "refunded": "0 DKK",
        "voided": "0 DKK",
        "left": "0 DKK"
      }
    }
  ],
  "seq": 2
}

Not much has changed. There is now an entry in the "acts" array that denotes a capture action has been performed, when it happened, and by whom it was initiated. The totals have been updated to reflect how much money can be used for what. However most importantly, the "rev" field has been increased, denoting the revision (or version) of the data. This is what will allow you to safely merge this data into your own database.

You may also notice that this time we received "seq": 2 back, telling us that next time we need to call seq with a value of 2.

Now let's dig a little deeper in the API overview section.