Create and list subscriptions, create order for subscription, start initial payment, create new order for the same subscription and then start recurring payment.

Create a new subscription

Create a new subscription.

POST /ps/api/public/v1/merchants/{merchant_key}/subscriptions

Identifiers

NameTypeDescription
merchant_keyMerchantKeyThe key of the merchant.

Parameters

Not applicable.

Request

FieldTypeMDescription
subscription_referenceString(1, 255)MThe subscription reference from the merchant.

Response

Not applicable.

HTTP Status

StatusMeaning
201 (Created)The subscription is successfully created.
400 (Bad Request)The request was not valid.
401 (Unauthorized)Authorization header missing or invalid.
403 (Forbidden)The merchant key is not allowed.

Create subscription example

> curl \
    -X POST \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Basic RG9jZGF0YVBGOkJXazJhZkpV' \
    https://testsecure.docdatapayments.com/ps/api/public/v1/merchants/4ef08825-993a-424d-a769-3ee97116a1b6/subscriptions \
    -d '{
        "subscription_reference"   : "vk20210318a"
    }'
 
< Http 201 Created

Create a new order

Create a new order for a subscription. This is the same as creating a normal order, except the subscription reference needs to given in the url.

It is advisable to supply a billing address for the shopper to be used on the mandate. See Create order for more details.

POST /ps/api/public/v1/merchants/{merchant_key}/subscriptions/{subscription_reference}/orders

Start Initial Payment

Starts a new payment for the given Order of a Subscription. This is the initial payment (first payment for the subscription) in which the shopper authorizes the details using the menu or the via Start Payment endpoint.

Get details of subscription

Returns the details of a subscription including the orders.

GET /ps/api/public/v1/merchants/{merchant_key}/subscriptions/{subscription_reference}

Identifiers

NameTypeDescription
merchant_keyMerchantKeyThe key of the merchant.
subscription_referenceString(1, 255)The subscription reference from the merchant.

Parameters

Not applicable.

Request

Not applicable.

Response

FieldTypeMDescription
timestampDateTimeMThe date and time when the subscription was created.
methodPaymentMethodCThe payment method, e.g. "IDEAL" or "SEPA_DIRECT_DEBIT". Only available when a initial-recurring payment was authorized.
mandate_numberString(1, 255)CThe mandate number. Only available when a initial-recurring payment was authorized.
ordersBlock[]OA list of orders on this subscription.
+ order_referenceString(1, 255)MThe order reference from the merchant.
+ timestampDateTimeMThe date and time when the order was created.
+ order_keyOrderKeyMThe key of the order.
+ considered_safeBlockCThe considered safe result. Only available when the order is considered safe.
+ + levelEnum(16)MThe considered safe level for the order: "FASTEST", "FAST", "SAFE" or "SAFEST".
+ + timestampDateTimeMThe date and time in seconds when the order was considered safe. Formatted according ISO 8601 with timezone in UTC.

HTTP Status

StatusMeaning
200 (OK)Success.
403 (Forbidden)The merchant key is not correct.
404 (Not Found)The reference for the subscription was not found.

Subscription Details example

> curl \
    -X GET \
    --header 'Authorization: Basic RG9jZGF0YVBGOkJXazJhZkpV' \
    https://testsecure.docdatapayments.com/ps/api/public/v1/merchants/4ef08825-993a-424d-a769-3ee97116a1b6/subscriptions/vk20170224p
 
< Http 200 Ok
<   '{
        "timestamp"     : "2017-02-24T17:08:13Z",
        "method"        : "SEPA_DIRECT_DEBIT",
        "mandate_number": "ddps-148795461791824269",
        "orders"        : [
            {
                "order_reference"   : "vk20170224p",
                "timestamp"         : "2017-02-24T17:08:31Z",
                "order_key"         : "F1499C097FFA533D46FB05D52680AB9A",
                "considered_safe"   : {
                    "level" : "SAFE",
                    "timestamp" : "2017-02-24T17:09:58Z"
                }
            },
            {
                "order_reference"   : "vk20170320b",
                "timestamp"         : "2017-02-25T09:31:22Z""
                "order_key"         : "29FF5671F59846D2E0F432A6E450B6AE"
            }
        ]
    }'

Create a new Order for each recurring payment

Create a new order for a subscription. This step is same as Create a new Order but now this order is for recurring payment.

It is advisable to supply a billing address for the shopper to be used on the mandate. See Create order for more details.

POST /ps/api/public/v1/merchants/{merchant_key}/subscriptions/{subscription_reference}/orders

Start Recurring Payment

Starts a new subsequent/recurring payment for the given Order of a Subscription.

The payment details of the initial-recurring payment are used, which the shopper should have authorized previously using the menu or the via Start Payment endpoint.

POST /ps/api/public/v1/merchants/{merchant_key}/subscriptions/{subscription_reference}/orders/{order_key}/payments

Identifiers

NameTypeDescription
merchant_keyMerchantKeyThe key of the merchant.
subscription_referenceString(1, 255)The subscription reference from the merchant.
order_keyOrderKeyThe key of the order.

Parameters

Not applicable.

Request

FieldTypeMDescription
sca_exemptionEnum(32)OThe requested exemption type. Default value is 'RECURRING'.
+ three_ri_authenticationBlockOThe 3RI authentication details.

Details about the 3RI authentication block and process can be found on 3RI Authentication.

For the field sca_exemption the following values are possible:

StatusDescription
RECURRINGThe payment is part of a scheduled subsequent transaction.
UNSCHEDULEDThe payment is part of an unscheduled subsequent transaction. For example a top-up payment. Must be enabled on the merchant account.

Response

FieldTypeMDescription
idPaymentIdentifierMThe payment identifier.
statusEnum(32)MThe authorization status of the payment.

For the field status the following values are possible:

StatusDescription
CANCELEDThe payment is canceled, due to an error.
AUTHENTICATION_REQUESTEDThe shopper needs to complete the authentication request that is pushed to its device.
AUTHORIZEDThe payment is authorized.

HTTP Status

StatusMeaning
201 (Created)The payment is created.
202 (Accepted)The payment is created and ended in canceled due to an error.
400 (Bad Request)The request was not valid.
403 (Forbidden)The merchant key is not correct.
404 (Not Found)The reference for the subscription or the order key was not found.

Start recurring payment example

> curl \
    -X POST \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Basic RG9jZGF0YVBGOkJXazJhZkpV' \
    https://testsecure.docdatapayments.com/ps/api/public/v1/merchants/4ef08825-993a-424d-a769-3ee97116a1b6/subscriptions/vk20210318a/orders/B72AD93F3CBFC47BB2173361D5DE573D/payments \
    -d '{
    "sca_exemption" : "RECURRING"
    }'
 
< Http 201 Created 
<    '{
        "id"        : "pid2163180628t",
        "status"    : "AUTHORIZED"
     }'