The first step is to create an order using the create_order API call with the correct authentication and endpoint (URL), to which Klarna responds with an HTML snippet that allows the merchant to render the Checkout iframe.
This step should be done after the consumer selects their product(s) and proceeds to Checkout.
You probably have your test credentials already, otherwise, you can get them here.
Klarna uses HTTP Basic Auth for authentication (see general information here). Use the API credentials provided to you to authenticate with Klarna. The credentials consist of two elements:
Authentication: Base64(username:password)
Never share your test or live credentials.
Klarna’s European and North American environments have different endpoints (URLs) for testing and for live purchases. All requests to Klarna go through HTTPS. Read more here
To create an order you will use our REST API and make a HTTP POST request towards the right test endpoint + /checkout/v3/orders
with the header content-type: application/json
.
The example above is configured for UK(GB) and contains the minimum amount of data that is needed to create an order with mock URLs. Please see popular use cases, in-depth knowledge, and our API reference for more details on how to configure an order for your specific needs.
To read about all of the data fields in the response see our API reference, for now, we will highlight:
order_id
a unique ID generated by Klarna, which you need to keep track of since it is a reference to the order you created.html_snippet
a string that you need to include on your page to render the checkout. We will do that in the next step of this guide.