Edit on GitHub

Subscriptions

The Subscriptions API allows you to handle recurring payments. You can use it to charge customers on a regular basis or to save a customer's payment details, so the customer does not have to enter the information again. There are three API calls: Create subscriber, Charge subscriber and Renew Subscriber. Here we will show you how to use the API:

Create subscriber

The create subscriber API call will return a link to a payment page, where the customer can enter their payment details. The only required field is subscriber, but we recommend that you provide us with as much information as possible.

POST https://api.scanpay.dk/v1/new
Authorization: Basic MTE1MzpZSFpJV3k2aUdRdzZOa0NJ…
{
    "subscriber": {}
}

You will receive a ping when the customer has completed the process. You can then use the Synchronization API to retrieve the subscriber ID.

Charge subscriber

The charge subscriber API call will charge the specified subscriber, in this case subscriber 186. The only required field is items, but we recommend that you provide us with as much information as possible.

POST https://api.scanpay.dk/v1/subscribers/186/charge
Authorization: Basic MTE1MzpZSFpJV3k2aUdRdzZOa0NJ…
Idempotency-Key: xM3h1STdPREZVWXVNeTBqNzkwUTZUaHd…
{
    "items": [
        {
            "name": "Fitness membership",
            "total": "199 DKK"
        }
    ]
}

Renew subscriber

The renew subscriber API call will return a link to a payment page, where the customer can update their payment details e.g. if the card has expired. There are no required fields.

POST https://api.scanpay.dk/v1/subscribers/186/renew
Authorization: Basic MTE1MzpZSFpJV3k2aUdRdzZOa0NJ…
{}