Step 3: Apply the Loyalty Card for Payment

Before we execute the payment, we need to inform the API that we want to use the secucard to spend balance, or collect bonus balance. We would safe this step, if there was no secucard.

Request
POST /api/v2/Smart/Transactions/STX_WHCJCB3SD2NSZZ73E33NP3TJJ4RKA2/preTransaction HTTP/1.1
Host: testing.secupay-ag.de
Authorization: Bearer qb56tjj1bcvo9n2nj4u38k84lo
Accept: application/json

If everything is fine, the API responds with 200 OK, and these details:

Response
HTTP/1.1 200 OK
Content-Type: application/json
...
 
{
"missing_sum": 576,
"bonus_products": [
{
"id": 4,
"articleNumber": "111111117",
"ean": "111111117",
"quantity": 1,
"priceOne": -15,
"tax": 7,
"desc": "Bonus Steuer 7"
},
{
"id": 5,
"articleNumber": "1111111119",
"ean": "1111111119",
"quantity": 1,
"priceOne": -5,
"tax": 19,
"desc": "Bonus Steuer 19"
}
]
}

The field missing_sum (line 6) tells whether there is a remainder that cannot be paid by card. In case of 0 (zero) the card balance is enough to pay the purchase. In our example, the buyer needs to pay €5.76 with SEPA direct debit or his credit card.

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

If missing_sum was zero, we would not need this, but simply pay with the loyalty card. See the Reference section.

The bonus_products at line 7-26 indicate that bonus balance is spent. The two bonus products are needed to decrease the basket total and the value-added tax (VAT) in a proper way.

The card is not charged so far, since the transaction is not started yet.

The Smart Transaction changes to status processing in this moment. The field missing_sum is added to the field basket_info, and the bonus_products are found as new items in /basket/products.

This state is lost, when you update the Smart Transaction before you authorise or execute the payment. You need to repeat the above call in this case.