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 when the Payment Request timeout is less than 3 hours. A Payment Request remains open for 3 hours and automatically expires if not completed or explicitly canceled.
Before canceling a Payment Request, ensure the following:
A valid Klarna Partner account with API credentials
Backend capability to receive and process Klarna webhooks
The payment_request_id of an existing Payment Request in SUBMITTED or IN_PROGRESS state
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 by following the webhook registration guide. Klarna sends this event when a Payment Request is successfully canceled.
Cancel Payment Requests to keep the Klarna Payment Request lifetime aligned with the Partner's checkout session. Common scenarios include session expirations and error recovery.
The Payment Request lifetime must match the Partner's checkout session. When the Partner's session terminates or expires, call cancelPaymentRequest to close the Payment Request. Aligning the two preserves session continuity and avoids handover issues with the Partner's own session-management logic.
Consider using the custom Payment Request expiry feature on createPaymentRequest (customer_interaction_config.interaction_expiry) to align Payment Request expiration times with the checkout session timeout. This reduces the need for manual cancellation when the Partner's session expires.
When the Partner detects a non-recoverable error in the checkout flow before the customer enters the Klarna Purchase Journey (for example, an internal validation failure or a duplicate Payment Request), call cancelPaymentRequest to release the Payment Request and start a new one. This keeps the Klarna state aligned with the Partner's checkout state and prevents stale Payment Requests from blocking subsequent attempts.
Subscribe to the payment.request.state-change.canceled webhook to be notified when Payment Requests are canceled, whether by the Partner's system or by Klarna (due to expiration or other reasons).