Common Workflow for Recurring Payment

The general workflow for recurring payment is:

  1. Make the initial payment with an interactive process;

  2. Make the subsequent payments with an automatic process.

If a subsequent payment fails (credit card discontinued, bank account changed, etc.) you need to repeat the initial payment and the interactive process.

The interactive process for the initial payment consists of the three steps demonstrated in the Getting Started part:

  1. Create a Payment Transaction;

  2. Direct the customer to the Payment Iframe provided by secupay;

  3. Check the status of the Payment Transaction when the customer arrives at your page again.

There is an additional attribute subscription to designate the Payment Transaction for recurring payment. With the initial payment, you pass it without an id:

Request
POST /api/v2/Payment/Secupaydebits HTTP/1.1
...
 
{
// ...
  "subscription": {
"purpose": "Gartengeräte-Club Mgl.-Nr. 551303"
},
// ...
}

The subscription purpose is your description to identify the business transaction. You need to pass it, when you create the Payment Transaction for every payment. Please don't mix it up with the top-level field purpose that is used for the bank statements and advice notes.

The secuconnect API assigns an subscription ID, and returns it in the response:

Response
HTTP/1.1 200 OK
...
 
{
// ...
"status": "internal_server_status",
"amount": 2495,
// ...
  "subscription": {
"id": 2391,
"purpose": "Gartengeräte-Club Mgl.-Nr. 551303"
},
// ...
"redirect_url": {
"iframe_url": "https://api-dev6.secupay-ag.de/payment/ngoxtnxyackd5221092",
// ...
},
// ...
}

When it creates the Payment Transactions for subsequent payments, your application needs to pass the subscription object with both, ID and purpose:

Response
POST /api/v2/Payment/Secupaydebits HTTP/1.1
...
{
// ...
"status": "accepted",
"amount": 550,
// ...
"subscription":
{
       "id": 2391,
"purpose": "Gartengeräte-Club Mgl.-Nr. 551303",
},
// ...
}