PHPackages                             elleracompany/commerce-klarna-checkout - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. elleracompany/commerce-klarna-checkout

AbandonedCraft-plugin[Payment Processing](/categories/payments)

elleracompany/commerce-klarna-checkout
======================================

Klarna Checkout integration for Craft Commerce 2

3.1.2(4y ago)11.1k5[6 issues](https://github.com/elleracompany/commerce-klarna-checkout/issues)proprietaryPHPCI failing

Since Feb 27Pushed 2y ago2 watchersCompare

[ Source](https://github.com/elleracompany/commerce-klarna-checkout)[ Packagist](https://packagist.org/packages/elleracompany/commerce-klarna-checkout)[ RSS](/packages/elleracompany-commerce-klarna-checkout/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (3)Versions (35)Used By (0)

ABANDONED
=========

[](#abandoned)

Unfortunately, this plugin is no longer maintained.

---

[![Version 3.0](src/banner.png)](src/banner.png)

Klarna Checkout for Craft Commerce
==================================

[](#klarna-checkout-for-craft-commerce)

This plugin provides [Klarna](https://www.klarna.com) integrations for [Craft Commerce](https://craftcms.com/commerce).

Version 3.0 released 🎉
======================

[](#version-30-released-)

- Now with support for Europe 🇪🇺 North America 🇺🇸 and Oceania 🇦🇺 !
- Choose between rendering Klarna and using redirect payments
- Add external payment methods and checkouts

\##Note:

**When upgrading from v1.x to v3.x please refer to [UPDATE\_v3.md](UPDATE_v3.md)**.

Requirements
------------

[](#requirements)

This plugin requires Craft Commerce 3.0.0 or later.

Installation
------------

[](#installation)

You can install this plugin from the Plugin Store.

#### From the Plugin Store

[](#from-the-plugin-store)

Go to the Plugin Store in your project’s Control Panel and search for “Klarna Checkout”. Then click on the “Install” button in its modal window.

Support
-------

[](#support)

Contact us on  or create a new issue in [GitHub](https://github.com/elleracompany/commerce-klarna-checkout/issues).

You can also reach us by messaging @Jorgen on Discord.

The plugin logs errors and transactions to `@storage/logs/klarna-checkout.log` or `@storage/logs/klarna-hpp.log`. Please provide the relevant logs when reaching out.

Setup
-----

[](#setup)

1. Make sure you have set the store location in `Commerce -> Store Settings -> Store Location`
2. and Base URL in `Settings -> Sites -> sitename -> Base URL`.
3. Install the plugin.
4. Navigate to `Commerce -> System Settings -> Gateways` and `+ New Gateway`
5. Select Klarna Checkout or Klarna Hosted Payment Page from the dropdown.
6. Set your information Playground credentials in API Credentials Europe Test Username (UID)/Test Password.
7. Get Klarna Production Approval for your site
8. Turn off "Testing Mode" and add production credentials for the Gateway

#### Klarna Checkout: Payment button

[](#klarna-checkout-payment-button)

Since Klarna Checkout is rendering its own payment button, the craft-commerce default 'Pay' button must be removed. You can copy and overwrite your shop default `checkout/payment.html` file with `vendor/ellera/commerce-klarna-checkout/src/templates/pages/checkout/payment.html` or simply update your existing template with

```
{% if cart.gateway.handle is not same as('klarna') %}
    Pay {{ cart.totalPrice|commerceCurrency(cart.paymentCurrency,convert=true) }}
{% endif %}

```

#### Klarna Hosted Payment Page

[](#klarna-hosted-payment-page)

For hosted payment pages the 'Pay' button is required to send the user to Klarna. When selecting Logo and Background images for Klarna HPP it is important that the Image asset is in a web accessible Volume.

#### Get Klarna Approval

[](#get-klarna-approval)

You need approval from klarna before you can change to production mode.

#### Klarna Order Complete HTML

[](#klarna-order-complete-html)

To render the Klarna Order Complete HTML you can use this code in your `shop/customer/order` template:

```
    {% if order.gateway.handle is same as('klarna') and order.gateway.hasHtml %}
        {{ order.gateway.getHtml(order.id)|raw }}
    {% else %}
        // Regular thank-you-page
    {% endif %}

```

*Note: The Klarna OrderID is stored in the PHP session and the HTML is fetched from Klarna APIs. `order.gateway.hasHtml` will check that the session exist, and if not you can render the regular thank-you-page.*

#### VAT and Taxes

[](#vat-and-taxes)

Klarna requires tax to be sent per order line, not on the order in total, so for VAT and Taxes to be passed along to Klarna correctly, the taxable subject must be set to "Line item price". If the shipping cost is taxable as well, you need to create a separate tax rate for shipping and set that to "Order total shipping cost"

#### Using environment variables

[](#using-environment-variables)

UID, Password and Test Mode options can be controlled with environment variables. Add environment variables to your .env files and reference them in the settings page (Read more in the [documentation](https://docs.craftcms.com/v3/config/environments.html#control-panel-settings)).

The Test Mode setting can also be controlled with an environment variable, but this format is strict. Use `KLARNA_TEST_MODE_` where is the gateway handle.

Example .env:

```
# Klarna
KLARNA_TEST_UID="PKXXX_XXXXXXXXXX"
KLARNA_TEST_PWD="XXXXXXXXXXXXXX"
KLARNA_PROD_UID="PKXXX_XXXXXXXXXX"
KLARNA_PROD_PWD="XXXXXXXXXXXXXX"
KLARNA_TEST_MODE_klarnaCheckout="true"

```

### Formatting / changing the address

[](#formatting--changing-the-address)

If your set-up uses different fields for the addresses in Commerce, for instance when you store the house number separately from the streetname, you can hook into the address formatter to change the format before it gets sent to Klarna.

The FormatAddressEvent contains two parameters, the `address` parameter that contains the formatted address and the `sourceAddress`, which contains the source Address model.

```
    use ellera\commerce\klarna\gateways\Base as KlarnaGateway;

    Event::on(
        KlarnaGateway::class,
        KlarnaGateway::EVENT_FORMAT_ADDRESS,
        function(FormatAddressEvent $event) {
            $event->address['street_address'] = "{$event->sourceAddress->address1} {$event->sourceAddress->address3}";
        }
    );

```

Troubleshooting
---------------

[](#troubleshooting)

#### I get 401 or 403 response when I turn off Test Mode

[](#i-get-401-or-403-response-when-i-turn-off-test-mode)

You need approval from Klarna before your account is approved for production.

Look for the "Resume onboarding" link under the menu on

Development
-----------

[](#development)

- Add support for project sync (project.yaml)

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 98.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~31 days

Recently: every ~54 days

Total

33

Last Release

1624d ago

Major Versions

1.1.6 → 2.0.0-BETA2020-02-07

1.1.12 → 3.0.0-beta.12020-06-12

1.1.14 → 3.0.02021-01-15

### Community

Maintainers

![](https://www.gravatar.com/avatar/a2533cc86e420303144dab877a59ab25997b89ab972c382357908033ce1b9aaf?d=identicon)[jellingsen](/maintainers/jellingsen)

---

Top Contributors

[![jellingsen](https://avatars.githubusercontent.com/u/14084128?v=4)](https://github.com/jellingsen "jellingsen (196 commits)")[![matternow](https://avatars.githubusercontent.com/u/47116649?v=4)](https://github.com/matternow "matternow (2 commits)")[![RogerDelorean](https://avatars.githubusercontent.com/u/1769538?v=4)](https://github.com/RogerDelorean "RogerDelorean (1 commits)")

---

Tags

yii2klarnacraftcmscommercekco

### Embed Badge

![Health badge](/badges/elleracompany-commerce-klarna-checkout/health.svg)

```
[![Health](https://phpackages.com/badges/elleracompany-commerce-klarna-checkout/health.svg)](https://phpackages.com/packages/elleracompany-commerce-klarna-checkout)
```

###  Alternatives

[craftcms/commerce-stripe

Stripe integration for Craft Commerce 5.0+

32157.4k3](/packages/craftcms-commerce-stripe)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
