Response Codes

Understanding responses returned by the EcobankPay API

Initial Transaction Response

Upon successful payment process initiated, the response received contains a JSON payload with the following parameters:

ParameterValuesValue TypeDescription
successTrue, FalseBoolean

True: request on transaction for payment successfully initiated to gateway

False: request on transaction to gateway NOT successful.

urlURLStringThe gateway checkout page URL specifically for the transaction in question. Load or pop-up this URL in a browser for customer to completed payment process
errorObjectObjectError details if success is False

Example Success Response:

{
  "invoice_id": "invoice001",
  "tx_reference": "1",
  "url": "https://pgw.paywithonline.com/v1/7755055152595959",
  "success": true,
  "message": "Invoice created"
}

Example Error Response:

{
  "success": false,
  "error": {
    "code": "GW-001",
    "message": "merchant_key missing or empty"
  }
}

Payment Status Response

Below is the general response received for a payment status request.

ParameterValuesValue TypeDescription
statusnew, paid, cancelled, awaiting_payment, failedString

new: payment transaction is new, initiated to the respective payment network

paid: payment made successfully by customer

cancelled: payment cancelled by customer

awaiting_payment: payment pending. Customer does not complete or cancel payment.

failed: Transaction failed. Reason for failure is provided in status_reason parameter.

status_reasonFree textStringThis parameter holds detail description for a Failed Transaction status. For other status values, it is empty.
buyer_firstnameFree textStringFirst name of customer. Usually empty /null since no value is passed
buyer_lastnameFree textStringLast name of customer. Usually empty / null
buyer_emailFree textStringEmail address of customer. Usually empty / null
buyer_phoneFree textStringPhone number of customer. Usually empty / null
invoice_idFree textStringInvoice Id of transaction
amountFloatPayment amount made
as_atDateTransaction timestamp on gateway
narrationFree TextStringDescription of payment made

Sample Status Response

{
  "invoice_id": "invoice001",
  "tx_reference": "121a8wmy78TRANSACTION1234Q",
  "status": "paid",
  "status_reason": "",
  "amount": 25.00,
  "buyer_firstname": "John",
  "buyer_lastname": "Doe",
  "buyer_email": "john.doe@example.com",
  "buyer_phone": "233201234567",
  "narration": "Payment for order #invoice001",
  "as_at": "2023-08-15T14:22:45Z"
}