HPP (1.1)

Download OpenAPI specification:Download

License: Klarna Bank AB

Hosted Payment Page (HPP) API is a service that lets you integrate Klarna Payments without the need of hosting the web page that manages the client side of Klarna Payments. A complete HPP payment session will involve three of Klarna services:

Read more on Hosted payment page.

Create an HPP session

Use this API to create an HPP session after creating a payment session. Read more on Create a new HPP session.

Request
header Parameters
User-Agent
string

User-Agent

Request Body schema: application/json

sessionRequest

object (MerchantUrlsV1)
object (OptionsV1)
payment_session_url
required
string

URL of the KP Session or KCO Order to be hosted by the HPP Session

profile_id
string

Profile id for default session options

Responses
201

Successfully created HPP session

400

We were unable to create a session with the provided data. Some field constraint was violated.

401

Unauthorized

403

You were not authorized to execute this operation.

404

Payment session has expired.

post/hpp/v1/sessions
Request samples
application/json
{}
Response samples
application/json
{}

Get details of an HPP session

Use this API to read an HPP session content and it's status. Read more on Read HPP session.

Request
path Parameters
session_id
required
string

HPP session id

Responses
200

Session found

401

Unauthorized

403

You were not authorized to execute this operation.

404

HPP session has expired or could not be found by provided id.

get/hpp/v1/sessions/{session_id}
Request samples
curl -i -X GET \
  'https://api.klarna.com/hpp/v1/sessions/{session_id}'
Response samples
application/json
{
  • "authorization_token": "70850a20-a2a0-5c70-810c-096fa6f850bb",
  • "customer": {
    },
  • "expires_at": "2038-01-19T03:14:07.000Z",
  • "klarna_reference": "ffc25786",
  • "manual_identification": {
    },
  • "order_id": "93d644a2-43f3-11e9-b210-d663bd873d93",
  • "session_id": "a15b228c-02ad-11e9-8eb2-f2801f1b9fd1",
  • "status": "COMPLETED",
  • "updated_at": "2038-01-19T03:14:07.000Z"
}

Disable an HPP session

Use this API to disable an HPP session if payment session had to be cancelled for any reason. Read more on Disable HPP session.

Request
path Parameters
session_id
required
string

HPP session id

Responses
204

Session was disabled

400

HPP session has already been successfully completed.

401

Unauthorized

403

You were not authorized to execute this operation.

404

HPP session has expired or could not be found by provided id.

delete/hpp/v1/sessions/{session_id}
Request samples
curl -i -X DELETE \
  'https://api.klarna.com/hpp/v1/sessions/{session_id}'

Distribute an HPP session

Use this API to distribute to the Consumer a link to the Hosted Payment Page either by e-mail or SMS after you have created an HPP session. Read more on Distribute link to the HPP Session to the Consumer.

Request
path Parameters
session_id
required
string

HPP session id

Request Body schema: application/json

Distribution Request parameters

required
object (DistributionContactV1)
method
required
string

Method used for distribution

Enum: "sms" "email" "token"
template
string

Template to use for distribution. In the current version this value is not used and might be removed in the future.

Value: "INSTORE_PURCHASE"
Responses
201

Created

204

Successfully distributed the HPP Session

400

We were unable to distribute the link with the provided data. Some field constraint was violated. Or session is disabled by merchant.

401

Unauthorized

403

Forbidden

404

HPP session not found or access token not found

503

We were unable to distribute the link due to an internal error. Please try again

post/hpp/v1/sessions/{session_id}/distribution
Request samples
application/json
{
  • "contact_information": {
    },
  • "method": "sms",
  • "template": "INSTORE_PURCHASE"
}