We recommend subscribing to a webhook as polling may cause reaching Klarna API's rate limits.
If you have provided a URL endpoint when [ initiating the payment session], you'll get the distribution status updates via a webhook notification instead of having to poll the server for status updates.
The URL provided as the status_update parameter must use HTTPS, but to be able to authenticate that the notification comes from Klarna, we recommend you generate a one-time token that you'll only use for this specific In-store payment session.
{generic_id} is an id that is generated by your system which you can use to correlate the payment session when you receive a callback.
For extra security, when you get a webhook notification and the distribution status is COMPLETED, send a GET request to the distribution result endpoint. This lets you validate if the notification of the status update was sent by Klarna.
The webhook sends the distribution result payload for the following distribution status changes:
Distribution status
Description
Action to take
DISTRIBUTED
The payment link has been distributed.
Use the link from the distribution result endpoint and display the QR code to the customer.
ACCESSED
The customer has accessed the payment link.
No action.
COMPLETED
The customer has completed the payment and a new order has been automatically placed.
Get the order id from the distribution result endpoint or webhook.
CANCELED
The payment session has been canceled by either partner or consumer.
No action.
FAILED
There was a failure in distribution or connecting the customer for various reasons.
Read the error code sent in response. Based on the error, either create a new session or retry distribution using retry endpoint. If there was failure in short code use QR code URL or payment link URL as fallback
To get the distribution result from Klarna, send an empty request body to the result endpoint.
Link to result endpoint is included in distribution.result_url field in session initiation response.
The distribution statuses change when an action is performed either by you, the customer, or by the system.
The distribution statuses in an ongoing In-store session.
Below is a list of all possible distribution statuses, along with actions you can take for each.
Distribution status
Description
Action to take
WAITING
The payment link has not been distributed yet.
Try to distribute the payment again if enough time has passed since the last attempt, for example, after 2 minutes.
DISTRIBUTED
The payment link has been distributed.
Use the link from the distribution result endpoint and display the QR code to the customer.
ACCESSED
The customer has accessed the payment link.
No action.
COMPLETED
The customer has completed the payment and a new order has been automatically placed.
Get the order id from the distribution result endpoint or webhook.
CANCELED
The payment session has been canceled by either partner or consumer.
No action.
FAILED
There was a failure in distribution or connecting the customer for various reasons.
Read the error code sent in response. Based on the error, either create a new session or retry distribution using retry endpoint. If there was failure in shortcode use QR code URL or payment link URL as fallback
When a session is created, and the QR it is not scanned by the customer and the session is not canceled by the merchant, then the session will be auto-cancelled after 3 hours.
Once the payment is completed, a new order gets created in Klarna's systems.
A message is displayed to the customer informing them that the payment is done. The module page displays the payment status.
The new order is automatically placed and captured. You can retrieve the order identifier from the distribution result URL specified when creating the payment session.
If you've provided the distribution webhook URL as the callback_url parameter, you'll get the order identifier via a webhook notification.