Cancel Payment
This guide is for the deprecated Flex.API. If you are starting with a new integration, please refer to the Guide for the secuconnect API: Link
You can cancel an authorided transaction as long as it is not captured yet. You can also cancel a transaction you have already captured, if the capture has not been executed yet. Direct debit transactions are usually executed the next morning at about 6 a. m.
It is also a good practice to cancel authorized transactions if these shall not be captured anymore.
You can either use the API solution with POST, or the browser solution with GET. The API endpoint to capture the payment is /payment/<hash>/cancel. You need no parameters in addition to your API key.
Example of API solution with POST:
POST /payment/tujevzgobryk3303/cancel HTTP/1.1
Host: api-testing.secupay-ag.de
Content-Type: application/json; charset=utf-8;
Accept: application/json
Accept-Charset: utf-8
{
"data"
: {
"apikey"
:
"6801fxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx7ace"
}
}
Response:
{
"status"
:
"ok"
,
"data"
: {
"hash"
:
"tujevzgobryk3303"
,
"demo"
:
0
,
"trans_id"
:
"1831201"
},
"errors"
:
null
}
There is also a browser solution. It is very similar, but you need to call GET and to append the API key to the URL. To cancel the above transaction your URL is https://api-testing.secupay-ag.de/payment/tujevzgobryk3303/cancel/6801fxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx7ace.