Authentication

API Credentials

To authenticate with Klarna's APIs you need an API credential, the primary credential format is an API-key.

An API key has the following format:

klarna_<live|test>_<api>_<random>

  • API key example:

    klarna_live_api_elZGI1B5dHBIRWltRjF5cjZrNldnbEVjKnIqeC[...]Uybz0

The key contains some information about it's usage:

  • live indicates that it's a key used for production
  • test indicates that it's a key used for playground
  • api indicates that is'a an API key

The credential is associated with your Merchant ID (MID) and can only be used to transact on your online store.

Note: The API credentials are separate from your MID. It's possible to have several API credentials associated with the same MID.

The API key should be included in the Authorization header for every request in the following format:

Authorization: Basic <API key>

The API key is retrieved from the Merchant Portal or by contacting your regional Klarna merchant support team.

If the credentials are missing or incorrect, Klarna responds with 401 Unauthorized.

Username/Password Clients

If you have an API client that only supports username/password instead of API keys, there is a way to use this format when calling the Klarna APIs.

When creating a credential in the merchant portal, a username in the form of a UUID is displayed together with the API key.

This username can be provided along with the API key as the password when calling the Klarna APIs.

This UUID is not required, but if it is provided, it must be the one used to identify the API key.

The call would be made on the following format:

Authorization: Basic <UUID>:<API key>

You can read more about HTTP basic auth in the wikipedia article.

Security

TLS

To ensure your connection is secure, our endpoint supports HTTPS using TLS 1.2 (Transport Layer Security).

The client needs to use Server Name Indication (SNI) in the TLS handshake with the endpoint.