• Модуль интеграций
  • Сообщество
  • Блог
Документация
Плагины и интеграцииВсе расширения для Medusa от сообществаСтартерыЗапускайте проекты быстрее с готовыми решениями
ЭкспертыПодберите специалиста для разработки и развития вашего проекта на MedusaКейсыПосмотрите примеры Medusa в продакшене и успешные внедрения
Представляем готовый к продакшену Medusa DTC Starter от Gorgo

26 августа 2026 г. · Продукт

Gorgo снижает затраты на адаптацию Medusa к локальным рынкам.

Мы разрабатываем плагины интеграции, осуществляем поддержку и развиваем сообщество разработчиков на Medusa в Telegram.

  • Ресурсы Medusa
  • Плагины и интеграции
  • Модуль интеграций
  • Стартеры
  • Эксперты
  • Кейсы
  • Medusa Чат в Telegram
  • Medusa Новости в Telegram
  • Документация Gorgo
  • Связаться с нами
  • TelegramGitHub
Плагины
F

Fulfillment nshift

nShift Checkout fulfillment provider plugin for Medusa V2

npm install @solteq-excom/medusa-fulfillment-nshift
Категория
Доставка
Создано
Solteq-excom
Версия
0.1.6
Последнее обновление
8 часов назад
Ежемесячные загрузки
Загрузка данных
Звезды на Github
0
npmNPMGitHubGithub

@solteq-excom/medusa-fulfillment-nshift

nShift Checkout fulfillment provider for Medusa v2.

Brings nShift's delivery options into a Medusa storefront: real carrier options, real prices for the customer's address and basket, and a partial shipment created in nShift when the order is fulfilled.

  • Dynamic delivery options — the options an admin can attach to a shipping option come straight from your nShift Checkout configuration.
  • Calculated pricing — prices are fetched per cart, using the receiver address, package weight/volume and basket value, so nShift price rules (free shipping thresholds, weight bands, per-country pricing) apply.
  • Pickup points, time slots and addons — selected at checkout, validated against nShift, and forwarded to the shipment.
  • Partial shipments — created on fulfillment, deleted again when the fulfillment is cancelled.
  • Fails soft — if nShift is unreachable or does not offer an option for a cart, that option is simply reported as unavailable. Checkout keeps working.
  • Token and session handling — OAuth2 tokens are cached and refreshed; one nShift session is reused across all the options of a cart.

Requirements

  • Medusa
  • Node
  • An active nShift Checkout agreement

Installation

nShift account setup

  1. Log in to the nShift Portal.
  2. Settings → API Configuration → Clients → Add. Give the client the Public checkout API scope and copy the Client ID and Client Secret (the secret is only shown once).
  3. Connections — copy the Connection ID you want Medusa to use.
  4. Configure the Checkout configuration behind that connection with the carriers and delivery options you want to offer.

Configuration

Register the provider on the Fulfillment Module, and register the plugin so its build output is loaded:

Define the Fulfillment Module once. If it appears twice in , the last definition wins and the provider in the earlier one is never registered — which makes every cart that references an nShift shipping option fail.

If your client secret contains , do not escape it as in — dotenv keeps the backslash and nShift answers . Wrap the value in quotes instead.

Provider options

OptionTypeDefaultDescription
—Required. nShift API Client ID.
—Required. nShift API Client Secret.
—Required. nShift Checkout Connection ID.
Language for option names and descriptions (ISO 639).
Locale for formatted price/date strings.
—Country used to list delivery options in the admin (ISO 3166-1 alpha-2). Required for the admin dropdown.
—Postal code used to list delivery options in the admin. Required for the admin dropdown.
—State/province sent when the Medusa address has none. Some markets need it.
Currency used when the calculation context carries none.
Whether nShift prices already include tax.
Unit of in your data. Set to if you store grams.
Unit of / / .
Weight sent when no item weights are known.
Send the basket value as so nShift price rules can evaluate.
Push partial shipments to your Book & Print platform.
Count sessions towards nShift's conversion-rate metric.
Per-request timeout against the nShift API.
How long one session and its delivery options are reused for an unchanged cart.
Override the nShift API host.
Override the nShift token endpoint.

Check . Medusa does not define a unit for . The default matches earlier versions of this plugin; if your catalogue stores grams, set or nShift will price a 500 g shirt as 500 kg.

Check . nShift Checkout prices are normally the consumer-facing gross price, hence the default. Set it to if your configuration holds net prices, otherwise your cart's tax totals will be wrong.

Creating shipping options in the admin

  1. Settings → Locations & Shipping → your location → Shipping options → Create.
  2. Set Price type to Calculated so the price comes from nShift.
  3. Pick nShift as the provider and choose one of the delivery options it lists. Each Medusa shipping option maps to exactly one nShift delivery option.

The chosen delivery option is stored on . If that dropdown is empty or errors, the message tells you why — most often a missing / , or no delivery options configured for that country.

Storefront usage

Calculated options come back from without a price; fetch each price with , then add the method to the cart.

accepted when adding a shipping method

Both snake_case and the nShift widget's camelCase spelling are accepted.

KeyAliasDescription
A from the option's .
A from the option's .
—, or .
Shorthand: .
— or a map.

Selections are validated against the delivery option before the method is stored: an unknown pickup point, time slot or addon is rejected with a naming it. Addon prices are added to the shipping price.

Anything else you put in is preserved verbatim, so you can carry your own state through checkout.

What ends up on the shipping method

After fulfillment, additionally carries , , and .

Behaviour and error handling

The provider never breaks a cart. reports an option as unavailable — no — instead of throwing, whenever:

  • the cart has no country or postal code yet,
  • nShift does not return the option for that address (wrong country route, weight over the limit, a price rule excluding it),
  • nShift returns the option without a price,
  • the nShift API is unreachable, times out or errors,
  • the shipping option has no nShift delivery option attached.

