VibeFox Klarna for OpenCart — Help
Requirements
OpenCart: 3.0.x (tested on 3.0.5.0) or 4.0.2 and later (tested on 4.1.0.3).
PHP: 8.0 or later.
Klarna merchant account: you need the Klarna API credentials (username and password) of your merchant account for one API region, and test credentials from the Klarna playground portal (see Configuration). Each API region has its own credentials. Only one merchant account (one API region) can be used per store.
Currency: a Klarna currency of your region: EUR, SEK, NOK, DKK, GBP, CHF, PLN, CZK, HUF or RON in Europe; USD, CAD or MXN in North America; AUD or NZD in Oceania. The currency must exist in System > Localisation > Currencies.
VibeFox license key: bought on vibefox.net. One key works on one domain.
Installation
The download is one zip file with the packages for both OpenCart versions. Unpack it on your computer. It contains README.txt, the OpenCart 3 package wcp_klarna_payment-oc3-(version).ocmod.zip and the OpenCart 4 package wcp_klarna_payment.ocmod.zip. Install only the package for your OpenCart version. The license key is the same for both versions.
OpenCart 3
1. In the admin go to Extensions > Installer, click Upload and choose the file wcp_klarna_payment-oc3-(version).ocmod.zip. The extension has no OCMOD modifications, so Extensions > Modifications does not need a refresh. Instead of the installer you can copy the contents of the upload folder of this package into the root folder of your store.
2. Go to Extensions > Extensions and choose the type Payments. Find VibeFox Klarna Payments and click Install (the green + button). Your admin user needs the right to modify the payment extensions list.
3. Click Edit (the pencil button) to open the settings page. Paste your VibeFox license key into License key in the license block at the top of the page and click Activate (see License key).
4. Choose the API region of your Klarna merchant account.
5. Enter the test username and password from the Klarna playground portal, keep Test mode on, turn on Enable/Disable, click Save and place a test order.
6. Enter the live username and password from the Klarna Merchant Portal, turn off Test mode and choose when orders are captured (default: when the order is shipped or completed).
OpenCart 4
1. In the admin go to Extensions > Installer, click Upload and choose the file wcp_klarna_payment.ocmod.zip. Do not rename the file: OpenCart 4 takes the extension code from the file name, and a renamed package does not work.
2. The package appears in the list of installed extensions on the same page. Click Install (the green + button) next to it.
3. Go to Extensions > Extensions and choose the type Payments. Find VibeFox Klarna Payments, click Install (the green + button), then Edit (the pencil button).
4. Enter the license key, the API region, the credentials and the capture mode as in steps 3 to 6 for OpenCart 3. The settings page and its fields are the same in both versions. Only the notification URL is different (see Notifications).
A new install starts with the payment method turned off and test mode on. The notification URL is sent with every Klarna order, so nothing needs to be configured in Klarna.
Configuration
All settings are on the extension page: Extensions > Extensions > Payments > VibeFox Klarna Payments > Edit. The sections are listed on the left; the Save button under the list saves the whole page. Above the settings the page shows TEST MODE: Klarna playground, no real payments. or LIVE: real Klarna payments. It warns you when the username or password of the active mode is missing (Klarna is then hidden at checkout) and when the default currency of the store is not sold by Klarna in the selected API region. Without the right to modify the extension the page shows the settings but cannot save them.
When you save, Title must not be empty (at most 128 characters), Sort Order must be a whole number (negative numbers are allowed), Total a number, 0 or greater, and the API region, capture mode, geo zone and order statuses must be valid. Otherwise nothing is saved and the page names the field. Missing credentials do not block saving.
Klarna Payments
Enable/Disable: turns the payment method on or off. Default: off. Klarna is shown at checkout only when the username and password of the active mode are filled in and the customer's billing country is a Klarna market of the API region, paying in that country's currency.
Title: the payment method name customers see at checkout. It is also the payment method name stored in the order. Default: Klarna. Required.
Description: the text shown to the customer on the Confirm Order step, above the Klarna widget. Default: Pay now, later or in instalments with Klarna.
Sort Order: the position of Klarna among the payment methods at checkout. Leave it empty or enter a whole number.
Geo Zone: offer Klarna only for payment addresses in the selected geo zone. Default: All zones. Geo zones are set up in System > Localisation > Geo Zones.
Total: the checkout total, in the default currency of the store, that an order must reach before Klarna is offered. Leave it empty to offer Klarna for any total.
API credentials
Klarna API credentials (username and password) are created in the Klarna Merchant Portal under Settings > Klarna API credentials (the section links there). Test credentials come from the playground portal: one for Europe, one for North America and Oceania. Each API region has its own credentials.
Test mode: uses the Klarna playground (test credentials, no real payments). Default: on. While test mode is on, customers see TEST MODE: Klarna playground, no real payment is made. at the Confirm Order step. Orders keep the environment they were placed in: captures and refunds of playground orders always use the test credentials.
API region: the region of your Klarna merchant account. Customers can pay with Klarna only from the countries of this region, in the currency of their country. The country is taken from the payment address of the order.
Live username (UID): the production API username, for example PK12345_abcdef012345.
Live password: the production API password (shared secret).
Test username (UID): the playground API username.
Test password: the playground API password (shared secret).
Saved passwords are never shown again. The field stays empty and shows Saved — leave empty to keep it. Type a new value only to change it. To remove a saved password, tick Clear the saved password on save under the field and click Save.
Order management
A placed Klarna order is an authorization: the customer is charged only when the order is captured. Uncaptured authorizations expire, usually after 28 days, so ship orders in time or use auto capture.
Capture: when the customer is charged. Refunds are possible only for captured amounts.
Cancellation: cancels the Klarna order (releases the authorization) when a not yet captured order is set to the Canceled Status below. Default: on.
Order statuses
OpenCart creates the order at the Confirm Order step without a status (a missing order). It gets a status only after Klarna has placed the Klarna order for the purchase approved in the widget. A purchase Klarna does not approve leaves the order without a status, and the customer stays at the Confirm Order step. Each field below lists your OpenCart order statuses.
Order Status After Payment: Klarna accepted the purchase (fraud status ACCEPTED). The money is authorized and captured according to Capture. Default: Processing.
Awaiting Fraud Review Status: Klarna placed the order as PENDING (fraud review). Do not ship until Klarna's notification accepts it; the order is updated automatically. Default: Pending.
On Hold Status: Klarna returned an unexpected fraud status, or the amount or currency reported by Klarna did not match the order. A note explains what to check. Default: Pending.
Payment Error Status: Klarna rejected or stopped the purchase after the fraud review. Do not ship the order. Default: Failed.
Canceled Status: setting a not yet captured order to this status cancels the Klarna order (see Cancellation). Klarna reporting the Klarna order as cancelled, expired or closed sets it. Default: Canceled.
Refunded Status: the captured amount was fully refunded in the Klarna tab of the order page. Partial refunds only add a note. Default: Refunded.
OpenCart has no own statuses for a fraud review or a payment on hold. You can create them in System > Localisation > Order Statuses and select them here.
Notifications
Klarna reports the result of a fraud review (orders placed as pending) to the address shown in Notification URL. On OpenCart 3 it looks like https://your-store/index.php?route=extension/payment/wcp_klarna_payment/notification, on OpenCart 4 like https://your-store/index.php?route=extension/wcp_klarna_payment/payment/wcp_klarna_payment.notification. The URL is sent with every order automatically, so there is nothing to configure in Klarna. The notification body is never trusted: each notification is verified with the Klarna Order Management API, with the credentials of the environment and region the order was placed in, and the Klarna order must refer to this order number. The extension acts on what Klarna reports:
If Klarna accepts a purchase after you canceled or refunded the order, the order is not reopened and the Klarna authorization is released. The notification works while the store is in maintenance mode: OpenCart 3 lets payment extension requests through, and on OpenCart 4 the extension adds a startup action that lets the notification and the customer's return from Klarna through.
Advanced
Debug log: logs API calls and payment events to wc_kl_debug.log.php in the OpenCart logs folder (storage/logs). The file cannot be opened from the web. Errors are always logged. The log never contains credentials, authorization tokens or customer data. Default: off.
Log: shows the size and the latest entries of the log. Click Clear log to empty it.
Delete data on uninstall: when on, uninstalling the extension removes the gateway settings, the log and the temporary widget sessions. Order data (Klarna order IDs, refunds) is always kept. Default: off.
Import / Export
Export: Download JSON saves the settings as a JSON file. Passwords are not exported.
Import: paste previously exported JSON and click Import to restore the settings. Saved passwords are kept.
Checkout
At the Payment Method step the customer chooses the payment method (by default Klarna). OpenCart creates the order at the Confirm Order step, still without a status. At this step the customer sees the Klarna badge, your description and the Klarna widget. The extension creates the Klarna session on the server from that order: products with their options, gift certificates, shipping, coupon, voucher and reward point discounts, taxes and addresses. In the widget the customer picks pay now, pay later or instalments, as Klarna offers them. When the customer clicks Confirm Order, Klarna authorizes the purchase in the widget, and the extension places the Klarna order server-side with the data of the OpenCart order. The Klarna order carries the OpenCart order number as the merchant reference.
On OpenCart 4 the customer picks the payment method with the Choose button of the payment method block, in the window Payment method options. The Klarna widget then appears in the order confirmation block at the bottom of the checkout page, above the Confirm Order button. OpenCart 4 has no gift certificates, so none are sent to Klarna. By default OpenCart 4 does not ask for a payment address; the extension then uses the shipping address as the billing address and its country as the purchase country.
The result depends on the Klarna fraud status:
If Klarna cannot accept the order, the customer stays at the Confirm Order step with a short message, for example Klarna could not accept this order. Please check your billing details or choose another payment method., Klarna did not respond. Please try again in a moment. or, when the authorization has expired, a request to click "Confirm Order" again. The details are written to the log and the order gets a note. If the customer's country and currency do not match a Klarna market of your region, the customer sees Klarna is not available for your billing country and currency. Please choose another payment method.
Clicking twice, reloading the page or paying the same cart in a second browser tab never places a second Klarna order (OpenCart 3 creates a new order every time the Confirm Order step is shown; OpenCart 4 updates the order of the checkout, so after a rejected purchase the customer pays the same order). If Klarna approved the purchase but the order status could not be set, the customer sees Your Klarna purchase was approved, but the order could not be completed automatically. Please contact us — do not pay again. The next attempt or Klarna's notification sets the status from the stored Klarna order without a new authorization. A change of the cart, including a new quantity, counts as a new cart that needs its own payment.
OpenCart 4 keeps the order in the checkout until the success page is shown. If that order was closed without a payment meanwhile (for example you cancelled it), the customer is sent back to the checkout with Your previous order was cancelled without a payment. Please confirm the order again to pay with a new order. If the order is already placed and the cart has changed, the message is Your previous order #(number) has already been placed. Your cart has changed: please confirm the new order to pay for it. In both cases the next Confirm Order pays a new order of the cart. These messages are shown above the checkout page.
The extension has no Klarna Checkout (KCO, full checkout replacement), Klarna Express Checkout buttons, On-site messaging or Sign in with Klarna, no subscriptions or saved payment methods, and no partial captures per order line. Order lines are not sent to Klarna again when you edit an order after it was placed.
Orders and refunds
Order statuses
No status (missing order): the customer has not completed the Klarna authorization, or Klarna rejected the purchase. In Sales > Orders such orders are shown only with the filter Order Status set to Missing Orders.
Order Status After Payment (default Processing): Klarna accepted the purchase. A note shows the Klarna order ID and when it will be captured.
Awaiting Fraud Review Status (default Pending): the purchase is pending Klarna's fraud review. Klarna's notification moves the order to Order Status After Payment, Payment Error Status or Canceled Status.
On Hold Status (default Pending): Klarna returned an unexpected fraud status, or the amount or currency reported by Klarna did not match the order. The note explains it. Check the order in the Klarna Merchant Portal.
Payment Error Status (default Failed): Klarna rejected or stopped the purchase after the fraud review. Do not ship the order.
Canceled Status (default Canceled): you canceled the order, or Klarna reports the Klarna order as cancelled, expired or closed. With Cancellation on, canceling a not yet captured order cancels the Klarna order and releases the authorization, so the customer is not charged. An order that is already captured is not cancelled at Klarna: refund it to return the money.
Refunded Status (default Refunded): the captured amount was fully refunded through the extension.
Notes are entries in the order History that the customer does not see. They start with the word Klarna.
Capture
With When the order is shipped / completed, changing the status of an order in Sales > Orders (Add History) to a completed status captures the order total before the new status is saved. If Klarna refuses the capture, for example because the order total grew above the amount still authorized after you edited the order, the status is not changed, no e-mail is sent, and the order page shows the reason instead of the success message. A note says that the customer has NOT been charged. Fix the problem and change the status again to retry, or capture in the Klarna Merchant Portal and switch Capture to manual. A successful capture adds a note with the captured amount and the capture ID. The first status of a new order and a change from one completed status to another do not capture. Captures and cancellations keep working while the extension is installed but turned off. On OpenCart 4.1 the refused status change shows the reason on the order page too; on OpenCart 4.0.x the status is refused as well, but the reason is shown only in the note of the order history.
VibeFox Klarna Payments tab
In Sales > Orders open an order paid with Klarna. At the bottom of the order page, next to History and Additional, the VibeFox Klarna Payments tab shows the Klarna order ID with its environment and region, a Playground label for test orders, the fraud status and Klarna status, the Authorized amount, the Captured / refunded amounts, the refund form, the refund history and the Klarna notes of the order. The tab is shown to users who have access to the extension.
Refunds
In the VibeFox Klarna Payments tab enter the Amount (the amount not refunded yet is filled in), optionally a Reason (optional), and click Refund via Klarna. Confirm the question Refund this amount through Klarna? This cannot be undone. Full and partial refunds are supported for captured amounts, up to what Klarna reports as captured minus already refunded. You need the right to modify the extension (set in System > Users > User Groups). The refund is sent to the environment and region the order was placed in, so the credentials of that environment must be set. If Klarna does not accept the refund, the tab shows the error and no refund is recorded. A successful refund is added to the refund history and the notes with the Klarna refund ID. A full refund sets the order to Refunded Status without notifying the customer and without returning products to stock, like a manual status change. A partial refund does not change the status. A retried refund is never made twice.
An order that was not captured yet cannot be refunded: cancel it instead to release the authorization. With Capture set to manual the store does not know what you captured in the Klarna Merchant Portal. The refund form is then shown with an empty amount, and Klarna checks the amount when you submit it.
Product returns in Sales > Returns do not send money back through Klarna. Refunds made in the Klarna Merchant Portal are not added to the tab, but they count toward the amount Klarna still allows to refund.
License key
The extension works with a VibeFox license key from vibefox.net. The license block License — VibeFox Klarna Payments is the first block on Extensions > Extensions > Payments > VibeFox Klarna Payments > Edit, above the settings. Paste the key into License key and click Activate. After that the block shows the key masked, the status (for example the date the license is active until and your domain) and the buttons Check now to check the status again, Change key to enter another key and Remove key to remove the key from this store. Below them are the line Product: opencart-payment-klarna and the link Manage licenses and domains in your account, which opens your vibefox.net account. Only admin users with the Modify permission for the extension can change the key. The texts of the block follow the admin language (English and Russian are included).
If the key is not accepted, the block says why, for example Key not found, This key belongs to another product, Domain limit reached or License expired on a date. After the store address changes, or after you free a domain slot in your account, click Check now. If the license server cannot be reached, the extension keeps working on the last known status.
One key works on one domain: the store address from the OpenCart configuration. Removing the key from the store does not free its domain slot. Free the slot in your vibefox.net account.
Without an active key, Klarna is not shown to customers at checkout. If a payment is started anyway, the customer sees This payment method is not available. Please choose another one. An admin user who is logged in to the admin in the same browser still sees the payment method in the store, marked (unlicensed — visible to admins only), so you can set up and test the extension before you buy a key. On OpenCart 4 this preview is not available: the store does not see the admin login, so without an active key the payment method is hidden for everybody. After you have opened the Edit page once, a reminder appears on the admin Dashboard. Close it with × to hide it for 7 days. Existing orders are not affected: Klarna notifications are still processed, and orders can still be captured, cancelled and refunded.
When a license expires, the extension keeps working, but updates and support need a renewal. The status is checked again automatically when you open the admin Dashboard or the Edit page: once a day for the first 14 days after the key is entered, then once a week. No cron job is needed. Uninstalling the extension always removes the license key and license status.
Troubleshooting
Klarna does not appear at checkout: check that the license is active, Enable/Disable is on and the credentials of the active mode are filled in: test username and password in test mode, live ones in live mode. The settings page shows a warning when they are missing. The customer's payment country must be a Klarna country of your API region, paying in that country's currency (for example a customer from Sweden must pay in SEK). Also check that the payment address is in the selected Geo Zone and that the order reaches the Total set in the settings.
The payment went through, but the order stays in Awaiting Fraud Review Status: the purchase is pending Klarna's fraud review, and the order is updated when Klarna's notification arrives. Check that your store can receive requests from Klarna at the Notification URL shown in the settings, and that the credentials of the environment the order was placed in are still entered. Turn on Debug log and look at the Log field on the extension page.
Notification answers Not configured: the credentials of the environment (test or live) the order was placed in are missing, so the notification cannot be verified. Enter them. Klarna retries the notification.
Notification answers Verification failed: the Klarna order could not be read from the Order Management API. Klarna retries the notification.
Notification answers Busy: the order was being updated by another request at the same moment. Klarna retries the notification.
Notification answers mismatch_ref or Unknown order: the Klarna order does not refer to this order, or the extension does not know it. The order is not changed.
The widget does not load: the customer sees Klarna could not be loaded. Please try again or choose another payment method. or Klarna is not available for this purchase. Check the credentials of the active mode and the customer's country and currency.
The status change to Complete or Shipped is refused: the Klarna capture failed. Read the reason on the order page or in the note. The order total may need more than is still authorized, the Klarna order may not be accepted yet, or the authorization may have expired. Fix it and change the status again, or capture in the Klarna Merchant Portal.
Refund fails: read the message in the tab. The order may not be captured yet (cancel it instead), the amount may exceed what is still refundable, or the credentials of the order's environment may be missing.
No refund form in the tab: the tab says why: nothing is captured yet, the captured amount is fully refunded, or your user group has no right to modify the extension.
The customer sees This order is already being paid: another request for the same purchase is running, for example a double click. Wait a moment and check whether the order got a status.
Uninstall
Go to Extensions > Extensions, choose the type Payments and click Uninstall (the red − button) next to VibeFox Klarna Payments. The license key and license status of this extension are always removed. OpenCart always removes its own settings of the extension: Enable/Disable, Sort Order, Geo Zone, Total and the order statuses of the Order statuses section, which return to their defaults on a re-install. The OpenCart events of the extension are removed too, so status changes no longer capture or cancel Klarna orders (on OpenCart 4 also its startup action, which lets the notification and the customer's return through in maintenance mode). If Delete data on uninstall is on, the other gateway settings (title, description, test mode, API region, credentials, capture, cancellation, logging), the log and the temporary widget sessions are removed. If it is off, they are kept for a later re-install. The Klarna orders and refunds are always kept, so orders placed before can still be captured and refunded after a re-install. Existing orders keep their payment notes.
On OpenCart 4, to remove the files of the extension as well, go to Extensions > Installer after the uninstall and click Uninstall (the orange − button) next to VibeFox Klarna Payments in the list of installed extensions, then Delete (the red bin button) to remove the uploaded package.
Klarna is a trademark of its respective owner. This extension is not affiliated with or endorsed by Klarna.
