Klarna Docs - 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 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 e-mail, HPP will start by validating that the e-mail 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 an e-mail address on a User Interface, it is advised to create error flows. You can expect the 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. You can use up to 100 emails per day for testing purposes.

DescriptionDistributes HPP via email
ReferenceFor a full list of accepted parameters listed in HPP Distribute Session Parameters below
Url structurehttps://{endpoint}/hpp/v1/sessions/{session_id}/distribution
Examplecurl -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>"

Error codes explanation:

StatusError CodeDescription
400UNKNOWNundefined error, please contact Klarna support
400MISSING_CONTACT_DATAemail data is incomplete for selected method
404NOT_FOUNDpayment session no longer exists
400CONSTRAINT_VIOLATIONinvalid request
400UNSUPPORTED_COUNTRYphone number of requested country can not be used in current region
400BLACKLIST_REFUSEDuser is blacklisted
429EMAIL_LIMIT_EXCEEDEDemail limit for testing environment exceeded
ParametersTypeDescription
methodStringSet to email
contact_information.emailStringEmail address of the customer.
JSON
{
    "contact_information": {
        "email": "user@example.com"
     },
    "method": "email"
}
ParametersTypeDescription
methodStringSet to token
contact_information.access_idStringThe access identifier is the value read from the QR code shown by the customer. It should not be altered by the integrator. It is important that whatever the value read from the QR is, the system is able to properly escape the String for JSON format and send the value as is.
JSON
{
    "contact_information": {
        "access_id": "5a5e8e70-1a96-4651-b3b6-b774012a5bbb"
     },
    "method": "token"
}