Medusa treats a missing price as "not available in this context": removes the shipping method, and an explicit selection is rejected with . So changing the shipping country to one a carrier does not serve drops that method rather than failing the address update. Every case is logged with the nShift status and so you can see the reason in the server log.

Errors are raised where they are actionable instead:

SituationResult
Missing / / throws at startup
Admin option list without / naming the missing option
Admin option list, nShift request fails including the nShift status and issues
Selecting an option nShift no longer offers, pick another method
Unknown pickup point, time slot or addon naming it
Option requires a pickup point and none was sent
Fulfilling without checkout session data
Order address nShift cannot ship to
nShift refuses to delete a cancelled shipmentlogged, cancellation still succeeds

Not covered yet

  • Split shipments (nShift's endpoints).
  • Return shipments — is not implemented.
  • Labels and tracking numbers: booking and printing still happen in your Book & Print platform, so returns no .
  • Own Pickup Locations API management.
  • Badges, certifications and Klarna delivery types are read from nShift but not surfaced on the shipping method.

License

MIT

Еще в этой категории

Посмотреть все
Доставка
DHL eCommerce logo

DHL eCommerce

От Mitchellston

Выполняйте заказы с помощью DHL eCommerce

Загрузка данных
GitHubnpm
Доставка
Mondial Relay logo

Mondial Relay

От Theodaguier

Доставляйте заказы с Mondial Relay

Загрузка данных
npm
Доставка
Интеграция
ApiShip logo

ApiShip

От Gorgo

Подключите доставку несколькими перевозчиками

Загрузка данных
GitHubnpm

Еще от этого автора

Посмотреть все
Платежи
P

Paytrail

От Solteq-excom

Плагин платёжного провайдера Paytrail для Medusa

Загрузка данных
GitHubnpm
1yarn add @solteq-excom/medusa-fulfillment-nshift
2# or
3npm install @solteq-excom/medusa-fulfillment-nshift
1// medusa-config.ts
2import { defineConfig } from "@medusajs/framework/utils"
3
4export default defineConfig({
5 plugins: [
6 {
7 resolve: "@solteq-excom/medusa-fulfillment-nshift",
8 options: {},
9 },
10 ],
11 modules: [
12 {
13 resolve: "@medusajs/medusa/fulfillment",
14 options: {
15 providers: [
16 {
17 resolve: "@medusajs/medusa/fulfillment-manual",
18 id: "manual",
19 },
20 {
21 resolve: "@solteq-excom/medusa-fulfillment-nshift/providers/nshift",
22 id: "nshift",
23 options: {
24 client_id: process.env.NSHIFT_CLIENT_ID,
25 client_secret: process.env.NSHIFT_CLIENT_SECRET,
26 connection_id: process.env.NSHIFT_CONNECTION_ID,
27 language_code: process.env.NSHIFT_LANGUAGE_CODE,
28 locale_id: process.env.NSHIFT_LOCALE_ID,
29 default_country: process.env.NSHIFT_DEFAULT_COUNTRY,
30 default_postal_code: process.env.NSHIFT_DEFAULT_POSTAL_CODE,
31 send_to_book_and_print:
32 process.env.NSHIFT_SEND_TO_BOOK_AND_PRINT === "true",
33 },
34 },
35 ],
36 },
37 },
38 ],
39})
1NSHIFT_CLIENT_ID=your_client_id
2NSHIFT_CLIENT_SECRET=your_client_secret
3NSHIFT_CONNECTION_ID=your_connection_id
4NSHIFT_LANGUAGE_CODE=en
5NSHIFT_LOCALE_ID=en-GB
6NSHIFT_DEFAULT_COUNTRY=FI
7NSHIFT_DEFAULT_POSTAL_CODE=00100
8NSHIFT_SEND_TO_BOOK_AND_PRINT=false
1import { sdk } from "../lib/config"
2
3// 1. List the options available for the cart.
4const { shipping_options } = await sdk.store.fulfillment.listCartOptions({
5 cart_id: cart.id,
6})
7
8// 2. Price the calculated ones.
9const priced = await Promise.all(
10 shipping_options.map(async (option) => {
11 if (option.price_type !== "calculated") {
12 return option
13 }
14 const { shipping_option } = await sdk.store.fulfillment.calculate(option.id, {
15 cart_id: cart.id,
16 data: {},
17 })
18 return shipping_option
19 })
20)
21
22// 3. Hide the ones nShift does not offer for this cart.
23const selectable = priced.filter((option) => option.amount !== undefined)
24
25// 4. Add the customer's choice to the cart.
26await sdk.store.cart.addShippingMethod(cart.id, {
27 option_id: selected.id,
28 data: {
29 pickup_point_id: "K384", // optional
30 time_slot_id: "slot-1", // optional
31 addons: [{ addon_id: "948058" }], // optional
32 fields: [{ field_id: "DOORCODE", value: "1234" }], // optional
33 },
34})
1{
2 "session_id": "77933415-a756-4eab-821a-98fb6fc9aa75",
3 "option_id": "834827b2-abc2-4e05-8520-7707c1d2c4d8",
4 "carrier_id": "948",
5 "carrier_product_id": "10543",
6 "carrier_product_name": "Posti Home Parcel (2104)(10543) Finland only",
7 "price": 98,
8 "currency_code": "EUR",
9 "addons": [{ "addonId": "948058" }],
10 "delivery_time": {
11 "earliest": "2026-08-29T00:00:00",
12 "latest": "2026-08-29T00:00:00",
13 "description": "Delivery on Saturday",
14 "timeZone": "Europe/Helsinki"
15 }
16}