Cancel payment
curl --request POST \ --url https://api.ztlpay.io/api/v2/payments/cancel \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'PSU-IP-Address: 192.158.1.38' \ --header 'PSU-User-Agent: Mozilla/5.0 (Windows NT 10.0; …) Gecko/20100101 Firefox/63.0' \ --header 'consent-id: 3a797348-ef0c-4f52-b821-fdfcdb98c4d9' \ --data '{ "paymentId": "7c628b2e-9094-4bf8-af23-1d517c6fc4f5", "callbackUrl": "https://www.google.com", "preferredScaMethod": "Redirect" }'Cancels a payment. May required approval (dependent on bank and payment status).
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Example
3a797348-ef0c-4f52-b821-fdfcdb98c4d9A valid consentId
Example
192.158.1.38AAA IP Address of the end-user initiating the payment. DO NOT use any other IP address than what you can collect from the current user session that uses your system (don’t use something stored in your DB). This information is used by the banks to manage traffic and handle security.
The forwarded Agent header field of the HTTP request between PSU and TPP.
Example
Mozilla/5.0 (Windows NT 10.0; …) Gecko/20100101 Firefox/63.0Request Body
Section titled “Request Body”object
Payment id to be cancelled
Example
7c628b2e-9094-4bf8-af23-1d517c6fc4f5Callback url for redirect authentication
Example
https://www.google.comPrefered sca method. Qr only supported in Sweden.
Responses
Section titled “Responses”Payment cancellation created, check status
object
An ID that can be used to identify the cancellation attempt
object
Redirect link to redirect authorization flow. After the redirect, the url will contain the query parameter status, with the possible values [success, rejected, cancelled]
Url to start authorization redirect flow
object
Qr image, used with bank app to scan image for authentication
Qr code which can be used to generate Qr image. Can be used to customize image. Might not be available for all banks.
Qr code as image, base64 encoded
DynamicDynamic image, valid for 1 sec. Must be refreshed by fetching updated approval status.StaticStatic image, valid for a longer period dependent on bank. Usually 30 seconds.
Status of the cancellation, note that this is not the same as payment status.
ACCEPTEDthe cancellation has been successfullyREJECTEDthe cancellation was rejectedAUTHORIZATION_REQUIREDthe cancellation requires approval/signing
Latest status of the payment after the cancellation request has been accounted for
object
UnsignedThe user must approve the transaction.InProgressThe payment is ongoing.CompletedThe payment has been completed by the bank.RejectedThe bank rejected the payment.CancelledThe payment has been cancelled.CustomerActionRequiredThe payment requires further action from the user. See statusReason for details.
PartlySignedIndicates that the payments needs additional signing. This requirement may be set up for the bank account.SmsConfirmationRequiredThe user needs additional confirmation with responding SMS received. Only used by a few banksInsufficientFundsThe payment has been stopped by the bank due to lack of funds
Payment status reason, unmapped reason text from bank.
Timestamp when the status was fetched from bank
Additional information
Example
{ "sca": { "type": "redirect", "url": "https://api.ztlpay.io/api/v2/consents/sca/redirect/start/6212d401-1785-4739-8843-55fe4eb9dad4" }, "cancellationRequestStatus": "ACCEPTED", "currentPaymentStatus": { "status": "Unsigned", "statusReason": "PartlySigned", "timestamp": "2024-03-19T09:34:57.657733682+01:00" }, "reason": null}Bad Request
object
INVALID_CONSENTConsent is invalidAUTHENTICATION_TEMPORARY_UNAVAILABLEAuthentication service is temporary unavailable, most likely due to user already has started another concurrent authentication processUNSUPPORTED_PRODUCT_BY_BANKProduct is not supported by bankACCESS_DENIEDUser does not have sufficient permissions
Unique RequestId, please provide this Id in case of support requests
The underlying reason for the error
Example
{ "failure": "INVALID_CONSENT", "ztlRequestId": "3a797348-ef0c-4f52-b821-fdfcdb98c4d9", "message": "Invalid Bban"}Forbidden
object
Unique RequestId, please provide this Id in case of support requests
The underlying reason for the error
Example
{ "ztlRequestId": "3a797348-ef0c-4f52-b821-fdfcdb98c4d9", "message": "Invalid account"}Headers
Section titled “Headers”Unique RequestId, please provide this Id in case of support requests
Example
3a797348-ef0c-4f52-b821-fdfcdb98c4d9Not found
object
Unique RequestId, please provide this Id in case of support requests
The underlying reason for the error
Example
{ "ztlRequestId": "3a797348-ef0c-4f52-b821-fdfcdb98c4d9", "message": "Invalid account"}Headers
Section titled “Headers”Unique RequestId, please provide this Id in case of support requests
Example
3a797348-ef0c-4f52-b821-fdfcdb98c4d9Conflict
object
Unique RequestId, please provide this Id in case of support requests
The underlying reason for the error
Example
{ "ztlRequestId": "3a797348-ef0c-4f52-b821-fdfcdb98c4d9", "message": "Invalid account"}Headers
Section titled “Headers”Unique RequestId, please provide this Id in case of support requests
Example
3a797348-ef0c-4f52-b821-fdfcdb98c4d9Internal server error
object
Unique RequestId, please provide this Id in case of support requests
The underlying reason for the error
Example
{ "ztlRequestId": "3a797348-ef0c-4f52-b821-fdfcdb98c4d9", "message": "Invalid account"}Headers
Section titled “Headers”Unique RequestId, please provide this Id in case of support requests
Example
3a797348-ef0c-4f52-b821-fdfcdb98c4d9Service unavailable
object
Unique RequestId, please provide this Id in case of support requests
The underlying reason for the error
Example
{ "ztlRequestId": "3a797348-ef0c-4f52-b821-fdfcdb98c4d9", "message": "Invalid account"}Headers
Section titled “Headers”Unique RequestId, please provide this Id in case of support requests
Example
3a797348-ef0c-4f52-b821-fdfcdb98c4d9