Pay with Invoice Payment

Prerequisites

As a prerequisite, you should understand:

Authorise the Payment

The API endpoint to authorise the payment is POST /Smart/Transaction/STX_xxx/prepare/invoice. This includes a check whether a payment on account is possible in the particlular situation.

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

If everthing is fine, the API responds with 200 OK, and the Smart Transaction changes to status approved:

Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"object": "smart.transactions",
"id": "STX_33PXAW2YN2NJTPM5KPGMK7QF5PBVA2",
// ...
"transactions": [
{
"object": "payment.transactions",
"id": "PCI_FDBREW9ZS7P6FTN4ZY2ATC6NK0QWO7"
}
],
"created": "2020-03-27T10:55:23+01:00",
"updated": "2020-03-27T10:56:12+01:00",
"status": "approved",
// ...
}

Status approved means the payment is authorised and you should be able to capture it. Status failed means you must repeat the payment process. You must also repeat the payment process when you update the Smart Transaction. It is then set back to created.

If auto_capture is enabled, it would capture the payment automatically. Status ok, received or collection means you can deliver. Status pending means you have to wait for one of these statusses. Status failed means the payment failed, and you must repeat the payment process.

Capture the Payment

The API endpoint to capture payment is POST /Smart/Transaction/STX_xxx/start.

Request
POST /api/v2/Smart/Transactions/STX_xxx/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 and a representation of the updated Smart Transaction:

Response
HTTP/1.1 200 OK
Content-Type: application/json
 
{
"object": "smart.transactions",
"id": "STX_33PXAW2YN2NJTPM5KPGMK7QF5PBVA2",
// ...
"transactions": [
{
"object": "payment.transactions",
"id": "PCI_FDBREW9ZS7P6FTN4ZY2ATC6NK0QWO7"
}
],
"created": "2020-03-27T10:55:23+01:00",
"updated": "2020-03-27T10:56:10+01:00",
"status": "ok",
// ...
"payment_method": "prepaid",
"payment_instructions": {
"owner": "secupay AG",
"iban": "DE81850400611005523759",
"bic": "COBADEFFXXX",
"bankname": "Commerzbank CC",
"purpose": "TA 49425099",
"girocode_url": "https://connect-testing.secupay-ag.de/qr/epc?stx=STX_33PXAW2YN2NJTPM5KPGMK7QF5PBVA2"
},
"trans_id": 49425099,
  // ...
}

Status ok, received or collection means you can deliver. Status pending means you have to wait for one of these statusses. Status failed means the payment failed, and you must repeat the payment process.

The bank transfer details are per transaction. You are obliged to pass them to the customer. In the case of prepayment, this can be done with the order confirmation email and preferably also on the success page in the store. In the case of purchase on account, please continue to show the transfer details on the invoice. If not otherwise possible, please send a separate e-mail.

When you use invoice payment, you need to mark the final delivery. This is essential to make the payment due and calculate the due date. You must also do this when using auto_capture. You can make this by hand using SecuOffice or via the secuconnect API.