[POST] Cancel a Remote Payment by Payment Reference
Description
Once we have the Payment confirmed, if we want to Cancel the Payment (like a rollback) we can do it through the Cancelay of a Payment by reference. That process will cancel the full amount and it is only possible to do it until 2h from the Payment.
Requirements
ℹ️ Before launching a payment, you need to have a Location created, as each payment will be related to a Location (location_id
).
Authentication
In all your requests you need to add, as a Header
, your Authorization Token-ID:
"Name": "Authorization"
"Value": "Bearer YOUR-TOKEN-ID"
Schema for Remote Payments
{
"remote_payment": {
"device_id": integer
}
}
Environments
Staging environment
POST https://staging.sylq.io/remote_api/v1/remote_payments/{payment_reference}/cancel
Production/Live environment
POST https://app.sylq.io/remote_api/v1/remote_payments/{payment_reference}/cancel
Example of Request to Create a Cancel Remote Payment
As a "Header
" we need to specify the "Authorization
" (Bearer value), as a request parameter you have the payment_reference
which in the example you can see corresponds to Payment with Reference 3NVHIQG33L
and a Body JSON. See an example:
{
"remote_payment": {
"device_id": 125
}
}
Examples of returns
Success response (200)
{
"success": true,
"message": "Success"
}
Error responses
Unauthorized (401)
This error appears it is because the credential (Authorization
) is incorrect or does not exist.
{
"success": false,
"message": "Unauthorized"
}
Record Not Found (404)
This error appears, it is because an incorrect payment_reference
has been specified in the request or cannot be found.
{
"success": false,
"message": "Record not found"
}
Unprocessable entity response (422)
This error appears when the payment_reference
indicated for the cancellation is not allowed to cancel.
{
"success": false,
"message": "Remote payment is not allowed to cancel"
}