This page will take you through the Hosted Payment Page API and explain how to interact with it and its concepts. Please make sure to understand why you should use the Hosted Payment Page and the Overview of the system before reading this documentation. The Hosted Payment Page works with a Payment Provider from the Klarna ecosystem, and you will need to create a KP Session before being able to create an HPP Session. A different integration guide is available for both platforms.
In this document, the term Payment Provider refers to Klarna Payments and Payment Session refers to the corresponding KP Session.
Klarna’s Hosted Payment Page (HPP) requires that you integrate different server-side REST APIs from the Klarna environment and thus requires no client-side integration. The different APIs correspond to different Klarna products and have some defined objects that interact with each other.
Klarna Ecosystem
The Hosted Payment Page supports Klarna Payments, which will be referred to in this documentation as the Payment Provider.
a. Klarna Payments REST API: create Payment Session, place Order
The Hosted Payment Page REST API can be used to let Klarna host the client-side integration of Klarna Payments for you. You will have to create a Session and then distribute it.
In the Klarna Payments integration case, when placing the order with the KP Authorization Token, you can configure it to automatically capture the payment. In that case you won’t have to integrate the Order Management API outside of refunds. This should be limited to digital goods or when you limit it to some payment meth
HPP Session Lifecycle
KP Session and HPP Session both have an expiration time, but the expiration is driven by the Payment Session which usually expires 48 hours after its creation. A Consumer will be able to pay on HPP until 1 hour before the Payment Session expiration.
Klarna uses HTTP’s Basic auth to authenticate requests from Merchants. Use your API Credentials to add the corresponding HTTP headers to your requests, the credentials consist of two elements:
Use your credentials to generate the token: Base64(username:password)
Username | DemoMerchant |
---|---|
Password | DemoPassword |
Calculated basic auth | RGVtb01lcmNoYW50OkRlbW9QYXNzd29yZA== |
Example of request | curl -X GET https://api.klarna.com/payments/v1/sessions/<session_id> --header "Authorization: Basic RGVtb01lcmNoYW50OkRlbW9QYXNzd29yZA==" --header "Content-Type: application/json" |
Klarna offers a test environment named Playground and a Production environment. The different APIs are available on each environment. URL structures are the same for both environment, targeted environment will be defined by the domain you are using. To be able to test your integration, you will need a Test Account.
You can find more in our [ environments and testing guidelines].
The HPP API follows the same rules as other Klarna public APIs, we try to update our APIs regularly in a non breaking way, ensuring backward compatibility. You can find more in our API updates guidelines and see how we define backward compatibility and non-breaking changes.