Download the PHP package elleracompany/commerce-klarna-checkout without Composer

On this page you can find all versions of the php package elleracompany/commerce-klarna-checkout. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package commerce-klarna-checkout

ABANDONED

Unfortunately, this plugin is no longer maintained.


Klarna Checkout for Craft Commerce

This plugin provides Klarna integrations for Craft Commerce.

Version 3.0 released 🎉

Note:

When upgrading from v1.x to v3.x please refer to UPDATE_v3.md.

Requirements

This plugin requires Craft Commerce 3.0.0 or later.

Installation

You can install this plugin 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

Contact us on [email protected] or create a new issue in GitHub.

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

  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

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

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

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

Klarna Order Complete HTML

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

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

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

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).

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

Example .env:

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.

Troubleshooting

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 https://eu.portal.klarna.com/

Development


All versions of commerce-klarna-checkout with dependencies

PHP Build Version
Package Version
Requires ext-json Version *
craftcms/cms Version ^3.4.0
craftcms/commerce Version ^3.0.0
guzzlehttp/guzzle Version ^6.5.0||^7.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package elleracompany/commerce-klarna-checkout contains the following files

Loading the files please wait ....