# Medusa

Install the Kustom Checkout plugin for Medusa, configure your first region in Admin and find the developer steps to connect and test checkout.

Medusa handles your catalogue, carts and orders on the server. Your team manages the store in
Medusa Admin. Customers shop on a separate site called a storefront. Use your existing storefront,
build one or start with [Medusa's Next.js starter](https://docs.medusajs.com/resources/nextjs-starter).

## What the plugin supports

The plugin connects Kustom Checkout to Medusa and supports payment captures and refunds in Medusa Admin.

## Before you start

- A [supported version of Medusa v2](/partners/medusa-plugin-reference/#installation-and-configuration),
  a storefront and a developer to connect them.
- A [Kustom account](/partners/activate-kustom-checkout/) for the countries and currencies you sell in.
- Access to Medusa Admin and API credentials from Kustom Playground. Generate the credentials
  under **Developers → API** in the [Playground Portal](https://portal.playground.kustom.co/).

## Set up Kustom Checkout

### Install the plugin

In your Medusa backend, run `npm install @kustom-checkout/medusa-plugin-kustom@1.3.0`.
Then [register the plugin and payment provider](/partners/medusa-plugin-reference/#register-the-plugin-and-payment-provider)
and [configure the backend and run the migrations](/partners/medusa-plugin-reference/#configure-https-origins-and-the-encryption-key).

### Enter your Playground credentials

In Medusa Admin, open **Settings → Kustom → Checkout Configuration**. Under **Credentials**,
select **Playground** and enter your **API username** and **API password**. Select
**Test connection**, then **Save**. See [credential and provider setup](/partners/medusa-plugin-reference/#save-credentials-and-enable-the-provider).

![Medusa Admin with the Kustom credentials form open and Playground selected.](/images/medusa/kustom-credentials.png)

*Enter test credentials in Kustom settings.*

### Choose where to offer Kustom Checkout

In **Settings → Regions**, open a region and choose **Edit**. Add **Kustom (KUSTOM)** under
**Payment Providers** and save. Repeat for each region that should offer Kustom Checkout.

![The Medusa region editor with Kustom selected under Payment Providers.](/images/medusa/region-payment-provider.png)

*Enable Kustom for a region, such as Sweden.*

### Set up delivery in Medusa

For orders you ship, configure your stock locations, fulfillment providers and shipping
options under **Settings → Locations & Shipping**. The plugin sends the available options to checkout.

![Standard delivery listed under Shipping options for a Sweden service zone in Medusa Admin.](/images/medusa/standard-shipping-options.png)

## Kustom Shipping Assistant (optional)

For live carrier choices, pickup points or delivery windows, set up a Shipping Assistant
profile for your markets in Kustom Portal. Your shipping provider determines which options,
prices and rules apply. Medusa shipping options can serve as a fallback.

In **Settings → Kustom → Checkout Configuration**, **Allow Separate Shipping Address** lets shoppers
enter a different delivery address. With the switch off, Shipping Assistant can still appear
when the order has shipping options and the market has a matching Portal profile.
[See Shipping Assistant setup for Medusa](/partners/medusa-plugin-reference/#if-you-use-kustom-shipping-assistant).

  <figure style="margin: 0; min-width: 0;">
    <figcaption><strong>Medusa Admin</strong></figcaption>

    <img
      src="/images/medusa/shipping-address-setting.png"
      alt="Allow Separate Shipping Address switch in Medusa Checkout Configuration."
      loading="lazy"
      style="display: block; width: 100%; height: auto; aspect-ratio: 725 / 460; object-fit: contain; background: white; border: 1px solid #d9dce1; border-radius: 0.375rem;"
    />

  </figure>
  <figure style="margin: 0; min-width: 0;">
    <figcaption><strong>What shoppers see</strong></figcaption>

    <img
      src="/images/medusa/checkout-delivery-example.png"
      alt="Shipping Assistant example showing a parcel locker and home delivery with estimates and prices."
      loading="lazy"
      style="display: block; width: 100%; height: auto; aspect-ratio: 725 / 460; object-fit: contain; background: white; border: 1px solid #d9dce1; border-radius: 0.375rem;"
    />

  </figure>

## Connect your storefront

Connect your storefront before customers can check out. Follow the steps to
[open and update checkout from your storefront](/partners/medusa-plugin-reference/#open-and-update-checkout)
and [show order confirmation](/partners/medusa-plugin-reference/#show-the-confirmation).

## On-Site Elements (optional)

Check the Elements key and allowed domains in **Settings → Kustom → On-Site Elements**.
Set up express buttons in the Kustom Portal if you use them.
[See Kustom Elements setup for Medusa](/partners/medusa-plugin-reference/#if-you-add-kustom-elements).

  <figure style="margin: 0; min-width: 0;">
    <figcaption><strong>Medusa Admin</strong></figcaption>

    <img
      src="/images/medusa/elements-wallet-settings.png"
      alt="Medusa On-Site Elements in Playground showing the masked Elements public API key and express wallet settings."
      loading="lazy"
      style="display: block; width: 100%; height: auto; aspect-ratio: 725 / 460; object-fit: contain; background: white; border: 1px solid #d9dce1; border-radius: 0.375rem;"
    />
    <small style="display: block; margin-top: 0.5rem;">Playground test shop with the Elements key masked.</small>

  </figure>
  <figure style="margin: 0; min-width: 0;">
    <figcaption><strong>Storefront example</strong></figcaption>

    <img
      src="/images/medusa/elements-payment-display-example.png"
      alt="Product page with a row of payment logos beneath the Choose size button."
      loading="lazy"
      style="display: block; width: 100%; height: auto; aspect-ratio: 725 / 460; object-fit: contain; background: white; border: 1px solid #d9dce1; border-radius: 0.375rem;"
    />
    <small style="display: block; margin-top: 0.5rem;">Your developer adds this to your storefront.</small>

  </figure>

## Test checkout

[Run the end-to-end Playground checklist](/partners/medusa-plugin-reference/#test-the-integration).
Check delivery, payment, confirmation, captures and refunds before you go live.

## Related

- [Medusa plugin reference](/partners/medusa-plugin-reference/)
- [Open source platform responsibility](/partners/open-source-responsibility/)
