5. Implement Callback URL
Implement webhook for successful payment notifications
When a full payment is made a JSON request is sent to the merchant’s paymentWebhookURL.
We do a POST request when sending the payment details to the merchant's callback URL.
When is a Webhook sent to Merchant?
Webhook is only sent when the customer has made full payment for the request raised
Webhook Request
Parameter Name | Type | Description |
---|---|---|
checkoutRequestID | integer | Unique transaction ID identifying the transaction as provided by the checkout platform. |
merchantRequestID | string | Unique transaction ID identifying the transaction as given by the merchant. |
requestStatusCode | integer | Request status after the customer makes the payment. 99 - A failed payment has been received for this request. Request is still open to receive payments. 129 - Request has expired with no partial payment received. 176 - Partial payment made for the request and has been marked as closed. Available for merchants who accept partial payments for their request. 178 - Full payment made for the request. 179 - Request has expired with one or more partial payments made. The partial payment(s) will be reversed. 186 - This is indicates that the partial refund for the request was successfully processed. 187 - This is indicates that the full refund for the request was successfully processed. 191 - This indicates a failed refund. |
requestStatusDescription | string | Request status description. |
MSISDN | string | Customer mobile number. |
serviceCode | string | Identifier for the service that request has be raised to. |
accountNumber | string | Reference for the item being paid for eg: Pay TV account number or Airline ticket number. |
currencyCode | string | The three character currency code (ISO 4217) used for the payment. |
amountPaid | double | Amount received from customer. |
requestCurrencyCode | string | A three character currency code (ISO 4217) that the transaction was converted to for collection. |
requestAmount | integer | Amount of the transaction request after conversion. |
requestDate | string | Date and time payment was logged into the Cellulant Payment Gateway. |
payments | JSON Array | List of individual payments made for the checkout request. |
serviceChargeAmount | integer | Extra charge set if available for the service. |
originalRequestAmount | double | The original amount that was passed on the request to checkout. |
originalRequestCurrencyCode | string | Original currency code provided on the request to checkout |
failedPayments | JSON Array | An array of failed payment attempts by the customer. Available only if service is enabled to receive failed notifications. Contact Cellulant to activate this option. |
Payments array for both failed and successful payments array.
Parameter Name | Type | Description |
---|---|---|
payerClientCode | string | A unique identifying code of the payment option that will be used to initiate the request or was used to complete the payment. E.g. 'MPESA' for Mpesa payment option. |
payerClientName | string | Identifier of the option that was used to make the payment e.g. Mpesa. |
payerTransactionID | string | A unique identifier of the payment as logged on the payment channel's platform. This may be logged by the merchant for easier transaction tracking and support for customers. |
currencyCode | string | The three character currency code (ISO 4217) used for the payment. |
amountPaid | string | The amount received from the payment channel the customer paid from. |
customerName | string | The name of the customer who made the payment. Available for payment options where the customer names are provided. |
hubOverallStatus | string | Internal Cellulant processing status for the payment. |
MSISDN | string | The mobile number that the payment originated from. |
serviceCode | string | Identifier for the service that request has be raised to. |
cpgTransactionID | string | A unique identifier to identify the payment on the Cellulant's payment Gateway. |
accountNumber | string | Reference for the item being paid for eg: Pay TV account number or Airline ticket number. |
datePaymentReceived | string | The date in which the payment was logged onto the cellulant payment gateway. |
payerNarration | string | This is the MNO or bank payment narration shared to Cellulant. |
{
"serviceCode": "TESTSERVICE",
"MSISDN": "254713123888",
"originalRequestCurrencyCode": "KES",
"originalRequestAmount": 200,
"checkoutRequestID": 4826296,
"requestCurrencyCode": "KES",
"requestAmount": "200.00",
"accountNumber": "3201HR00",
"requestStatusCode": 178,
"requestStatusDescription": "Request fully paid",
"merchantTransactionID": "r77az121236884",
"requestDate": "2018-08-28 12:12:38.0",
"currencyCode": "KES",
"amountPaid": 200,
"serviceChargeAmount": 0,
"payments": [
{
"MSISDN": 254713123888,
"payerClientName": "Safaricom Kenya Limited",
"currencyCode": "KES",
"amountPaid": 200,
"cpgTransactionID": "288852770",
"serviceCode": "TESTSERVICE",
"payerTransactionID": "OHS01A3K",
"hubOverallStatus": 139,
"accountNumber": "3201HR00",
"customerName": "Customer",
"payerClientCode": "SAFKE",
"datePaymentReceived": "2018-08-28 12:13:33.0"
}
],
"failedPayments": []
}
Expected Webhook Response
The merchant is expected to send back a response with the following parameters:
Parameter Name | Type | Description | Required |
---|---|---|---|
checkoutRequestID | integer | Unique transaction ID identifying the transaction as provided by the checkout platform. | TRUE |
merchantTransactionID | string | Unique transaction ID identifying the transaction as given by the merchant. | FALSE |
statusCode | integer | A status indicating the result of payment processing. 180 - The payment was rejected by the merchant. Only accepted if the notification was for a full request. 183 - The payment was accepted by the merchant. Only accepted if the notification was for a full request. 188 - The payment/request was received. Acknowledgement will be initiated later if the notification was for a fully paid request. See Acknowledge Payment on custom API for details. For a failed payment notification, no further action will be taken. 189 - There was an error in processing the payments/request on the merchant's platform. The request should be re-sent for processing. | TRUE |
statusDescription | string | A description of the status provided above | TRUE |
receiptNumber | string | A transaction ID indicating the receipt of the payments. | TRUE |
Examples
Payment processed successfully
{
"checkoutRequestID": 4826296,
"merchantTransactionID": "abcd-efg-hijklm",
"statusCode": "183",
"statusDescription": "Payment processed successfully",
"receiptNumber": "r77az121236884"
}
Payment processing failed
{
"checkoutRequestID": 4826296,
"merchantTransactionID": "abcd-efg-hijklm",
"statusCode": "180",
"statusDescription": "Payment was not processed successfully",
"receiptNumber": ""
}
Updated 4 months ago