Klarna Docs - Place Order towards Klarna

Place Order towards Klarna

Placing an order towards Klarna means that the Klarna Payments session will be closed and that an order will be created in Klarna's system.

You finalize the order in this step via a server side call. Before you place the order, you must have received an authorization_token from the previous step.

Best Practice: The authorization_token from the previous step is valid for 60 minutes. If you attempt to place an order with this after that time has passed, it will be rejected.

When you have received the authorization_token from the authorize-call you can place the order. Among the other order details in this request, you include a URL to the confirmation page for the customer.

When the Order has been successfully placed at Klarna, you need to handle it either through the Merchant Portal or using Klarna’s Order Management API

To ensure that session handling is aligned between you as a merchant and Klarna, we are validating that data shared at Place Order is aligned with any data shared in any previous calls (from create_session, to load or authorize).

If any discrepancies are found, e.g. a changed billing_address detail, the place order call fails with an error message on the specific field that failed the validation.

See details in the section Potential error codes and messages.

You can either get a successful response or an error. These are described below

The response contains the following information

  • order_id - Used to identify the specific placed order for order management interactions, such as capturing or refunding the order.
  • redirect_url - Includes a URL which you should immediately redirect the consumer to after you receive the response. Only received if defined by the merchant in the session.
  • fraud_status- May indicate that this is a suspected fraudulent order. In the case of a successful order this is ACCEPTED.
  • authorized_payment_method- Will display the payment method that was chosen by the consumer to complete the purchase.
    "order_id": "3eaeb557-5e30-47f8-b840-b8d987f5945d",
    "redirect_url": "https://payments.klarna.com/redirect/...",
    "fraud_status": "ACCEPTED",

Store the order_id for future reference during order fulfillment or service center management.

In order for Klarna to securely handle the data and optimize the purchase flow they need to interact with the customer’s browser as first party (not in an iframe or similar). This is achieved by ‘bouncing’ the browser on a klarna.com page before presenting the merchant confirmation page.

To do this the merchant provides the url of their confirmation page together with the rest of the order details, and Klarna will respond with a redirect url that will take the customer to the confirmation page. The merchant should send the customer browser to the redirect_url provided in the response.

Klarna will redirect the consumer back to the page you provided in the confirmation_url.

There are multiple reasons that the place order call would be rejected. The most common include:

  • The order was placed outside the authorization window, and Klarna could not re-authorize it successfully.
  • The data was not matching the data provided during the authorization call.
      "correlation_id": "6a9b1cb1-73a3-4936-a030-481ba4bb203b",
      "error_code": "ERROR_CODE",
      "error_messages": [
Error CodeError messageComment
NOT_FOUNDInvalid authorization tokenThis is returned if order is placed after the authorization token has expired. Please ensure the order is placed within 60 minutes of the authorization.
BAD_VALUENot matching fields: [billing_address.postal_code]The data entered in previous calls (create_session, load and authorize) is validated at place_order, to ensure session handling is correct. This error message is returned in case a specific field has been changed from create_session to place_order, as our validation rules thus fails.
BAD_VALUENot matching fields: [Incorrect number of items in the cart. Expected: 2, Actual: 3]If the order lines are updated or anything is added after authorize, this will fail during validation. Please ensure that the cart is kept as is or do another authorize.
REJECTEDRejectedThis is an edge case reason, but can be triggered in case the merchant is configured with being allowed to update the cart. This could be updated from the authorize to the place order in such a way that a new authorize is triggered. In this case this is rejected.

Best Practice: If a place order is failed due to an expired authorization token. You can give the consumer the option to complete the order at this point, through update the session and proceed with loading the widget again.

If, for some reason, more than 60 minutes passes between an authorization is made and the order is placed the original authorization_token will expire.

In this case it is recommended to attempt a new authorization towards Klarna to receive a new authorization_token. Please note that you must use the new authorization_token when attempting to place the order.

NOTE: This is only done in case you have added to your agreement with Klarna that you will use pending status.

Instead of immediately accepting the order, it may happen that Klarna flags this transaction for additional review. This is indicated if fraud_status: PENDING.

Read more about what to do next in our section about pending orders.

If you are selling digital goods or depending on the used payment method you may want the order to be captured automatically once it has been created. In order to do so, you can set auto_capture to true when placing the order.

Note: This feature should not be used unless you have an agreement with Klarna that you should do it, as the customer experience is sub-optimal.