Klarna

📘

Who should use this guide

This guide is intended for merchants who:

  • Use Payrails as a chargeback
  • Use Klarna Disputes

We use a server-to-server integration with Klarna, so your account must be enabled to process dispute. If this isn’t enabled, chargebacks 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 SettingsIntegrations.
  3. Select Add instance to create a new Klarna integration configuration.
  4. Select the Workspaces where this integration should be available.

About Workspaces
Workspaces determine where this integration is available. They let you isolate provider setups by region or business line, or share the same configuration across multiple Workspaces.


Step one: Choose the integration type

  • Select Dispute.
  • Continue to the next step.


Step two: Choose the provider

  • Select Klarna.
  • Continue to the next step.

Step three: Configure your Klarna integration

📋

What you’ll need from Klarna

Before you begin, make sure you have access to:

  • Username
  • Password
  • Webhook signing keys

Integration instance name

In Payrails

  • Enter an Instance name for your integration.

API Credential

In Klarna

  • Sign in to the Klarna Portal Dashboard.

  • Navigate to Settings > Klarna API Keys in the sidebar.

  • Locate your Merchant ID (MID). In the image below, the Merchant ID is K0123456.

  • Generate a new Klarna API Key.

📌

Klarna will display a one-time dialog containing a Username (UUID) and a Password (starting with klarna_test_api_ for sandbox or klarna_live_api_ for production).

  • Copy the Username and Password.
⚠️

The password is shown only once. Once you close the dialog, Klarna cannot reveal it again. You would need to generate a new key. Save it before clicking Close.

In Payrails

  • Paste the values into the Klarna Account section.

Klarna's configuration

To enable your account to start working with Disputes via API, you need to interact with their API and reach out to your integration manager or technical point of contact, because they currently does not support the self-service for this whole process.

Enrolling your merchant with Klarna Disputes API

Klarna's Disputes API (V4) requires merchants to be enrolled before they can receive dispute events or call the dispute endpoints.This is a one-time, per-environment action.

Call the Self onboarding for merchants endpoint using the credentials and merchant ID (MID) retrieved in the API Credential step.

More details in Klarna's documentation page.

POST https://api.klarna.com/v4/payment/disputes/merchants/{merchant_id}/enroll
Authorization: Basic <base64(username:password)>
Content-Type: application/json
POST https://api.playground.klarna.com/v4/payment/disputes/merchants/{merchant_id}/enroll
Authorization: Basic <base64(username:password)>
Content-Type: application/json

Ask Klarna to register the notification URL

Once enrolled, Klarna still needs to:

  1. Register the Payrails notification URL as the destination for your webhooks.
  2. Subscribe your account to the dispute webhook event types you need.
  3. Issue an HMAC signing key that Payrails will use to verify the authenticity of inbound notifications.

What to send

Reach out to your Klarna integration manager or technical point of contact with:

  • Merchant account identifier (your Klarna MID)
  • Environment (Playground or Production)
  • Notification URL copied from the Payrails Portal
  • Event subscriptions requested:
    • payment.dispute.state-change.initiated
    • payment.dispute.state-change.representment
    • payment.dispute.state-change.pre-arbitration
    • payment.dispute.state-change.arbitration
    • payment.dispute.state-change.closed
    • payment.dispute.updated
  • Request:

Please register the above URL as our notification endpoint, subscribe us to the listed dispute events, and provide the HMAC signing key so we can verify inbound webhooks


Setting up the HMAC signing key

Once you receive back the information requested in the step above, you will get back to your Payrails portal page and include the key in the corresponding field.

In Payrails

  • Paste the Signature key into the Signing keys field.

Enable the integration

In Payrails

  • Select Save account to enable the integration.

The Enabled status indicates that the Klarna integration is active.

Your Klarna integration is now ready to process chargebacks.


Next steps

  1. Run a test payment triggering a chargeback using a supported Klarna test accounts.
  2. Verify that:
    • The dispute appears in Klarna.
    • The chargeback status updates correctly in Payrails.
  3. Once verified in test mode, repeat the setup in live mode.