Charge Subscriber
Charge money from a specific subscriber.
Request
POST https://api.scanpay.dk/v2/{shopid}:sub:{subid}/charge - subid is the ID you received from calling seq.
Headers
| HTTP header | Description |
|---|---|
Idempotency-Key: xM3h1STdPREZVWXVNeTBqNzkwUTZUaHdCRWp4ZldGWHdKWjBX | Sending this header lets you fetch the result of the request at a later time even if the connection gets cut off. Simply send an identical request with the same key to retrieve the response. |
Fields
The only required field is "items". All other fields are optional.
| JSON field | Description |
|---|---|
"orderid": "CHG-000712"
| Like a regular transaction, this is the order ID assigned to this specific purchase. |
"billing": {
"name": "Michael Jensen",
"company": "",
"vatin": "",
"gln": "",
"email": "",
"phone": "",
"address": [
"Hansens Allé 52"
],
"city": "Tøjmose",
"zip": "5883",
"state": "",
"country": ""
}
"shipping": {
"name": "Mette Jensen",
"company": "",
"email": "",
"phone": "",
"address": [
"Hansens Allé 52"
],
"city": "Tøjmose",
"zip": "5883",
"state": "",
"country": ""
}
| Overrides for the stored address of the subscriber. Each address is overridden in its totality if any of its fields is present in your request. |
"items": [
{
"name": "Monthly fee",
"quantity": 1,
"total": "99.95 DKK",
"sku": ""
}
]
| An array of one or more items exactly as in regular transactions. Each item requires a "total" but all other fields are optional. The total amount that will be authorized is the sum of all "total" elements added together. |
"autocapture": false
| Automatically capture the authorization. Unlike regular transactions this defaults to true. |
Response
There are no defined response fields and as such this returns an empty JSON object.
Headers
| HTTP header | Description |
|---|---|
Idempotency-Status: OK | The response is a replay. |
Errors
Errors returned from this call fall into two categories:
- transient, meaning the charge failed due to a temporary problem and shound be retried; and
- permanent, meaning you should contact the subscriber and have him renew his payment details.
To distinguish between the two, simply look at the first word of the error message:
permanent clearhaus error: card lost or stolen
transient nets error: kir (nets host) timeout
Transient errors should lead to retrying the charge, but you should not be too eager to retry. Acquirers recommend waiting 24 hours between retries and making a maximum of 5 attempts in total.
Conversely, permanent errors should never lead to retries. Acquirers might outright fine you for doing so.