Skip to main content

At a glance

  • Availability: Experimental (how to enable).
  • Authentication: Basic auth.
  • Connection: HTTP Basic auth with KLARNA_API_USERNAME as the username and KLARNA_API_PASSWORD as the password.
  • Provider documentation: Authentication reference.

Credentials

Set these per environment. See Connect an integration.

Setup

  1. Get a Klarna merchant account: Sign up as a Klarna merchant at https://www.klarna.com/business/ and log in to the Merchant Portal at https://portal.klarna.com/. For testing without a live contract, use the Playground environment (https://portal.playground.klarna.com/).
  2. Create API credentials: In the Merchant Portal, go to Settings > API credentials and generate a new credential. You get a username (a UID linked to your merchant ID) and a password/API key. The password is shown only once, so store it immediately.
  3. Set environment variables: Add KLARNA_API_USERNAME (the UID) and KLARNA_API_PASSWORD (the API key/password) to your .env. Requests authenticate with HTTP Basic auth using these two values.
  4. Pick your regional host and verify: All tools use the KLARNA_API_HOST environment variable (default api.klarna.com for Europe). Set api-na.klarna.com for North America or api-oc.klarna.com for Oceania. Run Get Order with a known order ID to verify access.

Provider notes

  • Playground (test) credentials only work against the playground hosts (api.playground.klarna.com, api-na.playground.klarna.com, api-oc.playground.klarna.com) and production credentials only against production hosts, so set KLARNA_API_HOST accordingly.
  • All amounts are in minor units of the order currency (e.g. 1050 = 10.50 EUR).
  • Refunds require a prior capture; cancel only works on orders that have not been captured.
Provider API reference.

Tools

Verify the connection

Call a read tool such as klarna__get_order with arguments for your account. Confirm that the result comes from the intended account or workspace before enabling write tools.