Skip to main content

API Endpoints

This section describes the available API endpoints for creating and managing sales through the zazpay API. Authentication is required for all endpoints as described in the auth.md documentation.

Create a Sale

POST /commerce/generate-sale

Creates a new sale transaction.

Input Parameters

ParameterTypeRequiredDescription
totalnumberYesTotal transaction amount
clientUsernamestringOne ofUsername/identifier of the client. Provide either clientUsername or clientId
clientIdstringOne ofClient ID. Provide either clientId or clientUsername
salesmanIdentifierstringOne ofSalesman reference. Provide either salesmanIdentifier or salesmanId
salesmanIdstringOne ofSalesman ID. Provide either salesmanId or salesmanIdentifier
storeIdstringYesStore ID (external or internal)
commentsstringNoOptional comments/description
folioExternalstringYesExternal reference for idempotency and sandbox behavior toggles

Notes:

  • Exactly one of clientUsername or clientId is required.
  • Exactly one of salesmanIdentifier or salesmanId is required.

Response (data)

{
"apiSaleId": "string",
"id": "string",
"folio": 12345,
"folioExternal": "EXT-001",
"status": "IN_PROGRESS",
"store": { "name": "Store name" }
}

Exceptions

Error CodeDescription
COMPANY-NOT-FOUNDCompany not found
STORE-NOT-FOUNDStore not found
STORE-NOT-BELONG-TO-COMPANYStore does not belong to your company
SALESMAN-NOT-FOUNDSalesman not found
CLIENT-NOT-FOUNDClient not found
SALE-CREATION-03Minimum amount not reached
SALE-CREATION-04Client credit line insufficient
TRANSACTION-NOT-FOUNDTransaction not found

Note: Some gateway-originated errors are passed through with their original statusCode and errorCode (e.g., C-PF-TRANSACTION-1001).

Retrieve Sale Status

POST /commerce/transaction-status

Retrieves the current status of a sale transaction by folio.

Input Parameters

ParameterTypeRequiredDescription
folionumberNoTransaction folio to look up
folioExternalstringNoTransaction folio external to look up

Response (data)

{
"folio": 12345,
"folioExternal": "string",
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:35:00.000Z",
"salesmanId": "string",
"storeId": "string",
"status": "APPROVED",
"total": 1500,
"clientId": "string",
"comments": "string"
}

Exceptions

Error CodeDescription
TRANSACTION-NOT-FOUNDTransaction not found

Cancel a sale

POST /commerce/cancel-transaction

Cancels a sale that hasn't been accepted yet.

Input Parameters

ParameterTypeRequiredDescription
folionumberNoThe transaction folio to cancel
folioExternalstringNoThe transaction external folio to cancel

Response (data)

{
"folio": 12345,
"status": "CANCELED",
"cancelledAt": "2024-01-15T10:40:00.000Z"
}

Exceptions

Error CodeDescription
SALE-CANCEL-01Sale not found
SALE-CANCEL-02Sale already cancelled
SALE-CANCEL-03Sale cannot be cancelled (already processed)

Parameter reference

  • folioExternal: External identifier supplied by your system. Used for idempotency and, in sandbox, to simulate outcomes.
  • ticket: Optional POS receipt/reference. Free-form string (recommended max 64 chars).

Sandbox behavior and test patterns

In the sandbox environment, the following patterns apply when creating a sale (/commerce/generate-sale):

  • If folioExternal contains REJECTED, the sale will transition to REJECTED after ~5 seconds.
  • If folioExternal does not contain REJECTED, it will transition to APPROVED after ~5 seconds.
  • If folioExternal contains NO_CANCEL, the automatic transition is disabled (stays IN_PROGRESS until manually cancelled).