OPay Cancel Payment
You can cancel an unpaid cashier payment using our Cancel Payment API.
Cancel Payment API
you can cancel an unpaid transaction by using the Cancel Payment API. Note that, if the payment has been already
done by your client, you need to call Refund Payment API to refund the payment
to your client.
For calling the API using the POST method you can use these endpoints URL:
-In case you are still in the developing phase, use the following staging API endpoint URL
-Once you have a fully tested payment flow and you are ready for production, Use the following production API endpoint URL instead
-Request Parameters:
- Header: Bearer Signature and merchant ID
- Json object containing the transaction information:
HTTP POST Parameters
-Here is a detailed description for the parameters you need to complete the POST request:
-An example call of cancel payment API is as follows :
Cancel Payment Response
-Response Parameters:
the parameters contained in the response received whenever you call the Transaction Create API as a JSON Object.
-Here is a detailed description for the parameters received in the response:
Parameter | type | Description | example | |
---|---|---|---|---|
reference | String |
Unique Merchant's payment order number. | 1001000 | |
orderNo | String |
Unique Opay's payment order number. | 211009140896593010 | |
country | String |
Country Code. | EG | |
orderStatus | enum |
[INITIAL, PENDING, SUCCESS, FAIL, CLOSE] | CLOSE |
|
amount | ||||
total | Integer |
amount(cent unit). | 400 | |
currency | String |
currency type.See full list here | EGP |
Error Handling
After submitting an API call to OPay, you receive a response back to inform you that
your request was received and processed. A successful OPay API should return a status code 00
,
meanwhile, in a situation where any payment processing error occurred, you will receive an error code with a
message to describe the reason of the error. A sample error response can be found below.
Depending on the HTTP status code of the response, you should build some logic to handle any errors that a request or the system may return. A list of possible potential error codes that you may receive can be found below. A full list of all possible error codes can be found in the Error Codes section.
Error Code | Error Message |
---|---|
02000 | authentication failed. |
02001 | request params not valid. |
02006 | not found. |
02002 | merchant not configured with this function. |
02007 | merchant not available. |
50003 | service not available, please try again. |