Search

Are you looking for test card numbers?

Would you like to contact support?

Payment-method icon

Klarna

Learn how to accept Klarna payments.

Klarna payments are popular in Sweden, and are also available in Denmark, Finland, Norway, Germany, Austria, Switzerland, the Netherlands, the United Kingdom, and the United States.

  Read more

Learn about the supported countries for Klarna on adyen.com.

With Klarna, the shopper can choose to: 

  • Pay later: Pay by invoice, after the goods have been delivered.
  • Slice it: Pay in installments over time. 
  • Pay now: Pay the whole amount instantly, either by online banking or direct debit.

Before approving the payment, Klarna performs risk checks on the shopper. If successful, Klarna takes on the full fraud risk for the payment, and pays you up front. There are no chargebacks as long as you stick to the Klarna scheme rules. For more information about the Klarna scheme rules, contact our Support Team.

Payment Type Payment flow Recurring Refunds Partial Refunds Captures Partial Captures Chargebacks
Open invoice Redirect -white_check_mark- -white_check_mark- -white_check_mark- -white_check_mark- -white_check_mark- -x-

When making a Klarna payment, you need to:

  • Provide price and product information about the purchased goods. This will be included on the invoice that Klarna sends to the shopper.
  • Capture the payment after the goods have been sent. This triggers the invoice to be sent to the shopper. 

    All Klarna payments need to be captured manually, even if you have enabled automatic capture for other payment methods. For more information, refer to Capture the Klarna payment.

    If you have a business model without physical goods, Klarna payments might not be suitable for you, or require additional configuration. For more information, contact our Support Team.

You can accept Klarna payments with: 

When using our classic Hosted Payment Pages integration, refer to our old Klarna documentation instead.

Integrate with Checkout SDKs

Our Checkout SDKs support Klarna payments without any additional configuration, however you need to provide some additional parameters in your call to the /paymentSession endpoint:

  • lineItems: Price and product information about the purchased items. This is included on the invoice that Klarna sends to the shopper.

    Klarna will only approve the payment if the amounts stated in lineItems are correct. For more information, refer to Invoice lines.

  • shopperEmail: The shopper's email address. This is where Klarna will send the invoice.
  • shopperName(optional): The shopper's full name and gender, if specified. 
  • billingAddress (optional): The postal address to be included on the invoice. 

    For improved shopper experience and conversion rates, we strongly recommend that you provide the shopperName and billingAddress.

curl -H "Content-Type: application/json" -H "X-API-Key: YourAPIkey" -X POST -d '{
       "merchantAccount":"YOUR_MERCHANT_ACCOUNT",
       "channel":"Web",
       "amount":{
          "currency":"SEK",
          "value":"1000"
       },
       "reference":"YOUR_ORDER_REFERENCE",
       "countryCode":"SE",
       "returnUrl":"https://www.yourshop.com/checkout/result",
       "shopperLocale":"en_US",
       "shopperEmail":"youremail@email.com",
       "shopperName":{
          "firstName":"Testperson-se",
          "gender":"UNKNOWN",
          "lastName":"Approved"
       },
       "shopperReference":"YOUR_UNIQUE_SHOPPER_ID",
       "billingAddress":{
          "city":"Ankeborg",
          "country":"SE",
          "houseNumberOrName":"1",
          "postalCode":"12345",
          "street":"Stargatan"
       },
       "lineItems":[
          {
             "quantity":"1",
             "amountExcludingTax":"331",
             "taxPercentage":"2100",
             "description":"Shoes",
             "id":"Item #1",
             "taxAmount":"69",
             "amountIncludingTax":"400",
             "taxCategory":"High"
          },
          {
             "quantity":"2",
             "amountExcludingTax":"248",
             "taxPercentage":"2100",
             "description":"Socks",
             "id":"Item #2",
             "taxAmount":"52",
             "amountIncludingTax":"300",
             "taxCategory":"High"
          }
       ]
}' https://checkout-test.adyen.com/v46/paymentSession

The response will contain a paymentSession. Use this to initialize the SDK. The SDK will send the shopper to Klarna to verify the payment, and back to your website or app using the returnUrl.

To complete the Klarna payment, you also need to capture it after the goods have been sent.

Integrate with API

Our API integration works the same way for all payment methods, as described in the API-only integration page. With our API integration, you can accept Klarna payments using either: 

  • Redirect to Klarna : The shopper is redirected to Klarna to complete the payment.
  • The Klarna widget:  The shopper completes the payment in your checkout. For more information about the Klarna widget, refer to Klarna documentation. If you want to use the Klarna widget contact our Support Team, as this requires some additional configuration on our end.

