HPP API: Distribute Session

When you have created an HPP Session you will have the ability to distribute to the Consumer a link to the Hosted Payment Page either by e-mail or SMS using the Distribute Endpoint. You will get the URL of the distribution endpoint in the distribute_url field that you got back from the create session response .

The message sent to the Consumer using the contact information given in parameters will be localised to the Consumer’s language from the HPP Session creation and will contain a link. When using the link, the Consumer will see the specific Hosted Payment Page.

By accessing the HPP Session by this distribution mechanism, the given phone number or e-mail address will be used by Klarna to try to pre-fill the Consumer if they already used Klarna before and agreed to be pre-filled. This is done because Klarna now knows that the Consumer actually owns this phone number or e-mail address.

When asking for a distribution by SMS or e-mail, HPP will start by validating that the phone number or address is a correct one. If it is not, an error code will be sent back to the integrator (4xx Bad Request). If distribution is done by a human entering a phone number or e-mail address on a User Interface, it is advised to create error flows. You can expect the SMS or e-mail to be sent in the few seconds after this call, but this deliveries are not synchronous and it may take up to a few minutes for the Consumer to actually receive the link. Read our guide on distributing the session

DescriptionDistributes HPP via email or SMS
Description
Reference
Distributes HPP via email or SMS
For a full list of accepted parameters listed in HPP Distribute Session Parameters below
Description
Url structure
Distributes HPP via email or SMS
https://{endpoint}/hpp/v1/sessions/{session_id}/distribution
Description
Example
Distributes HPP via email or SMS
curl -X POST https://api.klarna.com/hpp/v1/sessions/<session_id>/distribution --header "Authorization: Basic <token>" --header "Content-Type: application/json" --header “Cache-Control: no-cache” --data “<parameters>"

Distribution by SMS

ParametersTypeDescription
Parameters
method
Type
String
Description
Set to sms
Parameters
contact_information.phone
Type
String
Description
Phone number of the Consumer, can be either in local format 07xxxxxx or in international format +46xxxxxxxxx.
Parameters
contact_information.phone_country
Type
String
Description
Country of the phone number that will be used to define what local refers to. In a Sweden integration, it is advised to always use SE and let an operator input an international format for everything that is outside of Sweden.

Example for Sweden

  1. Local send out
1
2
3
4
5
6
7
{
    "contact_information": {
        "phone": "0712345678",
        "phone_country": "se"
    },
    "method": "sms"
}
  1. International send out from Sweden
1
2
3
4
5
6
7
{
    "contact_information": {
        "phone": "+33712345678",
        "phone_country": "se"
    },
    "method": "sms"
}

Distribution by Email

Contact information field

ParametersTypeDescription
Parameters
method
Type
String
Description
Set to email
Parameters
contact_information.email
Type
String
Description
Email address of the customer.

Example

1
2
3
4
5
6
{
    "contact_information": {
        "email": "user@example.com"
     },
    "method": "email"
}