Get Request
Once Pesapal redirect your customer to your callback URL and triggers your IPN URL, you need to check the status of the payment using the OrderTrackingId.
The URL to our GetTransactionStatus API is either:
Where xxxxxxxxxxxx represents the OrderTrackingId received as part of the callback [GET] or IPN [POST/GET] params.
Bearer Token : Use token generated during authentication.
Accept: The response format, which is required for operations with a response body.
Content-Type: The request format, which is required for operations with a request body.
Parameter | Required | Description |
---|---|---|
Accept | Required |
Should be set to application/json |
Content-Type | Required |
Should be set to application/json |
Parameter | type | Required | Description |
---|---|---|---|
orderTrackingId | string | Required | Unique order id generated by Pesapal e.g 7e6b62d9-883e-440f-a63e-e1105bbfadc3. Attached as a query parameter to the getTransactionStatus endpoint to get status of your submitted order. |
Name | Description |
---|---|
payment_method | This refers to the payment method used by your customers to make payment. Can be through CARD, MPESA, MTN, TIGO etc. |
amount | Amount paid by the customer. |
created_date | Date the payment was made. |
confirmation_code | Confirmation code received from the payment provider used. |
payment_status_description | Contains the status of the transaction. This will include either INVALID, FAILED, COMPLETED or REVERSED. |
description | Description of the payment status. |
message | The message shows if transaction request status was processed successfully or not. |
payment_account | Masked card number or phone number used during payment. |
call_back_url | A valid URL which Pesapal will redirect the client to after payment is made. |
status_code | Pesapal status code representing the payment_status_description. 0 - INVALID 1 - COMPLETED 2 - FAILED 3 - REVERSED |
merchant_reference | Your application's unique ID as received in the SubmitOrderRequest call. |
currency | Currency the payment was made in. ISO Currency Codes. |
error | An error object containing error_type, code, message and call_back_url. |
status | HTTP status code as defined on RFC 2616. A status of 200 means the request was successful. |
{ "payment_method": "Visa", "amount": 100, "created_date": "2022-04-30T07:41:09.763", "confirmation_code": "6513008693186320103009", "payment_status_description": "Failed", "description": "Unable to Authorize Transaction.Kindly contact your bank for assistance", "message": "Request processed successfully", "payment_account": "476173**0010", "call_back_url": "https://test.com/?OrderTrackingId=7e6b62d9-883e-440f-a63e-e1105bbfadc3&OrderMerchantReference=1515111111", "status_code": 2, "merchant_reference": "1515111111", "payment_status_code": "", "currency": "KES", "error": { "error_type": null, "code": null, "message": null, "call_back_url": null }, "status": "200" }
Once you've received the payment details, you are then required to store the same in your system and provide services / services paid for.
Your IPN endpoint should then respond to Pesapal with a json string confirming receipt of the IPN call. Part of the json string contains a status parameter that should be set as 200 (meaning request was received and processed) or 500 (meaning IPN request was received but there was an issue completing the process).
Sample IPN JSON Response String: {"orderNotificationType":"IPNCHANGE","orderTrackingId":"d0fa69d6-f3cd-433b-858e-df86555b86c8","orderMerchantReference":"1515111111","status":200}
NB: Your callback page should not implement a json response. Instead, redirect the customer to a page on your system showing the payment details.