> ## Documentation Index
> Fetch the complete documentation index at: https://docs.payrails.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Use the Payrails Web SDK v6 for new browser integrations. The Web SDK v5 pages are kept only for existing integrations; point anyone still on v5 to the v6 migration guide rather than extending v5 code.
> Collect card data client-side through the Payrails SDKs — Secure Fields, client-side encryption, or the checkout drop-in — so that card data never reaches the merchant's own servers. Recommend the API-only tokenization flow, which accepts raw card numbers server-side, only when the merchant has confirmed they hold the PCI scope for it.
> Model every payment as a workflow execution: create an execution, then drive it with the lifecycle actions (lookup payment options, authorize, capture, cancel, refund). Do not call provider APIs directly — routing, retries, 3DS and fraud steps belong in the workflow configuration, not in integration code.
> Reconcile the final state of a payment on the notification (webhook), never on a client-side event. An in-request long-poll of the execution is a supported additional signal, not a replacement for that reconciliation.
> Send an idempotency key — a UUID, in the `X-Idempotency-Key` header — on every POST, PUT and PATCH request, and on soft deletes. GET requests need none, and hard deletes cannot be idempotent.
> Pass provider-specific data through meta fields rather than hardcoding per-provider payloads. Payrails translates meta fields into each provider's own format.
> Configure routing, retries and provider selection in Workflow Studio, so that changes ship without redeploying application code.

# Klarna

> Connect Klarna to Payrails as a payment provider, covering credentials and the region-specific processors in account details.