Step 1: Make a payment

Make a /payments API call, providing:

  • paymentMethod.type: The type of Klarna payment the shopper wants to use.  Possible values: 

    • klarna: Klarna - Pay later.
    • klarna_account: Klarna - Slice it. 
    • klarna_paynow: Klarna - Pay now.
  • shopperLocale: A combination of language code and country code to specify the language used in your checkout. 
  • countryCode: The shopper's country.

    Klarna will only approve the payment if the countryCode matches the currency
    and billingAddress provided in the request.

  • shopperEmail: The shopper's email address. This is where Klarna will send the invoice.
  • shopperReference: A unique reference to identify the shopper. 
  • returnUrl:  Required for all Klarna payment requests. The URL that the shopper is redirected to after they complete the payment.
  • lineItems: Price and product information about the purchased items. This is included on the invoice that Klarna sends to the shopper. 

    Klarna will only approve the payment if the amounts stated in lineItems are correct. For more information, refer to Invoice lines.

  • shopperName (optional): The shopper's full name and gender, if specified.
  • billingAddress (optional):  The postal address to be included on the invoice. 

    For improved shopper experience and conversion rates, we strongly recommend that you
    provide the shopperName and billingAddress.

  • additionalData.openinvoicedata.merchantData (optional): For some products or business models, Klarna might require additional information. If you need to send in this information, specify here the Base64 encoded JSON of the attachement.body value described in Klarna's documentation.
{
   "merchantAccount":"YOUR_MERCHANT_ACCOUNT",
   "reference":"YOUR_ORDER_REFERENCE",
   "paymentMethod":{
      "type":"klarna"
   },
   "amount":{
      "currency":"SEK",
      "value":"1000"
   },
   "shopperLocale":"en_US",
   "countryCode":"SE",
   "shopperEmail":"youremail@email.com",
   "shopperName":{
      "firstName":"Testperson-se",
      "gender":"UNKNOWN",
      "lastName":"Approved"
   },
   "shopperReference":"YOUR_UNIQUE_SHOPPER_ID",
   "billingAddress":{
      "city":"Ankeborg",
      "country":"SE",
      "houseNumberOrName":"1",
      "postalCode":"12345",
      "street":"Stargatan"
   },
   "returnUrl":"https://www.yourshop.com/checkout/result",
   "lineItems":[
      {
         "quantity":"1",
         "amountExcludingTax":"331",
         "taxPercentage":"2100",
         "description":"Shoes",
         "id":"Item #1",
         "taxAmount":"69",
         "amountIncludingTax":"400",
         "taxCategory":"High"
      },
      {
         "quantity":"2",
         "amountExcludingTax":"248",
         "taxPercentage":"2100",
         "description":"Socks",
         "id":"Item #2",
         "taxAmount":"52",
         "amountIncludingTax":"300",
         "taxCategory":"High"
      }
   ],
   "additionalData" : {
     "openinvoicedata.merchantData" : "eyJjdXN0b21lcl9hY ... "
   }
}

The response to your /payments call depends on whether you are using a redirect to Klarna, or the Klarna widget.

Step 2: Complete the payment

The steps for completing the Klarna payment depend on whether you are using:

Redirect to Klarna

The response to your  /payments call contains: 

  • resultCodeRedirectShopper

  • paymentData: Value that you need to submit to the /payments/details endpoint later. 

  • redirect: Object containing a url.

    {
       "resultCode":"RedirectShopper",
       "details":[
          {
             "key":"redirectResult",
             "type":"text"
          }
       ],
       "paymentData":"abcxyz...",
       "redirect":{
          "method":"GET",
          "url":"https://test.adyen.com/hpp/skipDetails.shtml?billingAddress. ..."
       }
    }
  1. Redirect the shopper to the URL specified at  redirect.url

    The shopper is redirected to Klarna. After approving the payment, they are redirected back to your website or app using the returnUrl that you specified in the /payments call . This is appended with a redirectResult:

    https://your-company.com/done?redirectResult=xyzabc...
  2. Verify the result of the payment by making a /payments/details call, providing: 

    • redirectResult: You received this in the previous step.   

    • paymentData:  The value from the response to your /payments call. 
    {
       "paymentData":"abcxyz...",
       "details":{
          "redirectResult" : "xyzabc..."
       }
    }

    The response contains a pspReference, which is our unique identifier for this payment, and a resultCode

  3. Use the resultCode to present the payment result to your shopper via your website or app. For more information on how to handle the resultCode, refer to Result codes.

  4. After the goods have been sent, you also need to capture the payment.

