Skip to main content

Payment

This section explains how to process or cancel a member payment using loyalty balance (credit or points) via the loyalty API.

When to Use This Flow

Use the payment endpoint when a member chooses to pay with loyalty points or credit, or when a previously submitted payment needs to be canceled. For example, if a member starts an order but cancels or modifies the payment (used points or credit) before finalizing.

Payment Flow

  • Only one member is supported per request.
  • Payment can be made using credit or points.
  • Both transaction and payment objects must be provided.

Example: Pay with Points

{
"member": {
"phoneNumber": "5511122233"
},
"payment": {
"action": "pay",
"amount": 300
},
"transaction": {
"transactionId": "TX300POINTS-003",
"dateTime": "2025-06-18T12:15:00Z",
"employee": "Cashier #3",
"totalAmount": 3000,
"items": [
{
"lineId": "1",
"code": "PRD001",
"name": "Espresso Machine",
"departmentCode": "APPLIANCES",
"departmentName": "Home Appliances",
"quantity": 1,
"subtotal": 3000,
"total": 3000,
"tags": []
}
],
"payments": [
{
"type": "POINTS",
"amount": 300
},
{
"type": "CASH",
"amount": 2700
}
]
}
}

Cancel Payment Flow

To cancel a payment, set action to "cancel" and include the original confirmationCode.

Example: Cancel Payment

{
"member": {
"phoneNumber": "5511122233"
},
"payment": {
"action": "cancel",
"confirmationCode": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
}

Success Response

{
"status": "success",
"data": {
"confirmationCode": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"newBalance": {
"points": 1700,
"credit": 0
}
}
}

Error Response

{
"status": "error",
"error": {
"code": "407",
"message": "creditBalance balance for members is insufficient to process the payment!"
}
}
  • Processing loyalty payment using points or credit
  • Canceling previously submitted loyalty payments
  • Adjusting balances after payment confirmation or reversal