Skip to main content

/transaction

Overview​

This endpoint is used to submit a completed transaction or to cancel a previously submitted transaction using its confirmation code.

When to Use This Endpoint​

Use this endpoint in the following cases:

  • A member or non-member completes a purchase
  • You want to log the transaction for segmentation, rewards, or asset usage
  • A previously submitted transaction needs to be canceled
note

Submitting every transaction—whether linked to a member or not—is required to maintain accurate loyalty records and analytics.

warning

By default, canceling a transaction does not reverse any associated loyalty payment. Either cancel each payment separately with the /payment endpoint, or send transaction.cancelPayments: true on the cancel so the sale's loyalty payments are canceled in the same call (see Canceling a transaction with its loyalty payments).

Request Details​

FieldDescriptionTypeMandatory
memberMember making the transactionMemberN
transactionTransaction details to be recordedTransactionY
usedAssetsGifts, vouchers or punch cards being redeemed in this transactionAssetN
appliedDealsDeals the POS already applied, reported for the recordDiscountN

Method & URL​

POST /transaction

See API Servers for the base URL to use in place of {{your-server}}.

Headers​

HeaderTypeRequiredDescription
x-api-keystringYesAPI key used for authentication
x-source-typestringYesSource of the transaction (POS, Web, Kiosk)
x-source-namestringYesIntegration or client system name
x-pos-idstringYesUnique POS terminal identifier
x-branch-idstringYesBranch or store location identifier

Request Example​

curl --location --request POST 'https://{{your-server}}/v1/transaction' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {{api-key}}' \
--header 'x-source-type: POS' \
--header 'x-source-name: pos_terminal_01' \
--header 'x-pos-id: POS001' \
--header 'x-branch-id: BR001' \
--data-raw '{
"member": {
"phoneNumber": "123456789"
},
"transaction": {
"transactionId": "TX-DEMO-1001",
"dateTime": "2025-07-01T13:45:00Z",
"totalAmount": 3000,
"otherDiscountsTotal": 200,
"items": [
{
"lineId": "1",
"code": "PZ001",
"name": "Pizza Margherita",
"departmentCode": "FOOD",
"departmentName": "Main Dishes",
"quantity": 1,
"subtotal": 1700,
"total": 1500,
"tags": ["promo"]
},
{
"lineId": "2",
"code": "DRK001",
"name": "Soda",
"departmentCode": "BEV",
"departmentName": "Beverages",
"quantity": 1,
"subtotal": 1500,
"total": 1500,
"tags": []
}
],
"payments": [
{
"type": "CREDITCARD",
"amount": 2000
},
{
"type": "POINTS",
"amount": 1000,
"confirmation": "CONF123456"
}
],
"employee": "Cashier 1"
},
"usedAssets": [
{
"key": "birthday-gift-2025",
"code": "BIRTHDAY25",
"appliedAmount": -500
}
],
"appliedDeals": [
{
"key": "combo-meal-1",
"appliedAmount": -200
}
]
}'

appliedAmount is negative, in the smallest currency unit, the totalAmount the preview returned for that entry. It is required and non-zero for every usedAssets[] entry.

Success Response​

FieldDescriptionType
statussuccessstring
confirmationCodeSubmit only. Our code for this sale, a UUID. Keep it: a cancel sends it back as transaction.confirmationCodestring
tokenId of the loyalty event this call queuedstring
canceledPaymentsCancel with cancelPayments: true only, see Canceling a transaction with its loyalty paymentsarray
skippedPaymentsCancel with cancelPayments: true only, same sectionarray
{
"status": "success",
"confirmationCode": "TRX-CONFIRM-20250701",
"token": "abc123xyz456"
}

Canceling a transaction with its loyalty payments​

To cancel a previously submitted transaction, send the transaction with action: "cancel" and its confirmationCode. Add cancelPayments: true to also cancel the loyalty payments made for that sale in the same call.

The sale's loyalty payments are found only by the confirmation codes recorded on the sale's payments[] lines when it was submitted — the confirmationCode each /payment call returned. Codes sent on the cancel request are not read, so a partner that adds them only when cancelling gets notLinked. Put each loyalty payment's confirmation on its payments[] line at submit time. Without codes on the submitted sale, no payment is canceled and one notLinked entry is reported; cancel those with the /payment endpoint.

The cancel request carries the full transaction, the same required shape as a submit (items with at least one line, and payments), plus action: "cancel", the sale's confirmationCode, and cancelPayments: true. Note that payments[].confirmation is not read on a cancel — it is omitted here on purpose:

curl --location --request POST 'https://{{your-server}}/v1/transaction' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {{api-key}}' \
--header 'x-source-type: POS' \
--header 'x-source-name: pos_terminal_01' \
--header 'x-pos-id: POS001' \
--header 'x-branch-id: BR001' \
--data-raw '{
"transaction": {
"action": "cancel",
"confirmationCode": "TRX-CONFIRM-20250701",
"transactionId": "TX-DEMO-1001",
"dateTime": "2025-07-01T13:45:00Z",
"totalAmount": 3000,
"items": [
{
"lineId": "1",
"code": "PZ001",
"name": "Pizza Margherita",
"departmentCode": "FOOD",
"departmentName": "Main Dishes",
"quantity": 1,
"subtotal": 1700,
"total": 1500
}
],
"payments": [
{ "type": "CREDITCARD", "amount": 2000 },
{ "type": "POINTS", "amount": 1000 }
],
"cancelPayments": true
}
}'

The response reports what was canceled and what was skipped:

{
"status": "success",
"token": "abc123xyz456",
"canceledPayments": [
{ "confirmation": "CONF123456", "amount": 1000 }
],
"skippedPayments": []
}

Each skippedPayments entry carries a reason:

reasonMeaning
alreadyCanceledThe payment was already canceled.
notFoundNo loyalty payment of this member in this business has this code (or it is not recorded yet).
failedThe payment was found but its cancel could not be completed; it stays in force.
notLinkedThe sale carries no payment codes, so its payments cannot be found. The entry has no confirmation.

Error Response Examples​

Used Asset Already Consumed​

{
"status": "error",
"error": {
"code": "522",
"message": "Used asset is already used."
}
}

Member Not Found​

{
"status": "error",
"error": {
"code": "203",
"message": "Cannot find any member with the given identifier!"
}
}

Error Codes​

CodeDescription
203Member not found
402Missing confirmationCode for cancel
520Duplicate transaction ID
521Asset does not belong to this member
522Asset already used
523Campaign not found
524Asset expired: the redeem window after assignment has passed
525Asset expired: the campaign end date has passed
526Campaign inactive
513Invalid payments[].confirmation
515Invalid cancelPayments (must be a boolean, cancel only)
530Error saving purchase, or usedAssets[].appliedAmount missing or 0
531Member has not given consent

Field Reference​

FieldTypeDescription
member.phoneNumberstringOptional. Used to link transaction to a loyalty member
transaction.transactionIdstringUnique transaction identifier
transaction.items[]arrayList of purchased items
transaction.payments[]arrayList of payments with types and amounts
transaction.payments[].confirmationstringOptional. The confirmationCode the /payment call returned for this line. Lets a cancel with cancelPayments find the sale's loyalty payments.
transaction.cancelPaymentsbooleanOptional, cancel only. true also cancels the sale's loyalty payments in the same call.
usedAssets[]arrayOptional. Assets applied to the transaction
appliedDeals[]arrayOptional. Deals applied and their value
employeestringName or ID of the cashier or terminal operator
  • Submitting completed member or guest transactions
  • Triggering benefit calculation, points, and segmentation logic
  • Canceling a transaction by confirmation code