curl --request POST \
--url https://{host}/bonus/v1/members/{memberId}/transactions \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"operationId": "3f1c9a52-8a4e-4d0b-9a3e-5f0d6c2b7e11",
"amount": 150,
"transactionType": "CampaignBonus",
"instantCapture": true,
"metadata": {
"storeId": "475",
"receiptId": "475-0002-000381"
},
"expirationDate": "2027-12-31T23:59:59Z"
}
'{
"transactionId": 9154290,
"amount": 150
}{
"name": "<string>",
"message": "<string>",
"details": null
}{
"name": "<string>",
"message": "<string>",
"details": null
}Create a transaction for a customer
Your backend calls this to add bonus to a customer’s account, or to take bonus off it: for example to post an
accrual your own system calculated. It books on the customer’s active account. When you know the account by its
id, or want to move bonus between two accounts, call POST /v1/transactions. To let a customer pay with bonus,
call POST /v1/payments: the types Payment and Refund are refused here.
A positive amount adds bonus, a negative one takes it off. With instantCapture set to true the transaction
is final at once. With false the amount is only reserved and the transaction waits: finish it with
POST /v2/transactions/{id}/capture or POST /v2/transactions/{id}/cancel, or send autoCaptureDate and
Lobyco captures it at that time.
Where the account type has a maximum balance, an amount that would take the account over it is cut down to what
still fits, and the response’s amount says how much was booked. An account that is already at its maximum
refuses the call with AccountTypeMaxBalanceExceeded. Taking bonus off is not checked against the balance,
which can go below zero.
The call is idempotent on operationId: repeating it with the same id and the same values returns the first
answer and books nothing new. The same id with another customer, amount, type or instantCapture is refused
with InconsistentRetry.
curl --request POST \
--url https://{host}/bonus/v1/members/{memberId}/transactions \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"operationId": "3f1c9a52-8a4e-4d0b-9a3e-5f0d6c2b7e11",
"amount": 150,
"transactionType": "CampaignBonus",
"instantCapture": true,
"metadata": {
"storeId": "475",
"receiptId": "475-0002-000381"
},
"expirationDate": "2027-12-31T23:59:59Z"
}
'{
"transactionId": 9154290,
"amount": 150
}{
"name": "<string>",
"message": "<string>",
"details": null
}{
"name": "<string>",
"message": "<string>",
"details": null
}Authorizations
Path Parameters
Query Parameters
Body
The transaction to create.
A transaction to create on a customer's account.
Response
The transaction was created, or an earlier call with the same operationId had created it already. amount is what was booked.
The transaction that was created.