Skip to main content

Purchase

Use the Purchase API to process a purchase transaction securely.

POSTbaseUrl/api/v1/transactions/purchase

Headers

  • Authorization: Bearer {{accessToken}} (Include the token obtained from the Authentication API)
  • Content-Type: application/json

Send a JSON object with the following fields:

FieldTypeRequiredDescription
amountstringYesThe amount to be processed. Must be a whole number, no decimals are allowed.
refNumberstringYesA unique reference number for tracking (ECR reference number)
terminalIdstringNoRequired when authenticating using a Merchant Token. Not required when using a Cashier Token, as the terminal associated with the authenticated cashier is automatically used.

Example Request

{
"amount": "12000",
"refNumber": "refNumber"
}

Error Handling

If the transaction fails, you may receive an error response.

Example Error

{
"status": "timeout",
"msg": "Transaction confirmation timed out"
}
Error ScenarioAPI Response MessageHTTP Status
Customer does not confirm the transaction before the timeout period expiresTransaction confirmation timed out.504 Gateway Timeout
Cashier account attempts a purchase without a configured payment providerTransaction declined. Payment provider is not configured for this merchant.403 Forbidden
Transaction amount contains a decimal valueInvalid amount. Only whole numbers are allowed.400 Bad Request
Request is sent to an incorrect or unsupported API endpointEndpoint not found. Check the API URL or version.404 Not Found
Invalid, missing, or expired access tokenAuthentication failed. Invalid or expired token.401 Unauthorized

Usage Tips

  1. Token Authorization: Always ensure your token is valid before making a request. Include it in the Authorization header in the format: Authorization: Bearer <accessToken>.
  2. Reference Numbers: Use unique refNumber values for each transaction to prevent duplicate processing.
  3. Transaction Amount: Verify that the amount field is formatted as a string (e.g., "12000").