From 083a27714bb206bb8ff262c243d668cfbbc44e00 Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Thu, 8 Dec 2022 20:15:52 +0200 Subject: [PATCH] docs: added Klarna documentation --- docs/content/add-plugins/klarna.md | 83 +++++++++++++++++-- docs/content/advanced/admin/import-prices.mdx | 4 +- .../advanced/admin/import-products.mdx | 4 +- 3 files changed, 79 insertions(+), 12 deletions(-) diff --git a/docs/content/add-plugins/klarna.md b/docs/content/add-plugins/klarna.md index 9309d6ce89748..03d5b5d1b528e 100644 --- a/docs/content/add-plugins/klarna.md +++ b/docs/content/add-plugins/klarna.md @@ -1,13 +1,80 @@ ---- -hide_footer: true ---- - # Klarna -:::note +In this document, you’ll learn how to integrate Klarna as a payment provider in Medusa. + +## Introduction + +[Klarna](https://www.klarna.com/) 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](https://github.com/medusajs/medusa/tree/master/packages/medusa-payment-klarna). + +## Prerequisites + +### Medusa Components + +It is assumed that you already have a Medusa server installed and set up. If not, you can follow the [quickstart guide](../quickstart/quick-start.md). + +In addition, you’ll need to use the [Medusa Admin](../admin/quickstart.md) to enable the payment provider in later steps. You can alternatively use the [REST APIs](/api/admin/#tag/Region/operation/PostRegionsRegionPaymentProviders). + +### Needed Accounts + +- A [Klarna business account](https://portal.klarna.com/) + +## Install Plugin + +On your Medusa server, run the following command to install the plugin: + +```bash +npm install medusa-payment-klarna +``` + +Then, add the following environment variables: + +```bash +KLARNA_BACKEND_URL= +KLARNA_URL= +KLARNA_USER= +KLARNA_PASSWORD= +KLARNA_TERMS_URL= +KLARNA_CHECKOUT_URL= +KLARNA_CONFIRMATION_URL= +``` + +Where: + +- `` is your Klarna URL. +- `` is the [base Klarna URL based on your environment](https://docs.klarna.com/api/api-urls/). +- `` and `` are your [API credentials](https://docs.klarna.com/api/authentication/). +- ``, ``, and `` 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: + +```jsx title=medusa-config.js +const plugins = [ + //other plugins... + { + resolve: `medusa-payment-klarnal`, + 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. -This guide is coming soon. +You can follow [this user guide to learn how to enable a payment provider in a region](../user-guide/regions/providers#manage-payment-providers). You can alternatively use the [REST APIs](/api/admin/#tag/Region/operation/PostRegionsRegionPaymentProviders). -::: +## What’s Next -[View plugin](https://github.com/medusajs/medusa/tree/master/packages/medusa-payment-klarna) \ No newline at end of file +- Check out [more plugins](https://github.com/medusajs/medusa/tree/master/packages) you can add to your store. diff --git a/docs/content/advanced/admin/import-prices.mdx b/docs/content/advanced/admin/import-prices.mdx index 66d0d58cf1e62..25f6abd6759de 100644 --- a/docs/content/advanced/admin/import-prices.mdx +++ b/docs/content/advanced/admin/import-prices.mdx @@ -1,9 +1,9 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -# How to Import Prices +# How to Bulk Import Prices -In this document, you’ll learn how to import prices into a price list using the Admin APIs. +In this document, you’ll learn how to bulk import prices into a price list using the Admin APIs. ## Overview diff --git a/docs/content/advanced/admin/import-products.mdx b/docs/content/advanced/admin/import-products.mdx index 4ffdeab02d9e0..7d2e3cc2c52b9 100644 --- a/docs/content/advanced/admin/import-products.mdx +++ b/docs/content/advanced/admin/import-products.mdx @@ -1,9 +1,9 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -# How to Import Products +# How to Bulk Import Products -In this document, you’ll learn how to use the Admin APIs to import products into a Medusa server. +In this document, you’ll learn how to use the Admin APIs to bulk import products into a Medusa server. ## Overview