[POST] Abort a Remote Payment by Payment Reference
Description
When we want to "Abort" the payment (discard) before confirming the payment, we can do it with the Abort endpoint, here you will have all the steps to do to discard (abort) a payment (not confirmed).
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
}
}
The device_id
is the device identifier that will be used to identify the device that is making the payment and it is optional.
Environments
Staging environment
POST https://staging.sylq.io/remote_api/v1/remote_payments/{payment_reference}/abort
Production/Live environment
POST https://app.sylq.io/remote_api/v1/remote_payments/{payment_reference}/abort
The {payment_reference}
is the payment reference that you need to send as a parameter in the request.
Example of Request to Create an Abort 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"
}