The Klarna widget

The response to your  /payments call contains: 

  • resultCodePending

  • paymentData: A value that you need to submit to the /payments/details endpoint later. 

  • redirect: An object containing a client token.
{
   "resultCode":"Pending",
   "details":[
      {
         "key":"token",
         "type":"text"
      }
   ],
   "paymentData":"abcxyz...",
   "redirect":{
      "data":{
         "klarnapayments.client_token":"eyJhbGciOiJu ..."
      }
   }
}
  1. Use the client token to populate the Klarna widget. 
    This opens an iframe where the shopper has to enter their details. 
  2. After the shopper has submitted the details, you will receive an authorization_token. For more information about the authorization_token, refer to Klarna documentation.
  3. Verify the result of the payment by making a /payments/details call, providing: 

    • authorization_token: You received this in the previous step.     

    • paymentData: The value from the response to your /payments call. 
    {
       "paymentData":"abcxyz...",
       "details":{
          "token":"eba4d492-ddd4-6dd3-ad31-5ba2ad6a86d0"
       }
    }

    The response contains a pspReference, which is our unique identifier for this payment, and a resultCode

  4. Use the resultCode to present the payment result to your shopper via your website or app. For more information on how to handle the resultCode, refer to Result codes.

    If a shopper completed the payment but failed to return to your website or app, you will receive the outcome of the payment in an AUTHORISATION notification.
  5. After the goods have been sent, you also need to capture the payment.

Klarna result codes

The resultCode values you can receive for Klarna are:

resultCode Description Action to take
Authorised The payment was successful. Inform the shopper that the payment was successful. After the goods have been sent, you also need to capture the payment.
Cancelled The shopper cancelled the payment. Ask the shopper whether they want to continue with the order, or request that they select a different payment method.
Refused The payment was refused by Klarna, as it didn't pass their risk checks. Ask the shopper to try the payment again using a different payment method.

When a payment is refused by Klarna, the shopper sees the following message:

When processing Klarna payments in the United States, you can also receive a Pending result code:

resultCode Description Action to take
Pending Klarna has not confirmed the final status of the payment yet, for example because of suspected fraud. If the payment is not authorised within 24 hours, it is automatically cancelled. Inform the shopper that you've received their order, and are waiting for the payment to be completed.
To know the final result of the payment, wait for the AUTHORISATION notification.

If you'd like pending Klarna payments to be cancelled immediately, contact our Support Team.

If you have set pending Klarna payments to be cancelled immediately, you will receive for such payments a notification with:

  • eventCode: AUTHORISATION
  • success: false

Capture the Klarna payment

All Klarna payments have to be manually captured, even if you have enabled automatic capture for other payment methods. Capturing the payment is what triggers the invoice to be sent to the shopper.

If you can guarantee that goods are shipped within 24 hours of capturing the payment, our Support Team can also set up automatic capture for Klarna payments.

Partial captures

To partially capture a Klarna payment, specify in your call to the /capture  endpoint:

  • modificationAmount: The amount that the shopper should pay. 
  • additionalData.openinvoicedata: Price and product information for the items that the shopper should pay for, to be included on the invoice. For the partial capture to be successful, the amounts stated in openinvoicedata need to be correct. For more information, refer to Invoice lines.

Our Support Team can also set up multiple partial captures for Klarna payments. Multiple partial captures will create a new invoice for each capture. 

{
   "merchantAccount":"YOUR_MERCHANT_ACCOUNT",
   "modificationAmount":{
      "currency":"SEK",
      "value":"400"
   },
   "originalReference":"8825408195409505",
   "additionalData":{
      "openinvoicedata.numberOfLines":"1",
      "openinvoicedata.line1.currencyCode":"SEK",
      "openinvoicedata.line1.description":"Shoes",
      "openinvoicedata.line1.itemAmount":"331",
      "openinvoicedata.line1.itemVatAmount":"69",
      "openinvoicedata.line1.itemVatPercentage":"2100",
      "openinvoicedata.line1.numberOfItems":"1",
      "openinvoicedata.line1.vatCategory":"High"
   }
}

You will receive a /capture response containing a pspReference associated with this request. Once we have processed your request, you will also receive a CAPTURE notification. For more information, refer to Capture.

Refunds and cancellations

If a Klarna payment has not yet been captured, you can cancel it. If the Klarna payment has already been captured and you want to return the funds to the shopper, you need to refund it.

Partial refunds

