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 headers | Description |
---|---|
Authorization: Basic MTE1MzpZSFpJVUdRdzZOa0NJWWEzbUc2Q1djZ1NobmwxM3h1STdPREZVWXVNeTBqNzkwUTZUaHdCRWp4ZldGWHdKWjBX | HTTP Basic authentication. Read more. |
X-Cardholder-IP: 47.105.175.99 | The IPv4 or IPv6 address of the customer. |
Request Fields
All request fields are listed below. All fields are optional.
JSON fields | Description |
---|---|
"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.
|
"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.
|
"language": "da" | Preferred language for the payment window. We fallback to the Accept-Language header. |
"autocapture": true | Automatically 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 field | Description |
---|---|
"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": "Økologisk æblekage",
"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"
}
}
'