Now we will tell the system to use the card balance to pay for this buy. Therefore we call the endpoint POST /api/v2/Smart/Transactions/{id}/preTransaction
. It prepares the Smart Transaction to accept the card balance for the full amount, both cash and bonus balance.
POST /api/v2/Smart/Transactions/STX_KJXJDUN542NR3WMRHRVU5WWM6ZQEA2/preTransaction HTTP/1.1
Host: connect-testing.secuconnect.com
Authenticate: Bearer qb56tjj1bcvo9n2nj4u38k84lo
Accept: application/json
The call to preTransaction
is not the actual payment. It is only to apply the card before the payment is executed, so that you know the total bonus balance and the remainder.
If everything is fine, the API responds with HTTP status 200 OK
:
HTTP/1.1 200 OK
Content-Type: application/json
...
{
"missing_sum"
: 576,
"bonus_products"
: [
{
"id"
: 4,
"articleNumber"
:
"111000007"
,
"ean"
:
""
,
"quantity"
: 1,
"priceOne"
: -15,
"tax"
: 7,
"desc"
:
"Bonus VAT 7%"
},
{
"id"
: 5,
"articleNumber"
:
"111000019"
,
"ean"
:
""
,
"quantity"
: 1,
"priceOne"
: -5,
"tax"
: 19,
"desc"
:
"Bonus VAT 19%"
}
]
}
At the same time the Smart Transaction is moved to status processing
. The field missing_sum
is also added to the Smart Transaction's basket_info
, and the bonus_products
to /basket/products
.
Monetary amounts are expressed in the smallest currency unit (e. g. Euro Cent).
Remember that our secucard has a total balance of €2.20 for this merchant. There is a cash balance of €2.00, and a bonus balance of €0.20.
When we executed the payment, it would be spent so:
- the full cash balance of €2.00;
- €0.15 of the bonus balance for articles with the reduced VAT rate of 7%;
- €0.05 of the bonus balance for articles with the reduced VAT rate of 19%.
If the amount to pay exceeds the card balance, it would redeem the cash balance first, then the bonus balance second.
The two "bonus products" are needed to lower the VAT in a proper way. They are added in the same proportions like the other articles. If half of the ordinary articles have the full VAT rate, half of the redeemed bonus balance will decrease the full VAT rate.
In our example, the buyer has to pay a missing sum of €5.76 using another payment method. If missing_sum
were 0
(zero), this would not be necessary. This is discussed in detail in the section about payment.