To partially refund a Klarna payment, specify in your call to the /refund endpoint:

  • modificationAmount: The amount to be refunded to the shopper.
  • additionalData.openinvoicedata(optional): Price and product information about the returned items. This is included on the invoice that Klarna sends to the shopper. For more information, refer to Invoice lines.

    For improved shopper experience, we recommend that you provide the openinvoicedata.

{
   "merchantAccount":"YOUR_MERCHANT_ACCOUNT",
   "modificationAmount":{
      "currency":"SEK",
      "value":"400"
   },
   "originalReference":"8825408195409505",
   "additionalData":{
      "openinvoicedata.numberOfLines":"1",
      "openinvoicedata.line1.currencyCode":"SEK",
      "openinvoicedata.line1.description":"Shoes",
      "openinvoicedata.line1.itemAmount":"331",
      "openinvoicedata.line1.itemVatAmount":"69",
      "openinvoicedata.line1.itemVatPercentage":"2100",
      "openinvoicedata.line1.numberOfItems":"1",
      "openinvoicedata.line1.vatCategory":"High"
   }
}

You will receive a /refund response containing a pspReference associated with this request. Once we have processed your request, you will also receive a REFUND notification. For more information, refer to Refund.

Invoice lines

When you make a Klarna payment, or request a partial capture or a partial refund, you need to provide price and product information to be included on the invoice.

For a payment request, include this information in lineItems. For more information about the required fields, refer to our API Explorer.

{
   "amount":{
      "currency":"SEK",
      "value":"1000"
   },
   "lineItems":[
      {
         "quantity":"1",
         "amountExcludingTax":"331",
         "taxPercentage":"2100",
         "description":"Shoes",
         "id":"Item #1",
         "taxAmount":"69",
         "amountIncludingTax":"400",
         "taxCategory":"High"
      },
      {
         "quantity":"2",
         "amountExcludingTax":"248",
         "taxPercentage":"2100",
         "description":"Socks",
         "id":"Item #2",
         "taxAmount":"52",
         "amountIncludingTax":"300",
         "taxCategory":"High"
      }
   ]
...
}

For a partial capture or a partial refund request, include this information in the openinvoicedata fields of additionalData. For more information about the required fields, refer to our API Reference.

{
   "modificationAmount":{
      "currency":"SEK",
      "value":"1000"
   },
   "additionalData":{
      "openinvoicedata.numberOfLines":"2",
      "openinvoicedata.line1.currencyCode":"SEK",
      "openinvoicedata.line1.description":"Shoes",
      "openinvoicedata.line1.itemAmount":"331",
      "openinvoicedata.line1.itemVatAmount":"69",
      "openinvoicedata.line1.itemVatPercentage":"2100",
      "openinvoicedata.line1.numberOfItems":"1",
      "openinvoicedata.line1.vatCategory":"High"
      "openinvoicedata.line2.currencyCode":"SEK",
      "openinvoicedata.line2.description":"Socks",
      "openinvoicedata.line2.itemAmount":"248",
      "openinvoicedata.line2.itemVatAmount":"52",
      "openinvoicedata.line2.itemVatPercentage":"2100",
      "openinvoicedata.line2.numberOfItems":"2",
      "openinvoicedata.line2.vatCategory":"High"
   }
...
}

For Klarna to approve the payment, the value specified in the amount (or modificationAmount) has to match the total amount of the invoice lines. To calculate the total amount of the invoice lines, refer to the following pseudo-code:

When using lineItems:

total = 0;

for each (invoiceLine in lineItems) {
  total += (amountExcludingTax + taxAmount) * quantity;
}

totalValue = total;

When using openinvoicedata:

The itemAmount field should contain the amount excluding tax.

total = 0;

for each (openinvoicedata.line) {
  total += (itemAmount + itemVatAmount) * numberOfItems;
}

totalValue = total;

In the example above: (331 + 69) * 1 = 400, and (248 + 52) * 2 = 600, so totalValue = 400 + 600 = 1000.

Recurring payments

To make recurring payments, you first need to create a shopper token and then make subsequent recurring transactions with the token.

For more information and detailed instructions, refer to Tokenization.

Test and go live

Before accepting live Klarna payments, test your integration using the test details provided in the Klarna documentation

Before you go live:

Make sure that:

  • You consider Klarna's legal and privacy information.
  • You follow the Klarna guidelines on how to display Klarna in your checkout.
  • The invoice lines and VAT are displayed correctly on Klarna's pages.
  • If a shopper gets rejected by Klarna, you offer them another payment method.
  • You pass the shopper's name and address in your payment request. While optional, providing these parameters improves the shopper experience and increases conversion rates.

See also