How to use merchant_urls.authorization URL field to receive the authorization token server-side and improve conversion rates
When the consumer is successfully approved by Klarna, you will receive an authorization token in return which gives you the ability to place an order towards Klarna. (For more details, read authorizing a payment). While you would generally receive the authorization token on the frontend through the Web SDK, it is also possible to receive the authorization token as a callback to a certain URL.
Supporting authorization callbacks helps ensure our partners can create an order even if there are frontend communication issues.
Payment methods that require complex customer interactions, like switching between banking apps, are vulnerable to frontend communication issues. A valid authorization token can be issued by Klarna Payments, but due to a broken communication chain the partner's frontend never receives it to place the order. This can lead for certain payment methods to money being deducted from a customer's account without the payment being registered on the merchant side or to lower conversion rate when consumer believe they have completed their order without acknowledgement on the partner side.
When creating the Klarna Payments session, you need to pass a URL in the
authorization field of
merchant_urls object. This URL will be called by Klarna Payments after a successful authorization.
The create_session call would look something like this:
Klarna will call the URL provided in the authorization once the session has been authorized. The callback request from Klarna will have the following format:
The URL provided must be over HTTPS, but to be able to authenticate that the callback comes from Klarna, it is advised to generate a one time token that you will only use for this specific payment session.
This lets you validate that the call made to you on successful authorization is only made by Klarna.