Let's look at the interactions between your site and Klarna when using Klarna Checkout.
- Render the checkout page. You will start the order session by calling Klarna's server with your customer's cart details, locale, your merchant ID and a few more details. You will get an HTML snippet back. You will embedd this checkout snippet on your site to render the checkout page for the consumer.
- Render the confirmation page. After the consumer has completed the purchase in the checkout snippet, you will call Klarna to get a confirmation page HTML snippet back. This snippet will contain the order confirmation details. You will show this snippet embedded on your confirmation page.
You will need to have the following on your site
- A Checkout page and confirmation page, where you include a div that you will populate with the HTML snippets you receive from Klarna
- A Push URI, where Klarna informs you of the order status. You need to include a push URI, which Klarna will then replace with the order id when we send the push request.
- Terms and Conditions URI, where you host your terms and conditions. Klarna will provide the consumer with a link to your terms and conditions in certain phases of the order, so you need to create a terms and conditions URI, to which Klarna can such a link.
When using Klarna's APIs you need to authenticate using a merchant id and a shared secret. Visit the test credentials page to get authentication credentials for testing.
Let's get into the code. You will start by embedding the checkout snippet.