SADAD APIs | Cancel Transaction
PayTabs provides you with a collection of API endpoints which used to process all payments, regardless of if they are through either your own payment pages, the managed payment pages, or if you are using the hosted payment pages.
If you need to cancel a Sadad request that is still pending, you can use the Sadad Cancel Endpoint. This endpoint allows you to cancel transactions that have not yet been authorized.Please note that once a transaction is authorized, it cannot be canceled using this endpoint.
In this article, we’ll guide you through how to use and manage the cancel endpoint effectively.
The Endpoint and Related Postman Collection
In this tutorial, we will rely on the API Endpoint, mentioned on PayTabs API endpoints postman collection, which you can access fromKSA PayTabs Postman APIs Collection. The endpoint will need to be accessed with a POST request on the below-mentioned URL| POST | {{domain}}/payment/apm/sadad/[PROVIDER]/cancel |
|---|
Please note that not using the proper endpoint URL {domain} will lead to authentication issues within your responses. To find the your proper domain you can read ourWhat is my (Region)/(endpoint URL)?tutorial article.
- KSA
https://secure.paytabs.sa/payment/apm/sadad/[PROVIDER]/cancel
Request Parameters
To initiate a cancel Payment request, there are minimum required parameters that need to be passed with valid information.Kindly check the request parameters specifications below:
- The Minimum Required Parameters
| Parameter | Data Type | Min | Max | Required |
|---|---|---|---|---|
| INT | Accept only valid profile number | ✔ | |
| The merchant Profile ID you can get from your PayTabs dashboard. For more information please check ourHow to get your account information from PT Dashboard?tutorial article. To know more about this parameter pleaseclick here. | ||||
| ||||
| STRING | ✔ | ||
| Indicates the Transaction Reference on the PayTabs side. For more information please check ourRequest/Response Parameters | Transaction Reference (tran_ref).. | ||||
| ||||
Request & Response Payload Samples
This section is dedicated give you a sample API request payload using the above mentioned required parameters, along with showing you the response payload received upon using the request payload.- Required Parameters Sample Payloads
- Sample Request Payload
- Sample Response Payload
{
"profile_id": "59020",
"tran_ref": "TST2016700000692"}
}
{
"canceled": true,
"authorised": false,
"failed": false,
"error": ""
}
If the transaction already got authorized (paid), the response will be as below:
{
"canceled": false,
"authorised": true,
"failed": false,
"error": ""
}
if there is an error occurs , the response will be as below:
{
"canceled": false,
"authorised": false,
"failed": true,
"error": "Internal system error"
}