Cancel a Debit
This endpoint allows you to cancel a previously initiated debit operation by providing the operation reference.
Method
- POST
URL
- /operations/cancel-debit
Input
The input data for this operation should be provided in the request body as a JSON object:
{
"operation": "reference of the operation to cancel"
}
Example Request
Here's an example of how to cancel a debit operation:
{
"operation": "OPAD20201006000000000006"
}
Output
The API will return a JSON object with the details of the confirmed debit transaction, including:
-
Transaction Reference
-
Customer Details
-
Amount Debited
-
Transaction Status
-
Other relevant details.
HTTP Status Codes
- 200 OK: The request was successful, and the debit transaction details are returned.
Example Code
Here is an example of how to make a POST request to cancel a debit operation:
import axios from 'axios';
const apiKey = 'your-api-key';
const apiSecret = 'your-api-secret';
const requestData = {
operation: "OPAD20201006000000000006"
};
axios.post('https://svc.test.bestcash.me/external/operations/cancel-debit', requestData, {
headers: {
'X-Auth-ApiKey': apiKey,
'X-Auth-ApiSecret': apiSecret,
'Content-Type': 'application/json'
}
})
.then(response => {
console.log('Canceled Debit Transaction Details:', response.data);
})
.catch(error => {
console.error('An error occurred:', error.message);
});
Summary
Use this endpoint to cancel a debit operation by providing the operation reference. The details of the canceled debit transaction will be returned upon success.