4. Place Order

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

 

4.1. The Merchant places the order

When you have received the authorization_token from the authorization, you place the order by posting to Payments API/orders. Among the other order details in this request, you include a URL to the confirmation page for the customer.

POST /credit/v1/authorizations/<authorization_token>/order
Authorization: Basic pwhcueUff0MmwLShJiBE9JHA==
Content-Type: application/json

{
    "purchase_country": "GB",
    "purchase_currency": "GBP",
    "billing_address": {
        "given_name": "John",
        "family_name": "Doe",
        "email": "john@doe.com",
        "title": "Mr",
        "street_address": "13 New Burlington St",
        "street_address2": "Apt 214",
        "postal_code": "W13 3BG",
        "city": "London",
        "region": "",
        "phone": "01895808221",
        "country": "GB"
    },
    "shipping_address": {
        "given_name": "John",
        "family_name": "Doe",
        "email": "john@doe.com",
        "title": "Mr",
        "street_address": "13 New Burlington St",
        "street_address2": "Apt 214",
        "postal_code": "W13 3BG",
        "city": "London",
        "region": "",
        "phone": "01895808221",
        "country": "GB"
    },
    "order_amount": 10,
    "order_tax_amount": 0, // optional
    "order_lines": [
        {
            "type": "physical", // optional
            "reference": "19-402", // optional
            "name": "Battery Power Pack",
            "quantity": 1,
            "unit_price": 10,
            "tax_rate": 0, // optional
            "total_amount": 10,
            "total_discount_amount": 0, // optional
            "total_tax_amount": 0, // optional
            "product_url": "https://www.estore.com/products/f2a8d7e34", // optional
            "image_url": "https://www.exampleobjects.com/logo.png" // optional
        }
    ],
    "merchant_urls": {
        "confirmation": "https://example.com/confirmation",
        "notification": "https://example.com/pending" // optional
    },
    "merchant_reference1": "45aa52f387871e3a210645d4", // optional
}

4.2 Handle the response

You can either get a successful response, or an error.

The response contains the following information

  • order_id - used for order management interactions, such as capturing or refunding the order
  • redirect_url - a URL which you immediately redirect the consumer to
  • fraud_status - may indicate that this is a suspected fraudulent order

Successful response: the order is confirmed

You receive an Order ID, a redirect URL and fraud_status ACCEPTED. 

{
  "order_id": "3eaeb557-5e30-47f8-b840-b8d987f5945d",
  "redirect_url": "https://credit.klarna.com/redirect/asdasADserDF",
  "fraud_status": "ACCEPTED"
}

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

To display your confirmation page, your last step is to redirect the customer to the redirect_urlThe reason for this redirect is to allow us to recognize the customer's device in future interactions. We therefore 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 your confirmation page.

Pending order

Instead of immediately accepting the order, it may happen that Klarna flags this transaction for additional review. This is indicated if the fraud_status is PENDING. Read more about what to next in our section about pending orders.

Error response

If an error is returned, see here for details.

There are two reasons we would reject

  1. The order was placed within the required time window. However, the data was not matching the data provided during the authorization call.
  2. The order was placed outside the authorization window, and Klarna could not re-authorize it successfully. 

If you want to give the consumer the option to complete the order at this point, then update the session and proceed with loading the Widget again.

Summary so far: “A Job Well Done”

Congratulations, you’ve just placed an order at Klarna! The widget is up and running the way it should.


What's next?

Just a few more steps before start taking orders live‚Äč. Go through our go live check list!