Authorise and Capture the Payment

The payment is carried out the same way as described before. You authorize the Smart Transaction for SEPA direct debit, credit card or PayPal payment.

There is only one slight difference. A Subscription object appears when the Smart Transaction is approved or started. The Subscription has status approved when the Smart Transaction is approved, and status active when the latter is on ok.

In our example we authorize for direct debit using an existing Payment Container:

Request
POST /api/v2/Smart/Transactions/STX_33PXAW2YN2NJTPM5KPGMK7QF5PBVA2/prepare/debit HTTP/1.1
Host: connect-testing.secupay-ag.de
Authorization: Bearer qb56tjj1bcvo9n2nj4u38k84lo
Content-Type: application/json
Accept: application/json
 
{
"container": {
"id": "PCT_J0KNRWG67AV66AHKXRF2BU82N90ZES"
}
}

If everything is fine, the API responds with 200 OK. In case of direct debit it changes immediately to approved. A Payment Transaction (line 30) and a Subscripton object (line 41) appear:

Response
HTTP/1.1 200 OK
Content-Type: application/json
...
 
{
"object": "smart.transactions",
"id": "STX_33PXAW2YN2NJTPM5KPGMK7QF5PBVA2",
// ...
"customer": {
"object": "payment.customers",
"id": "PCU_38RG7MHRE2NJTPFMXRYQP3NKW6GVAZ",
"contact": {
"forename": "Max",
"surname": "Mustermann",
"name": "Max Mustermann",
"salutation": "Mr.",
"address": {
"street": "Max-Muster-Str.",
"street_number": "25a",
"additional_address_data": "Whg. 202",
"postal_code": "09555",
"city": "Musterstadt",
"country": "DE"
},
"email": "mmustermann@example.net",
"mobile": "+491775555555",
"phone": "+495555555555"
}
},
"transactions": [
{
"object": "payment.transactions",
"id": "PCI_FDBREW9ZS7P6FTN4ZY2ATC6NK0QWO7"
}
],
// ...
"updated_at": "2020-03-27T10:56:03+01:00",
  "status": "approved",
// ...
"subscription": {
    "object": "payment.subscriptions",
"id": "SUB_M16KYHTF1GPQCA244M0A5JPA7UTS81"
},
// ...
}

If you use PayPal, or a 3-D Secure check is required for a credit card payment, there is an external authorization process. It is explained in detail in the Reference (https://developer.secuconnect.com/integration/Reference3.html) sections for these payment methods.

After the payment has been approved, we can start the Smart Transaction, and capture the payment. This must be done immediately after the payer acknowledged the conclosure of contract by Buy Now! or the like. This is the API call:

Example Request
POST /api/v2/Smart/Transactions/STX_33PXAW2YN2NJTPM5KPGMK7QF5PBVA2/start HTTP/1.1
Host: connect-testing.secupay-ag.de
Authorization: Bearer qb56tjj1bcvo9n2nj4u38k84lo
Accept: application/json

If everything is fine, the API responds with 200 OK: The Smart Transaction changes to status ok:

Response
HTTP/1.1 200 OK
Content-Type: application/json
...
{
"object": "smart.transactions",
"id": "STX_33PXAW2YN2NJTPM5KPGMK7QF5PBVA2",
// ...
"transactions": [
{
"object": "payment.transactions",
"id": "PCI_FDBREW9ZS7P6FTN4ZY2ATC6NK0QWO7"
}
],
// ...
"updated_at": "2020-03-27T10:56:41+01:00",
"status": "ok",
// ...
}

The Subscription object was changed from approved to active at the same time.