Klarna

{/* Generated by scripts/generate-integration-catalog.mjs. Do not edit by hand. */}

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.

VariableRequiredDescription
KLARNA_API_USERNAMEYesKlarna API username (the UID shown when creating credentials in the Merchant Portal), used as the HTTP Basic username Docs.
KLARNA_API_PASSWORDYesKlarna API password/key associated with the username, used as the HTTP Basic password Docs.
KLARNA_API_HOSTNoKlarna API host without scheme: api.klarna.com (Europe), api-na.klarna.com (North America), or api-oc.klarna.com (Oceania); playground credentials use the api.playground.klarna.com variants.

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

ToolAccessDescription
Get Order<br /><code className="reference-identifier">klarna__get_order</code>ReadGet order
Capture Order<br /><code className="reference-identifier">klarna__capture_order</code>WriteCapture fulfilled order
Refund Order<br /><code className="reference-identifier">klarna__refund_order</code>WriteRefund captured order amount
Cancel Order<br /><code className="reference-identifier">klarna__cancel_order</code>WriteCancel uncaptured order
Release Remaining Authorization<br /><code className="reference-identifier">klarna__release_remaining_authorization</code>WriteRelease remaining authorization
Get Capture<br /><code className="reference-identifier">klarna__get_capture</code>ReadGet capture

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.