Klarna Docs - Confirm purchase

Confirm purchase

Confirming the purchase means that you have received and created an order in your system. This confirmation is needed in response to a push notification from Klarna, indicating that the customer has completed a purchase.

A customer has completed a purchase and you want to create the associated order in your system.

A customer has completed a purchase with Klarna Checkout.

Once a customer has completed a purchase, Klarna will notify you by sending a POST request. The POST request will be sent to the push notification URL that you provided when you created the checkout order.

There is approximately a 2 minute delay before the order-confirmation push to the merchants is attempted.

For instance with these merchant urls:

JSON
"merchant_urls": {
    "terms": "https://merchant.com/tac.php",
    "checkout": "https://merchant.com/checkout.php?klarna_order_id={checkout.order.id}",
    "confirmation": "https://merchant.com/thankyou.php?klarna_order_id={checkout.order.id}",
    "push": "https://merchant.com/kco/push.php?klarna_order_id={checkout.order.id}"
}

You would receive a POST request to the push URL with the placeholder {checkout.order.id} replaced with the correct order_id and an empty body.

For example: https://merchant.com/kco/push.php?klarna_order_id=12345

You should now use the order id found in the query parameter klarna_order_id to fetch the order from the Order Management API.

HTTP
GET /ordermanagement/v1/orders/order_id
Authorization: Basic pwhcueUff0MmwLShJiBE9JHA==
Content-Type: application/json

The confirmation page might fail to load for a number of reasons, even though the purchase is confirmed by Klarna. However, once you receive a POST request at the push confirmation endpoint, you can be assured that the purchase was successful and you should make sure that you have created the order and create if it doesn’t exist. The full resource structure of an order can be found in the API Reference.

You should now send a request to Klarna saying that you acknowledge the order. This will stop any further POST requests to the push notification URL from being sent.

Klarna will keep sending the push notifications after 5, 15, 30, and 60 minutes and then after every 4 hours for a total of 48 hours or until you confirm that you have received the order. After 48 hours we will stop sending notifications, but the order is still open and can be captured or updated as normal.

HTTP
POST /ordermanagement/v1/orders/order_id/acknowledge
Authorization: Basic pwhcueUff0MmwLShJiBE9JHA==
Content-Type: application/json
  1. There should be an attempt to acknowledge the order on the confirmation page.
  2. The order confirmation push should be implemented as a backup.
  3. If the order doesn’t exist when the push is received the order should be created. If there is no intention to ship the order, it should be canceled.
  4. Every order should either be acknowledged or canceled. Orders which will not be shipped should be canceled immediately.

At this point, the order has been confirmed and you can proceed with the next steps. Once you have shipped the product, you need to capture the order in order to finalize the payment. The order can be found at Klarna’s Merchant Portal or you can integrate with our Order Management platform using the APIs provided.

  • In order to finalize the payment, and initiate the payout to you, you need to capture the order after you have shipped it to the consumer. You can either use our APIs for managing orders, or you can perform this action manually each time in our Merchant Portal.