Klarna Docs - Server-side callbacks
Server-side callbacks

KCO provides a number of different callbacks during the consumers checkout session. The callbacks can be used to update the order when the consumer changes their address as well as to do a final check to validate the order before it is submitted.

Klarna Checkout (KCO) has been acquired by Kustom. Read more here

If you provide the address_update URL as part of the merchant_urls object at order creation a POST request will be sent to that URL when the customer enters or edits the shipping address.

JSON
    "merchant_urls": {
      "terms": "https://toc",
      "checkout": "https://checkout?klarna_order_id={checkout.order.id}",
      "confirmation": "https://confirmation?klarna_order_id={checkout.order.id}",
      "push": "https://push?klarna_order_id={checkout.order.id}",
      "address_update": "https://address_update?klarna_order_id={checkout.order.id}"
    }

The address_update callback can be used to update the tax and shipping costs when the customer updates their address. It can also be used to update the shipping options based on the customer’s shipping address.

Please see our api specification.

JSON
    "merchant_urls": {
      "terms": "https://toc",
      "checkout": "https://checkout?klarna_order_id={checkout.order.id}",
      "confirmation": "https://confirmation?klarna_order_id={checkout.order.id}",
      "push": "https://push?klarna_order_id={checkout.order.id}",
      "country_change": "https://country_change?klarna_order_id={checkout.order.id}"
    }

Please see our api specification.

The shipping_option_update callback is used to add the cost of the shipping option to the order. The total_amount and order_lines should be updated to reflect the cost of the selected shipping option. The KCO will then update to show the new order total.

JSON
    "merchant_urls": {
      "terms": "https://toc",
      "checkout": "https://checkout?klarna_order_id={checkout.order.id}",
      "confirmation": "https://confirmation?klarna_order_id={checkout.order.id}",
      "push": "https://push?klarna_order_id={checkout.order.id}",
      "shipping_option_update": "https://shipping_option_update?klarna_order_id={checkout.order.id}"
    }

Note that this is only applicable when you are using the shipping selector inside the KCO and want to control the order. If you do not use this callback KCO will add the shipping cost to the order total and to the order lines for you.

Please see our api specification.

Order validation

The validation callback can be used to validate the purchase before it is completed. Read more at validate order.

Please see our api specification.