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 the Partner's checkout session timeout is shorter than the Payment Request lifetime. By default, a Payment Request remains open for 3 hours and will automatically expire if not completed or explicitly canceled. You can override this default with the custom Payment Request expiry feature.
Before canceling a Payment Request, ensure the following:
A valid Partner Account with API credentials
Backend capability to receive and process Klarna webhooks
An existing Payment Request that can be canceled
The payment_request_id of the Payment Request to cancel
Payment 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.
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.
Cancel Payment Requests in various scenarios to maintain accurate payment tracking and free up resources. Common scenarios include abandoned checkouts, session timeouts, and error recovery.
Proactively cancel Payment Requests when the Partner's checkout session expires to avoid unnecessary open requests.
Consider using the custom Payment Request expiry feature in authorizePayment (step_up_config.customer_interaction_config.interaction_expiry) to align Payment Request expiration times with the Partner's checkout session timeout. This reduces the need for manual cancellation when the session expires.
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).