@mercurjs/docs 2.3.8-canary.4 → 2.3.9-canary.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,11 +18,19 @@ Mercur focuses on the marketplace domain on top.
18
18
 
19
19
  ## Requirements
20
20
 
21
- - [Node.js v20+](https://nodejs.org/en/download) (LTS)
21
+ - [Node.js v24.22.1+](https://nodejs.org/en/download) (LTS, recommended) or v22.23.4+
22
22
  - [Bun v1.3+](https://bun.sh) (recommended package manager)
23
23
  - [Git](https://git-scm.com/downloads)
24
24
  - PostgreSQL v14+
25
25
 
26
+ <Warning>
27
+ The [October 2026 Node.js security releases](https://nodejs.org/en/blog/vulnerability/october-2026-security-releases)
28
+ fix several high-severity vulnerabilities, including a remote code execution
29
+ bug in the Brotli decoder and TLS certificate hostname bypasses. We recommend
30
+ running Mercur on **Node.js v24.22.1** or later. If you stay on Node.js 22,
31
+ use v22.23.4 or later.
32
+ </Warning>
33
+
26
34
  <Tip>
27
35
  The quickest way to run PostgreSQL locally is with Docker:
28
36
 
@@ -0,0 +1,70 @@
1
+ ---
2
+ title: "Use cases"
3
+ sidebarTitle: "Use cases"
4
+ description: "Two ways to run Mercur: as the whole marketplace, with its own storefront, admin and vendor panels, or as the marketplace layer inside a store you already run, selling seller offers next to your own products."
5
+ ---
6
+
7
+ Mercur fits two kinds of business. Pick the one that matches yours; the modules underneath are the same.
8
+
9
+ <Tabs>
10
+ <Tab title="Marketplace platform">
11
+ You are building a marketplace from scratch, or replacing one. Mercur runs everything: the storefront, the operator admin, the vendor panel sellers log into, and the backend that splits every checkout into one order per seller, computes commissions and pays sellers out.
12
+
13
+ <img className="block dark:hidden" src="/images/figures/use-case-platform-light.svg" alt="Three Mercur surfaces stacked back to front: the admin Sellers list, the vendor panel's Offers table for ACME, and the storefront product page for the Linen shirt listing the offers a shopper can buy." />
14
+ <img className="hidden dark:block" src="/images/figures/use-case-platform-dark.svg" alt="Three Mercur surfaces stacked back to front: the admin Sellers list, the vendor panel's Offers table for ACME, and the storefront product page for the Linen shirt listing the offers a shopper can buy." />
15
+
16
+ **Pick this when**
17
+
18
+ - You don't have a store yet, or you want the marketplace to be the product
19
+ - Sellers should get their own panel: offers, orders, fulfillment, payouts
20
+ - You want one shared catalog that every seller lists against
21
+
22
+ **What you get**
23
+
24
+ | Surface | Who uses it | Package |
25
+ | --- | --- | --- |
26
+ | Storefront | Shoppers | Any framework on the Store API, or the starter storefront |
27
+ | Admin panel | Operators | `@mercurjs/admin` |
28
+ | Vendor panel | Sellers | `@mercurjs/vendor` |
29
+ | Backend | Everyone | `@mercurjs/core` on Medusa |
30
+
31
+ <CardGroup cols={2}>
32
+ <Card title="Install Mercur" icon="rocket" href="/learn/introduction">
33
+ Create a marketplace project and run it locally.
34
+ </Card>
35
+ <Card title="Architecture" icon="sitemap" href="/learn/architecture">
36
+ How the panels, the API and the modules fit together.
37
+ </Card>
38
+ </CardGroup>
39
+ </Tab>
40
+ <Tab title="Marketplace inside your store">
41
+ You already sell your own products on a platform like Magento. You want third-party sellers next to them, in the same product page and the same checkout, without moving your catalog or your payments. Your store stays the storefront; Mercur becomes the marketplace layer behind it.
42
+
43
+ <img className="block dark:hidden" src="/images/figures/use-case-hybrid-light.svg" alt="A product page in your own store lists your warehouse next to two seller offers from ACME and GLOBEX. A wire leads from the seller rows to a Mercur order group with one order per seller; your own line never leaves your store." />
44
+ <img className="hidden dark:block" src="/images/figures/use-case-hybrid-dark.svg" alt="A product page in your own store lists your warehouse next to two seller offers from ACME and GLOBEX. A wire leads from the seller rows to a Mercur order group with one order per seller; your own line never leaves your store." />
45
+
46
+ **Pick this when**
47
+
48
+ - Your store, checkout and payment provider are already live and should stay
49
+ - You sell first-party stock and want sellers to compete on the same SKUs
50
+ - Sellers need a panel, but shoppers should never notice a second system
51
+
52
+ **Who runs what**
53
+
54
+ | Concern | Your store | Mercur |
55
+ | --- | --- | --- |
56
+ | Catalog, prices, stock of your own products | ✔ | |
57
+ | Storefront, cart, checkout, payment capture | ✔ | |
58
+ | Sellers, their offers, their panel | | ✔ |
59
+ | One order per seller, commissions, payouts | | ✔ |
60
+
61
+ <CardGroup cols={2}>
62
+ <Card title="Magento 2 integration" icon="store" href="/resources/integrations/magento2">
63
+ Install the connector and run a mixed first-party and seller order.
64
+ </Card>
65
+ <Card title="Order Group module" icon="layer-group" href="/platform/order-group/overview">
66
+ How one checkout becomes one order per seller.
67
+ </Card>
68
+ </CardGroup>
69
+ </Tab>
70
+ </Tabs>
@@ -4,7 +4,7 @@ sidebarTitle: "Data models"
4
4
  description: "Every field on the Medusa Product module models the shared catalog is built on, and the relations Mercur adds."
5
5
  ---
6
6
 
7
- The catalog's data models belong to Medusa's Product module, version 2.21. Mercur adds no columns to them. It adds relations through [module links](/platform/catalog/reference/links), listed under each model. Every model also has `created_at`, `updated_at`, and `deleted_at` timestamps that Medusa manages.
7
+ The catalog's data models belong to Medusa's Product module, version 2.22. Mercur adds no columns to them. It adds relations through [module links](/platform/catalog/reference/links), listed under each model. Every model also has `created_at`, `updated_at`, and `deleted_at` timestamps that Medusa manages.
8
8
 
9
9
  ## Product
10
10
 
@@ -35,6 +35,26 @@ A handful of vendor routes are public by design: seller registration (`POST /ven
35
35
 
36
36
  Store routes are public. Customer authentication (session or bearer) is **required** for `/store/order-groups` and **optional** for `/store/offers` and `/store/products`, where it enriches the pricing context when present. Public seller routes only return sellers whose status is `open` and who are not inside a scheduled closure window.
37
37
 
38
+ ### With the client
39
+
40
+ `@mercurjs/client` carries the credential for you. Pass `auth` once and every request resolves it fresh, so a token stored after login is picked up by the next call:
41
+
42
+ ```typescript
43
+ import { createClient, adminAuth, vendorAuth, apiKeyAuth, publishableKeyAuth } from "@mercurjs/client"
44
+
45
+ // inside the admin or vendor panel, or a plugin's dashboard code
46
+ const admin = createClient({ baseUrl, auth: adminAuth() })
47
+ const vendor = createClient({ baseUrl, auth: vendorAuth() })
48
+
49
+ // a server-side integration with a secret API key
50
+ const integration = createClient({ baseUrl, auth: apiKeyAuth(() => process.env.MERCUR_API_KEY) })
51
+
52
+ // a storefront
53
+ const store = createClient({ baseUrl, auth: publishableKeyAuth(() => publishableKey) })
54
+ ```
55
+
56
+ `adminAuth()` and `vendorAuth()` read the same token stores the panels write on login (`adminTokenStore`, `vendorTokenStore`, `vendorSellerStore`), so dashboard extensions share the user's session without knowing a storage key. `createTokenStore(key)` builds your own store, falling back to memory where `localStorage` is unavailable. A `401` clears the bearer store unless you pass `onUnauthorized`.
57
+
38
58
  ## Pagination
39
59
 
40
60
  List endpoints use offset pagination with two query parameters:
@@ -0,0 +1,162 @@
1
+ ---
2
+ title: "Magento 2 marketplace integration"
3
+ sidebarTitle: "Magento 2"
4
+ description: "Turn your Magento 2 or Adobe Commerce store into a multi-vendor marketplace with Mercur. Install the connector, sync seller offers, and split each order per seller."
5
+ ---
6
+
7
+ The Magento 2 connector lets a store you already run sell marketplace offers next to its own catalog. Magento keeps the storefront, cart, checkout, payment capture and your first-party products. Mercur keeps sellers, their offers, the split of one checkout into one order per seller, commission lines and payouts.
8
+
9
+ The integration has two halves:
10
+
11
+ - **`@mercurjs/magento2-connector-plugin`**, a plugin for your Mercur API that adds outbound webhooks, an external payment provider and a few admin routes
12
+ - **`mercurjs/magento2-connector`**, a Composer package of Magento modules that mirrors sellers and offers into Magento and talks to Mercur during checkout
13
+
14
+ <Tip>
15
+ This page is the setup guide. The connector's source, module layout and development workflow live in the [magento2-connector repository](https://github.com/mercurjs/magento2-connector).
16
+ </Tip>
17
+
18
+ ## Quick start
19
+
20
+ <Steps>
21
+ <Step title="Install the plugin in Mercur">
22
+ Add the plugin and register its payment provider in `medusa-config.ts`:
23
+
24
+ ```ts
25
+ module.exports = withMercur({
26
+ plugins: [
27
+ { resolve: "@mercurjs/magento2-connector-plugin", options: {} },
28
+ ],
29
+ modules: [
30
+ {
31
+ resolve: "@medusajs/medusa/payment",
32
+ options: {
33
+ providers: [
34
+ {
35
+ resolve: "@mercurjs/magento2-connector-plugin/providers/payment-external",
36
+ id: "external",
37
+ },
38
+ ],
39
+ },
40
+ },
41
+ ],
42
+ })
43
+ ```
44
+
45
+ Run `medusa db:migrate` afterwards. The provider is registered as `pp_external_external`; it records a payment Magento already captured instead of charging anyone.
46
+
47
+ Then enable it for the region your Magento website sells in: open the region in the Mercur admin and add **pp_external_external** to its payment providers. The shadow cart cannot complete without it.
48
+ </Step>
49
+ <Step title="Install the Magento package">
50
+ In your Magento root. The package is installed from its Git repository until it is published to Packagist, so add the repository first:
51
+
52
+ ```bash
53
+ composer config repositories.mercur vcs https://github.com/mercurjs/magento2-connector
54
+ composer require mercurjs/magento2-connector:dev-main
55
+ bin/magento module:enable Mercur_Core Mercur_Process Mercur_Connector \
56
+ Mercur_OfferIndexer Mercur_Catalog Mercur_Settlement Mercur_Frontend Mercur_GraphQl
57
+ # Only on stores that run Multi-Source Inventory:
58
+ bin/magento module:enable Mercur_Inventory
59
+ bin/magento setup:upgrade
60
+ bin/magento setup:di:compile
61
+ bin/magento cache:flush
62
+ ```
63
+ </Step>
64
+ <Step title="Get API details">
65
+ You need four values from Mercur:
66
+
67
+ - **Admin API key**: create a secret API key under **Settings → API keys**. If your deployment runs a roles module, bind it to a role that holds only the `integrations` permission; without one the key has full admin access, so treat it like an admin password
68
+ - **Publishable API key**: the publishable key of the sales channel the shadow cart is created in
69
+ - **Sales channel ID** and **Region ID**: the channel and the region whose prices the Magento website shows, one region per website
70
+ </Step>
71
+ <Step title="Connect Magento">
72
+ In Magento open **Stores → Configuration → Mercur → Marketplace** and enter the API URL and the four values above. Choose a best offer rule: lowest price, your own stock first, or premium sellers first.
73
+ </Step>
74
+ <Step title="Register the webhook">
75
+ In the Mercur admin open **Settings → Magento → Add endpoint**, enter `https://your_shop_domain/mercur/webhook`, keep every event selected, and copy the signing secret. The connector needs the fulfillment, shipment, delivery, return and refund events to keep orders in step. It is shown once. Paste it into the Magento configuration under **Webhooks → Signing secret**.
76
+ </Step>
77
+ <Step title="Run the first sync">
78
+ Push your taxonomy, then mirror everything:
79
+
80
+ ```bash
81
+ bin/magento mercur:sync taxonomy
82
+ bin/magento mercur:sync full
83
+ ```
84
+
85
+ Cron keeps the mirror current afterwards: sellers every 15 minutes, offers every 5 minutes, published products hourly, a full resync every night. Each run is a process under **Mercur → Processes** in the Magento admin.
86
+ </Step>
87
+ </Steps>
88
+
89
+ ## How a mixed order flows
90
+
91
+ A shopper buys one of your own products and one seller offer in the same checkout and pays once:
92
+
93
+ 1. The product page lists every active seller offer next to your own stock, with its price for that website, any price list strike-through, quantity tiers and an estimated delivery date. Adding an offer marks the cart line as a marketplace line priced by the offer and labels it "Sold by" the seller. The same works through REST and GraphQL with `mercur_offer_id`.
94
+ 2. The cart and the checkout group the marketplace lines by seller. Magento copies them into a shadow Mercur cart, asks Mercur for each seller's shipping options and lets the shopper pick one per seller; the sum is the "Seller shipping" total. Your own carriers only price your own lines, and a cart of seller lines only gets the "Shipped by the sellers" method.
95
+ 3. The shopper pays in Magento. The invoice includes seller shipping.
96
+ 4. After the order is placed, Magento records the capture on the external payment provider and completes the Mercur cart. Mercur answers with an order group, one order per seller, and Magento stores those ids on the order and its lines.
97
+ 5. Sellers fulfill in the vendor panel. Each shipped fulfillment becomes its own Magento shipment with its tracking numbers, so partial and multi-parcel deliveries show up as they happen. Deliveries, returns and cancellations update the line's marketplace status, shown to the shopper in their account and to you in the admin.
98
+ 6. Mercur computes commission lines when the cart completes and pays sellers from the recorded capture.
99
+
100
+ If Mercur is unreachable at step 4, the Magento order still succeeds and the `order_retry` process completes the Mercur side on its next run.
101
+
102
+ ## Refunds
103
+
104
+ | Starts in | What happens |
105
+ | --- | --- |
106
+ | Magento | A credit memo on marketplace lines is reported to Mercur per seller order, with seller shipping split by what each seller charged, so commission lines and payout balances follow |
107
+ | Mercur, a seller or operator refund | Mercur sends `order.refund_requested`; Magento creates an adjustment credit memo and refunds the shopper online when the invoice was captured online |
108
+ | Mercur, a canceled seller order | Magento refunds that seller's lines and shipping |
109
+
110
+ A `refunds` process every 15 minutes picks up any refund whose webhook did not arrive.
111
+
112
+ ## Essential practices
113
+
114
+ ### One region per website
115
+
116
+ Offer prices are read for the region configured on each Magento website, including Mercur price lists. A store with a US and an EU website needs two Mercur regions and two website-scoped values of **Mercur region ID**, and each website's base currency must match its region's currency.
117
+
118
+ ### Set delivery estimates
119
+
120
+ Under **Mercur → Marketplace → Delivery estimates** set the order cut-off time, business days and transit days for each website. A Mercur shipping option can carry its own `transit_days_min` and `transit_days_max` in its data.
121
+
122
+ ### Keep the operator's stock as a candidate
123
+
124
+ Your own product is always one of the ways to buy a SKU. The best offer rule decides whether it wins over a cheaper seller; `operator_first` keeps your stock on top whenever it is in stock.
125
+
126
+ ### Let webhooks drive, keep cron as the floor
127
+
128
+ Offer, seller and product events enqueue the matching delta sync within a minute. The cron schedules exist so the mirror heals after a missed delivery; a full nightly resync removes anything a delta could not see.
129
+
130
+ ## Your products or seller offers
131
+
132
+ | Situation | What happens |
133
+ | --- | --- |
134
+ | A product only you sell | A normal Magento line: your price, your stock, your carriers |
135
+ | A product only sellers sell | Imported from Mercur, as a configurable product when its variant axes are Magento attributes; it is in stock while an offer is available and every line is a marketplace line |
136
+ | A product both you and sellers sell | Same SKU, one buy box; the best offer rule picks the default and the shopper can choose another. When you run out, the product stays buyable from sellers |
137
+
138
+ Each seller has a page at `/seller/{handle}` listing what they sell on your store. In the Magento admin, **Mercur → Sellers** and **Mercur → Offers** show the mirror, orders show each seller order with its status, and the product page lists the offers for that SKU.
139
+
140
+ ## Not supported yet
141
+
142
+ - Buyer and seller messaging, order incidents and seller ratings
143
+ - Documents sellers attach to orders
144
+ - A third-party tax engine for seller lines; Magento taxes them with the product's tax class
145
+ - Mercur promotions; Magento cart rules still apply to seller lines
146
+
147
+ ## Next steps
148
+
149
+ <CardGroup cols={2}>
150
+ <Card title="Connector repository" icon="github" href="https://github.com/mercurjs/magento2-connector">
151
+ Modules, development workflow, and the webhook handler registry.
152
+ </Card>
153
+ <Card title="Offer module" icon="tag" href="/platform/offer/overview">
154
+ How offers carry seller SKU, price, inventory and shipping.
155
+ </Card>
156
+ <Card title="Order Group module" icon="layer-group" href="/platform/order-group/overview">
157
+ How one checkout becomes one order per seller.
158
+ </Card>
159
+ <Card title="Commission module" icon="percent" href="/platform/commission/overview">
160
+ How commission lines are computed at completion.
161
+ </Card>
162
+ </CardGroup>
@@ -23,6 +23,16 @@ interface.
23
23
  </Card>
24
24
  </CardGroup>
25
25
 
26
+ ## Storefront platforms
27
+
28
+ A storefront you already run can sell marketplace offers next to its own catalog. Mercur keeps sellers, offers, split orders, commissions and payouts; the platform keeps checkout and payment.
29
+
30
+ <CardGroup cols={2}>
31
+ <Card title="Magento 2" icon="store" href="/resources/integrations/magento2">
32
+ Set up the Magento 2 connector.
33
+ </Card>
34
+ </CardGroup>
35
+
26
36
  ## Blocks
27
37
 
28
38
  Other integrations ship as installable blocks. You add the block, own its source
@@ -21,7 +21,7 @@ This guide covers both. It walks through setting up Stripe, configuring both pro
21
21
  - A [Stripe account](https://dashboard.stripe.com) with Connect enabled
22
22
  - Stripe Secret API key and Publishable API key
23
23
  - A running Mercur project ([installation guide](/learn/introduction))
24
- - Node.js 20+
24
+ - Node.js 22.22+
25
25
 
26
26
  ## Architecture overview
27
27
 
@@ -54,14 +54,15 @@ A `GET /vendor/sales-summary` endpoint returns the seller's order count. You cal
54
54
  Codegen rewrites the generated `Routes` type that your panel apps already import:
55
55
 
56
56
  ```typescript apps/vendor/src/lib/client.ts
57
- import { createClient, type InferClient } from "@mercurjs/client"
57
+ import { createClient, vendorAuth, type InferClient } from "@mercurjs/client"
58
58
  import type { Routes } from "@acme/api/_generated"
59
59
 
60
60
  declare const __BACKEND_URL__: string
61
61
 
62
62
  export const client: InferClient<Routes> = createClient({
63
63
  baseUrl: __BACKEND_URL__,
64
- fetchOptions: { credentials: "include" },
64
+ fetchOptions: { credentials: "omit" },
65
+ auth: vendorAuth(),
65
66
  })
66
67
  ```
67
68
 
package/llms.txt CHANGED
@@ -21,6 +21,7 @@ package (`node_modules/@mercurjs/docs/`).
21
21
  - [Registry](content/learn/registry.mdx) — Create, build, and host your own block registry.
22
22
  - [Seller Members](content/learn/seller-members.mdx) — Multi-user seller accounts — member data, team management, store switching, and access rules.
23
23
  - [Seller](content/learn/sellers.mdx) — The central marketplace actor — seller profile, lifecycle, registration flows, and business rules.
24
+ - [Use cases](content/learn/use-cases.mdx) — Two ways to run Mercur: as the whole marketplace, with its own storefront, admin and vendor panels, or as the marketplace layer inside a store you already run, selling seller offers next to your own products.
24
25
  - [Why Mercur](content/learn/why-mercur.mdx) — Why teams choose Mercur to run an enterprise marketplace: governance, ownership, and composability without a closed platform.
25
26
 
26
27
  ## Resources — tutorials, integrations, deployment
@@ -42,6 +43,7 @@ package (`node_modules/@mercurjs/docs/`).
42
43
  - [How to Extend the Panels](content/resources/customization/extending-panels.mdx) — Add pages, widgets, navigation overrides, and form and table fields to the admin and vendor panels without forking.
43
44
  - [Medusa Cloud](content/resources/deployment/medusa-cloud.mdx) — Deploy the Mercur backend, admin panel, and vendor panel on Medusa Cloud.
44
45
  - [Self-host Mercur](content/resources/deployment/self-host.mdx) — Deploy a Mercur marketplace to your own infrastructure: the API, the panels, and the databases behind them.
46
+ - [Magento 2 marketplace integration](content/resources/integrations/magento2.mdx) — Turn your Magento 2 or Adobe Commerce store into a multi-vendor marketplace with Mercur. Install the connector, sync seller offers, and split each order per seller.
45
47
  - [Integrations](content/resources/integrations/overview.mdx) — Extend Mercur with third-party providers and installable blocks.
46
48
  - [Stripe Connect](content/resources/integrations/stripe-connect.mdx) — Set up Stripe Connect for marketplace payments and seller payouts, from Stripe Dashboard configuration to the full end-to-end payment lifecycle.
47
49
  - [How to Add a Block](content/resources/tutorials/add-a-block.mdx) — Install the reviews block end-to-end and follow it live across the admin, vendor, and storefront surfaces.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mercurjs/docs",
3
- "version": "2.3.8-canary.4",
3
+ "version": "2.3.9-canary.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/mercurjs/mercur",