* docs: migrate ui docs to docs universe * created yarn workspace * added eslint and tsconfig configurations * fix eslint configurations * fixed eslint configurations * shared tailwind configurations * added shared ui package * added more shared components * migrating more components * made details components shared * move InlineCode component * moved InputText * moved Loading component * Moved Modal component * moved Select components * Moved Tooltip component * moved Search components * moved ColorMode provider * Moved Notification components and providers * used icons package * use UI colors in api-reference * moved Navbar component * used Navbar and Search in UI docs * added Feedback to UI docs * general enhancements * fix color mode * added copy colors file from ui-preset * added features and enhancements to UI docs * move Sidebar component and provider * general fixes and preparations for deployment * update docusaurus version * adjusted versions * fix output directory * remove rootDirectory property * fix yarn.lock * moved code component * added vale for all docs MD and MDX * fix tests * fix vale error * fix deployment errors * change ignore commands * add output directory * fix docs test * general fixes * content fixes * fix announcement script * added changeset * fix vale checks * added nofilter option * fix vale error
3.5 KiB
description, addHowToData
| description | addHowToData |
|---|---|
| Learn how to integrate Klarna as a payment provider with the Medusa backend. Learn how to install Klarna and enable the payment provider in a region. | true |
Klarna
In this document, you’ll learn how to integrate Klarna as a payment provider in Medusa.
:::tip
Following the release of v1.8 of the core Medusa package, the naming of payment providers have changed to payment processors with the introduction of the Payment Processor API. However, plugins or implementation that still don't implement the Payment Processor API are still called payment providers.
:::
Introduction
Klarna is a payment provider that allows customers to pay in different ways including direct payment, installment payments, payment after delivery, and more.
You can integrate Klarna into Medusa using the official plugin.
Prerequisites
Medusa Components
It is assumed that you already have a Medusa backend installed and set up. If not, you can follow the quickstart guide.
In addition, you’ll need to use the Medusa Admin to enable the payment provider in later steps. You can alternatively use the REST APIs.
Needed Accounts
Install Plugin
On your Medusa backend, run the following command to install the plugin:
npm install medusa-payment-klarna
Then, add the following environment variables:
KLARNA_BACKEND_URL=<YOUR_KLARNA_BACKEND_URL>
KLARNA_URL=<YOUR_KLARNA_URL>
KLARNA_USER=<YOUR_KLARNA_USER>
KLARNA_PASSWORD=<YOUR_KLARNA_PASSWORD>
KLARNA_TERMS_URL=<YOUR_KLARNA_TERMS_URL>
KLARNA_CHECKOUT_URL=<YOUR_KLARNA_CHECKOUT_URL>
KLARNA_CONFIRMATION_URL=<YOUR_KLARNA_CONFIRMATION_URL>
Where:
<YOUR_KLARNA_BACKEND_URL>is your Klarna URL.<YOUR_KLARNA_URL>is the base Klarna URL based on your environment.<YOUR_KLARNA_USER>and<YOUR_KLARNA_PASSWORD>are your API credentials.<YOUR_KLARNA_TERMS_URL>,<YOUR_KLARNA_CHECKOUT_URL>, and<YOUR_KLARNA_CONFIRMATION_URL>are the terms, checkout, and confirmation URL of your Klarna account.
Finally, in medusa-config.js, add the Klarna plugin to the plugins array with the necessary configurations:
const plugins = [
// other plugins...
{
resolve: `medusa-payment-klarna`,
options: {
backend_url: process.env.KLARNA_BACKEND_URL,
url: process.env.KLARNA_URL,
user: process.env.KLARNA_USER,
password: process.env.KLARNA_PASSWORD,
merchant_urls: {
terms: process.env.KLARNA_TERMS_URL,
checkout: process.env.KLARNA_CHECKOUT_URL,
confirmation: process.env.KLARNA_CONFIRMATION_URL,
},
},
},
]
Enable Klarna in Regions
To use Klarna in your store, you must enable it in at least one region.
You can follow this user guide to learn how to enable a payment provider in a region. You can alternatively use the REST APIs.
See Also
- Check out more plugins you can add to your store.