/payment
Description
This endpoint allows a member to pay for a transaction using their loyalty balance (credit or points), or cancel a previously confirmed payment using a confirmation code.
Purpose
- To allow members to redeem credit or points during a purchase
- To cancel a previously confirmed loyalty payment
When to Use
- To finalize a loyalty-based payment at checkout
- To reverse a previously processed loyalty transaction
Request Format
Method & URL
POST /payment
See API Servers for the base URL to use in place of {{server}}.
Headers
| Header | Type | Required | Description |
|---|---|---|---|
x-api-key | string | Yes | API key for authentication |
x-source-type | string | Yes | Origin of the request (e.g., POS, Web) |
x-source-name | string | Yes | Client or integration source name |
x-pos-id | string | Yes | POS terminal identifier |
x-branch-id | string | Yes | Branch or store location identifier |
Request Body
| Field | Description | Type | Mandatory |
|---|---|---|---|
| member | Member object | Member | Y |
| payment | Payment info (action, amount, etc.) | Payment | Y |
| transaction | Transaction context for the payment | Transaction | N |
Request Example
Payment Example
curl --location --request POST 'https://{{server}}/v1/payment' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {{api-key}}' \
--header 'x-source-type: {{source-type}}' \
--header 'x-source-name: {{source-name}}' \
--header 'x-pos-id: POS001' \
--header 'x-branch-id: BR001' \
--data-raw '{
"member": {
"phoneNumber": "5511122233"
},
"payment": {
"action": "pay",
"amount": 1500
},
"transaction": {
"transactionId": "TX-LOYALTY-001",
"dateTime": "2025-06-18T12:00:00Z",
"totalAmount": 3000,
"payments": [
{
"type": "CREDIT",
"amount": 1500
},
{
"type": "CASH",
"amount": 1500
}
],
"items": [],
"employee": "Cashier #1"
}
}'
Cancel Payment Example
curl --location --request POST 'https://{{server}}/v1/payment' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {{api-key}}' \
--header 'x-source-type: {{source-type}}' \
--header 'x-source-name: {{source-name}}' \
--header 'x-pos-id: POS001' \
--header 'x-branch-id: BR001' \
--data-raw '{
"member": {
"phoneNumber": "5511122233"
},
"payment": {
"action": "cancel",
"confirmationCode": "CONF123456"
}
}'
A cancel always reverses the original payment's full amount, so amount is optional on cancel; if sent, it must be a number, and its value is ignored. On pay, amount is required and must be a positive integer. An amount that breaks these rules returns error 403.
Success Response
| Field | Description | Type |
|---|---|---|
| status | success | string |
| expectedNewBalance | The member's expected balance once this call is processed: the balance minus payment.amount on pay, the balance plus the original payment's recorded amount on cancel. The ledger is updated asynchronously; read /member/details for the confirmed balance | number |
| payments | Pay only. One entry: method, the business's payment method name (meanOfPayment unless the business set another), and amount, the paid amount as a negative number | array |
| confirmationCode | Pay only. Keep it: send it on the sale's payments[].confirmation on /transaction, and as payment.confirmationCode to cancel | string |
| wallet | The balance used. On pay, the business's payment wallet, credits or points, omitted when the business has none configured (it then pays from points). On cancel, credit or points | string |
Pay:
{
"status": "success",
"expectedNewBalance": 2000,
"payments": [
{ "method": "meanOfPayment", "amount": -1500 }
],
"confirmationCode": "CONF123456",
"wallet": "credits"
}
Cancel (the balance goes back up by the original payment's amount):
{
"status": "success",
"expectedNewBalance": 3500,
"wallet": "credit"
}
Record the returned confirmationCode and put it on the matching payments[].confirmation line when you submit the sale to /transaction. A later cancel of that transaction with cancelPayments: true then reverses this loyalty payment automatically, with no separate /payment cancel call.
Error Response Examples
Member Not Found
{
"status": "error",
"error": {
"code": "203",
"message": "Cannot find any member with the given identifier!"
}
}
Insufficient Credit
{
"status": "error",
"error": {
"code": "407",
"message": "creditBalance balance for members is insufficient to process the payment!"
}
}
Used Asset Already Used
{
"status": "error",
"error": {
"code": "522",
"message": "Used asset is already used."
}
}
Error Codes
| Code | Description |
|---|---|
203 | Member not found |
401 | Invalid payment.action |
402 | Missing confirmationCode for cancel |
403 | Missing or invalid amount |
405 | Member has not given consent |
406 | Verification code required |
407 | Insufficient balance |
408 | Amount outside allowed min/max range |
410 | Payment not found or already cancelled |
Field Reference
| Field | Type | Description |
|---|---|---|
member.phoneNumber | string | Phone number used to identify the member |
payment.action | string | "pay" or "cancel" |
payment.amount | number | Amount to redeem using loyalty funds. Pay: required, a positive integer. Cancel: optional; if sent, a number, and ignored |
payment.confirmationCode | string | Code used to cancel a prior payment |
transaction | object | Full transaction context including items and payments |