In order to pay using a secucard, and to collect bonus balance, you need to prepare the transaction, calling the endpoint POST /api/v2/Smart/Transactions/{id}/preTransaction
.
POST /api/v2/Smart/Transactions/STX_KJXJDUN542NR3WMRHRVU5WWM6ZQEA2/preTransaction HTTP/1.1
Host: connect-testing.secuconnect.com
Authenticate: Bearer qb56tjj1bcvo9n2nj4u38k84lo
Accept: application/json
This call will apply the card in the idents
field of the Smart Transaction:
- the full card balance to this buy, whether paid in cash, or yielded as a bonus from a former buy;
- the card bonus program to collect bonus balance.
Furthermore it will calculate the remainder that needs to be paid with another payment instrument.
HTTP/1.1 200 OK
Content-Type: application/json
...
{
"missing_sum"
: 296,
"bonus_products"
: []
}
Now the Smart Transaction is switched to a mode, that the card balance will be used. There is a missing_sum
of €2.96, that needs to be paid in another way. There is no bonus collected in our example.
Monetary amounts are expressed in the smallest currency unit (e. g. Euro Cent).
If you read the Smart Transaction with GET /api/v2/Smart/Transactions/{id}
, you would find the content of missing_sum
in the node basket_info
. The data of bonus_products
would be found as additional basket lines in basket/products
.
This special mode is lost when you update the Smart Transaction before you carry out the payment. The buyer needs to pay the full amount then. If you still want to apply the card balance, you need to call preTransaction
again.