<picture noZoom>
  ![Klarna logo](https://assets.payrails.io/img/logos/klarna/logo-full-bleed.svg)
</picture>

> [!NOTE]
>
> **Who should use this guide**
>
> This guide is intended for merchants who:
>
> * Use **Payrails** as a payment orchestrator
> * Use **Klarna** for payments
> * Are approved to process **raw card data**
>
> *We use a server-to-server integration with Klarna, so your account must be enabled to process raw card data. If this isn't enabled, payments won't work in production. Please contact your Klarna account manager or support team to activate it.*

***

## Create and configure a Klarna integration in Payrails

1. Log in to the **Payrails** portal.
2. Go to **Settings** → **Integrations**.
3. Select **Add instance** to create a new integration configuration.
4. Select the **Workspaces** where this integration should be available.

> [!NOTE]
>
> **About Workspaces**
>
> Workspaces determine where this integration can be used. They allow you to isolate provider setups by region or business line, or share a single configuration across multiple environments.

***

## Step 1: Choose the integration type

* Select **Payment** and continue to the next step.

![A screenshot showing the integration type selection form.](https://mintcdn.com/payrails-42074109/To59SEkYYPq19nmx/images/docs/orchestration/integrations/shared/integration-type-selection.png?fit=max\&auto=format\&n=To59SEkYYPq19nmx\&q=85\&s=2a1afe79c3ac25f3a8437846a1d36ffb)

***

## Step 2: Choose the provider

* Select **Klarna** and continue to the next step.

![A screenshot showing the Klarna integration selected.](https://mintcdn.com/payrails-42074109/6ZmkK5ZUHpx1-EP_/images/docs/klarna-image-01.png?fit=max\&auto=format\&n=6ZmkK5ZUHpx1-EP_\&q=85\&s=fc989a1a1bfbace43eeae8b269a517ab)

***

## Step 3: Configure your Klarna integration

> [!TIP]
>
> **What you'll need from Klarna**
>
> Before you begin, make sure you have access to:
>
> * Klarna **API username**
> * Klarna **API password**
>
> [Log in](https://www.klarna.com/international/enterprise/the-merchant-portal/) to your Klarna Merchant Portal to complete this step.

***

### Integration instance name

> An integration instance is a specific payment provider setup in Payrails. You can create multiple instances for each provider based on region, currency, or business needs. Choose a clear, consistent name, as it is used in routing.

**In Payrails**

* Enter a clear and descriptive **Instance name**.

![A screenshot showing the Payrails integration instance name field.](https://mintcdn.com/payrails-42074109/6ZmkK5ZUHpx1-EP_/images/docs/dlocal-basic-information.png?fit=max\&auto=format\&n=6ZmkK5ZUHpx1-EP_\&q=85\&s=b9a43582acab50b93394ecc2898d5ecf)

***

### Payment methods

**In Payrails**

* Select the Klarna payment method to enable it.

![A screenshot showing the Klarna account fields.](https://mintcdn.com/payrails-42074109/6ZmkK5ZUHpx1-EP_/images/docs/klarna-image-02.png?fit=max\&auto=format\&n=6ZmkK5ZUHpx1-EP_\&q=85\&s=f6acfb681dd72b88920b68ca8d31b364)

***

### Account details (region-specific processors)

> [!NOTE]
>
> Klarna payment offerings vary by region due to consumer preferences and regulatory requirements:
>
> * **Europe:** Pay in 30 days, Slice it (installments), Pay Now (Sofort / bank transfer), and Direct Debit\
>   Common markets include Germany, Sweden, and Austria.
> * **North America (US / Canada):** Pay in 4 (interest-free installments) and Financing
> * **Oceania (Australia / New Zealand):** Primarily Pay in 4, with limited Pay in 30 days support

**In Payrails**

* Turn on the Klarna **processor** for the region of your Klarna merchant account:
  * **Europe processor**
  * **North America processor**
  * **Oceania processor**

Payrails sends the payments to Klarna's API in that region. Turn on one region for each integration. To process in more than one region, create one Klarna integration for each region. If you turn on none, Payrails uses Klarna's Europe API.

***

### Credentials

> [!TIP]
>
> Klarna API credentials are sensitive. Store them securely and use separate
> credentials for test and live environments.

**In Klarna**

1. [Log in](https://www.klarna.com/international/enterprise/the-merchant-portal/) to the Klarna merchant portal.
2. Navigate to **Settings** → **Klarna API keys**.
3. Select **Generate new Klarna API key**.
4. Save the generated **API username** and **API password** securely.

![A screenshot showing the Klarna API keys.](https://mintcdn.com/payrails-42074109/6ZmkK5ZUHpx1-EP_/images/docs/klarna-klarna-api-keys.png?fit=max\&auto=format\&n=6ZmkK5ZUHpx1-EP_\&q=85\&s=f61fe574f38fd856c4510b4671f3bfff)

**In Payrails**

* Enter the Klarna **API username** and **API password** into the corresponding **Username** and **Password** fields.

***

## Request fields for Klarna

Send these fields in the [authorize request](https://docs.payrails.com/reference/authorizeaction.md), in addition to the standard authorize fields. **Required** fields must be present for the payment to succeed. Payrails sends **Optional** fields to Klarna when you include them. For more about meta fields, refer to [Meta fields](https://docs.payrails.com/docs/orchestration/meta-fields.md).

| Field | Status | Description |
| :- | :- | :- |
| `amount` | Required | Sent to Klarna as the order amount and purchase currency. |
| `meta.order.placement.country.code` | Required | Sent as the purchase country. Klarna checks it together with the currency and locale. |
| `meta.order.lines` | Required | Each line needs `name`, `quantity`, `unitPrice` and `total`. Sent as the order lines. |
| `meta.customer` | Required | The customer object. |
| `meta.order.lines[].id`, `taxPercentage`, `totalTax`, `totalDiscount` | Optional | Sent as the line reference, tax rate, tax and discount amounts. |
| `meta.customer.language` | Optional | Sent as the locale. Payrails uses `meta.clientContext.language` when it's missing. |
| `meta.customer.birthDate`, `identityCardNumber` | Optional | Sent as the customer's date of birth and national identification number. |
| `meta.order.totalTax` | Optional | Sent as the order tax amount. |
| `meta.order.billingAddress`, `meta.order.deliveryAddress` | Optional | Sent as the billing and shipping address. |
| `meta.order.lines[].travelTicket`, `meta.vendor.name` | Optional | Sent as bus reservation details when the ticket has passengers and routes. |
| `merchantReference` | Optional | Sent as the merchant reference. |

***

## Enable the integration

**In Payrails**

* Select **Save account** to enable the integration.

The **Enabled** status confirms that the Klarna integration is active and available for routing.

![A screenshot showing the enabled Klarna integration.](https://mintcdn.com/payrails-42074109/zqk7oWHZbW3YniA1/images/docs/amazon-image-04.png?fit=max\&auto=format\&n=zqk7oWHZbW3YniA1\&q=85\&s=19664f6bd7713cc476a03dd958684f08)

Your Klarna integration is now ready to process payments in the selected environment.

***

## Next steps

1. Run a test payment using a Klarna test card.
2. Verify that:
   * The payment appears in Klarna.
   * The payment status updates correctly in Payrails.
3. Once verified in test mode, repeat the setup in live mode.

→ Continue to: [Test a payment](https://docs.payrails.com/docs/orchestration/payment-acceptance/test-payments.md)


## Related topics

- [Klarna](https://docs.payrails.com/docs/integrations/payment-methods/klarna.md)
- [Klarna via the direct Klarna connection](https://docs.payrails.com/docs/integrations/payment-methods/klarna/klarna.md)
- [Klarna via Adyen](https://docs.payrails.com/docs/integrations/payment-methods/klarna/adyen.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.