Make the Subsequent Payments

The subsequent payments are much simpler. If everything works well, it only needs one API call, very similar to the first call.

Since we have used SEPA direct debit for the first payment, the API endpoint is POST https://connect.secucard.com/api/v2/Payment/Secupaydebits:

Request
POST /api/v2/Payment/Secupaydebits HTTP/1.1
Host: connect-testing.secupay-ag.de
Authorization: Bearer qb56tjj1bcvo9n2nj4u38k84lo
Content-Type: application/json
Accept: application/json
 
{
"demo": true,
"customer": {
"id": "PCU_W7B3GGUDH2X3GH3YJ37YQ82Z03JFAZ"
},
"subscription": {
"id": 2402,
"purpose": "Gartengeräte-Club Mgl.-Nr. 220897"
},
"amount": 550,
"purpose": "Gartengeräte-Club Monatsgebühr",
"redirect_url": {
"url_success": "https://shop.example.com/checkout/payment/success",
"url_failure": "https://shop.example.com/checkout/payment/failure",
"url_push": "https://shop.example.com/order/payment/update"
}
}

This will create a Payment Transaction about €5.50.

Monetary amounts are expressed in the smallest currency unit (e. g. Euro Cent).

In difference to the initial payment we pass the customer ID instead of all the details, and we pass the subscription ID along with the subscription purpose.

If everything is fine, the API responds with 200 OK, and the object representation:

Response
HTTP/1.1 200 OK
Content-Type: application/json
...
 
{
"object": "payment.secupaydebits",
"id": "pdqlbdwitwyb5221104",
"trans_id": 33922084,
"payment_id": "PCI_EMHM0ZYJ0AUTTVZWKGG0UJ4PP484N4",
"status": "accepted",
"amount": 550,
"currency": "EUR",
"purpose": "Gartenger\u00e4te-Club Monatsgeb\u00fchr",
"order_id": null,
"transaction_status": 11,
"basket": null,
"accrual": false,
"payment_action": "sale",
"customer": {
"object": "payment.customers",
"id": "PCU_W7B3GGUDH2X3GH3YJ37YQ82Z03JFAZ",
"merchant": {
"object": "general.merchants",
"id": "MRC_WVHJQFQ4JNVYNG5B55TYK748ZCHQP8"
},
"contact": {
"forename": "Grover",
"surname": "Mustermann",
"name": "Grover Mustermann",
"address": {
"street": "Koelpinstr.",
"street_number": "604",
"postal_code": "09999",
"city": "Musterstadt",
"country": "DE"
},
"email": "SAS187@example.net"
},
"created": "2021-04-09T19:03:39+02:00"
},
"redirect_url": {
"iframe_url": "https:\/\/api-dev6.secupay-ag.de\/payment\/pdqlbdwitwyb5221104",
"url_success": "https:\/\/shop.example.com\/checkout\/payment\/success",
"url_failure": "https:\/\/shop.example.com\/checkout\/payment\/failure",
"url_push": "https:\/\/shop.example.com\/order\/payment\/update"
},
"iframe_url": "https:\/\/api-dev6.secupay-ag.de\/payment\/pdqlbdwitwyb5221104",
"used_payment_instrument": {
"type": "bank_account",
"data": {
"owner": "",
"iban": "DE02 XXXX XXXX 6808",
"bic": "PBNKDEFFXXX",
"bankname": "Postbank Ndl der Deutsche Bank"
}
},
"mandate": {
"identification": "OPI\/pdqlbdwitwyb5221104",
"creditor_id": "DE17ZZZ00000011109"
},
"subscription": {
"id": 2402,
"purpose": "Gartenger\u00e4te-Club Mgl.-Nr. 220897"
}
}

The status 11, accepted, signalises that the payment was successful.

Note: The payment can also fail, for instance because the payment instrument became invalid. In this case, you need to repeat the procedure for the first payment.