Learn how to cancel an existing payment request to prevent further processing. This operation transitions the payment request to the CANCELED state, which is a final state from which no further actions can be taken.
Cancel an existing Payment Request to prevent further processing. This operation transitions the Payment Request to the CANCELED state, which is a final state from which no further actions can be taken.
Klarna recommends proactively canceling Payment Requests that have not resulted in successful transactions, especially if your Payment Request timeout is less than 3 hours. A Payment Request remains open for 3 hours and will automatically expire if not completed or explicitly canceled.
Before canceling a Payment Request, ensure the following:
payment_request_id of the Payment Request to cancelPayment Requests can only be canceled while in SUBMITTED or IN_PROGRESS states. Once a Payment Request reaches a final state (COMPLETED, EXPIRED, CANCELED, or DECLINED), it cannot be canceled.
Call cancelPaymentRequest with the
payment_request_id to cancel the Payment Request. This is a DELETE operation with no request body.
curl -X DELETE https://api-global.test.klarna.com/v2/accounts/{partner_account_id}/payment/requests/{payment_request_id} \
-H 'Authorization: Basic <API key>'The API returns the canceled Payment Request with state CANCELED.
{
"payment_request_id": "krn:payment:eu1:request:10be1d49-7beb-6b24-b9dd-8c14d0528503",
"state": "CANCELED",
"expires_at": "2025-02-26T17:25:34.534721775Z",
"created_at": "2025-02-24T17:25:34.534721775Z",
"updated_at": "2025-02-24T17:35:00.123456789Z",
"canceled_at": "2025-02-24T17:35:00.123456789Z",
"payment_request_reference": "acquiring-partner-request-reference-1234",
"amount": 11836,
"currency": "EUR",
"supplementary_purchase_data": {...},
"customer_interaction_config": {Subscribe to the payment.request.state-change.canceled webhook event using the guidelines provided here. Klarna sends this event when a Payment Request is successfully canceled.
{
"metadata": {
"event_type": "payment.request.state-change.canceled",
"event_id": "b2c3d4e5-f6g7-8901-bcde-fg2345678901",
"event_version": "v2",
"occurred_at": "2025-02-24T17:35:00Z",
"correlation_id": "4f3779ga-39e5-688e-b46e-d1c5g03e4c24",
"subject_account_id": "krn:partner:global:account:live:HGBY07TR",
"recipient_account_id": "krn:partner:global:account:live:LWT2XJSE",
"product_instance_id": "krn:partner:product:payment:ad71bc48-8a07-4919-[...]",
"webhook_id": "krn:partner:global:notification:webhook:120e5b7e-abcd-4def-[...]",
"live": falseCancel Payment Requests in various scenarios to maintain accurate payment tracking and free up resources. Common scenarios include abandoned checkouts, session timeouts, and error recovery.
Cancel the Payment Request when the customer abandons the checkout flow.
curl -X DELETE https://api-global.test.klarna.com/v2/accounts/{partner_account_id}/payment/requests/krn:payment:eu1:request:abc123 \
-H 'Authorization: Basic <API key>'Proactively cancel Payment Requests when your session expires to avoid unnecessary open requests.
Consider using the custom Payment Request expiration feature in authorizePayment (
step_up_config.payment_request_expires_at) to align Payment Request expiration times with your session timeout. This reduces the need for manual cancellation when the session expires.
# Cancel payment request after 30-minute session timeout
curl -X DELETE https://api-global.test.klarna.com/v2/accounts/{partner_account_id}/payment/requests/{payment_request_id} \
-H 'Authorization: Basic <API key>'Implement automatic cancellation for Payment Requests that haven't completed within your expected timeframe. This helps:
Subscribe to the payment.request.state-change.canceled webhook to be notified when Payment Requests are canceled, whether by your system or by Klarna (due to expiration or other reasons).
Implement proper error handling for cancellation failures:
Related articles