This API is used to automatically mark the order as cancelled in AtaraPay when the buyer cancels the order from the eCommerce/ delivery app which initiates a refund to the buyer and sometimes payout to the seller, if a cancellation fee is set. Below are the fields that are to be sent via API using the POST method to the URL:
For Staging: http://test-api.atarapay.com/api/callback/order
for live: https://api.atarapay.com/api/api/callback/order
var unirest = require("unirest");
var req = unirest("POST", "http://test-api.atarapay.com/api/callback/order");
req.headers({
"postman-token": "43b9ee82-e77d-f0ee-645d-e658b86ad0ef",
"cache-control": "no-cache",
"content-type": "application/x-www-form-urlencoded"
});
req.form({
"authtoken": "__AUTH_TOKEN_CALCULATED__",
"order": "__Order_NO__",
"status": "rejected",
"comment":"_reason_for_cancelation__"
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
Possible Error Message
Error Message
Field name
Possible Reason
Invalid authtoken. Does not match any record.
authtoken
The authtoken is not calculated correctly. Please refer here for the steps Calculation of Auth Token.
No such order exists for the seller.
order
The order number sent does not belong to the seller associated with the calculated authtoken
Invalid status sent.
status
This field accept only following the values delivered,cancelled,buyer_cancel,order. Any other value passed would generate the error.
Invalid action. This request has already been processed
order
The order Id passed has been processed earlier.
Invalid action. This cancel request by the buyer isn't allowed because it's past time eligible for a refund. The seller shall however provide full product replacement. Please contact seller for same.
order
The order ID passed is in dispute and user is trying to cancel it from another app, instead of doing so from the buyer's or seller's dashboard on Atarapay.