Documentation You are here: start » gateways » klarna
type:
gateway
name:
Klarna
countrie:
AT, AU, BE, CA, CH, DE, DK, ES, FI, FR, GB, IT, NL, NO, NZ, SE, US
support-added:
2.0
gateway:
https://www.klarna.com

Klarna

Setting Up Klarna for FoxyCart

Klarna offer a few different integration types. Foxy's integration uses the Klarna Payments account type, which Klarna may also refer to as One Klarna/Klarna One - so you will need to ensure you have that account type when integrating with Foxy. If you're not sure what account type you have with Klarna, we'd recommend reaching out to the Klarna support team to confirm.

Klarna has let us know that since the Foxy integration is considered a custom integration you'll need to let them know that when you are setting up your account. There is no option to specify this in the online setup process with Klarna, so you will need to reach out to them.

Subscriptions are not supported with Klarna at this time. If you intend to sell subscriptions with your FoxyCart store, you will also need to make use of another payment gateway that does.

To connect Klarna to your Foxy store, follow these steps:

  1. Log in to your Klarna account portal
  2. From the dashboard, select “Settings”. This should take you to the “API Credentials” section, but if not, click that in the left hand navigation.
  3. Click the “Generate new API credentials” button. If you already have existing API credentials for your account, you'll be asked to confirm you want to create new ones.
  4. A window will be displayed with your new API credentials. Copy these to a text file on your computer temporarily - especially the “Password” as this is the only time you'll have access to this value.
  5. Log in to your store's Foxy administration and head to the “Payments” section
  6. Ensure the payment servers are switched to “Live Servers” at the top of the page.
  7. Enable “Accept payments using your Klarna Payments account”, and enter the API credentials you just copied into the respective fields. Make sure you also select the correct region for your store in the “merchant account continent” dropdown.
  8. Save your payment settings.

At this time, Klarna has been activated for your store!

Klarna payment options are presented to the customer based on the currency of the cart and their location. Here's an example of options presented for a Norwegian customer:

Using EMD (Extra Merchant Data)

If you're selling specific product types, Klarna may require that you pass in Extra Merchant Data, as outlined in their docs: https://docs.klarna.com/klarna-checkout/popular-use-cases/extra-merchant-data/

Foxy currently supports the “event” EMD, which must be passed in as a product-specific value with the product option name of klarna_emd_event and a JSON value. In a link (unsigned), it might look like this:

<a href="https://foxy-demo.foxycart.com/cart?name=Prod1&price=5&code=sku1&klarna_emd_event=%7B%22event_company%22%3A%22Executive%20Education%20-%20Business%20Analytics%20Program%22%2C%22start_time%22%3A%222021-11-01T09%3A00%3A00Z%22%2C%22end_time%22%3A%222022-02-01T09%3A00%3A00Z%22%7D">
  Add to Cart
</a>

The value of the klarna_emd_event is URL encoded JSON that looks like this:

{
  "event_company": "Executive Education - Business Analytics Program",
  "start_time": "2021-11-01T09:00:00Z",
  "end_time": "2022-02-01T09:00:00Z"
}

(Note that you don't technically need to URL encode the JSON, but it is required if you use the HMAC signing functionality, and since most people and systems use double-quotes to wrap the href value, you will actually need to URL encode it.)

You'll also need to set the klarna_emd_event product option to hidden, in your store's template configuration, under the “Customize Cart Display” section. That will prevent the value from displaying to your customers on the cart.

Testing

Note that while in test mode, Klarna only show a restricted list of payment methods. There may be some payment methods that you expect to see based on your location, but are only available when using a live account. If you're not sure, you can contact Klarna support to see if the specific payment method you're looking for will display in test mode or not.

Obtaining a Test Account

Follow the notes on the Klarna documentation for creating a test account: https://docs.klarna.com/resources/test-environment/

Test Card Numbers

Contact klarna for info. Know more? Feel free to edit this page with info.

Troubleshooting & Interpreting Response Codes

Contact klarna for info. Know more? Feel free to edit this page with info.

Important Notes and Caveats

  • Our Klarna integration does not support subscriptions at this time.
  • Klarna only support specific locales and currencies in specific countries. For example, for a customer in the US Klarna only supports en_US and USD, in Germany they support de-DE and en-DE with a currency of EUR. More details here.

User Notes and Experiences

If you have tips, experience, or helpful notes related to this gateway that would benefit others, please add them below, including your name and the date. We reserve the right to edit or remove comments that don't add value to this page.

Site Tools