@mercurjs/docs 2.2.0-canary.40

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.
Files changed (283) hide show
  1. package/README.md +24 -0
  2. package/content/blocks.mdx +209 -0
  3. package/content/learn/architecture.mdx +215 -0
  4. package/content/learn/attributes.mdx +89 -0
  5. package/content/learn/blocks.mdx +99 -0
  6. package/content/learn/commissions.mdx +175 -0
  7. package/content/learn/concepts.mdx +84 -0
  8. package/content/learn/installation.mdx +117 -0
  9. package/content/learn/introduction.mdx +71 -0
  10. package/content/learn/offers.mdx +78 -0
  11. package/content/learn/order-groups.mdx +114 -0
  12. package/content/learn/payouts.mdx +175 -0
  13. package/content/learn/product-requests.mdx +82 -0
  14. package/content/learn/products.mdx +79 -0
  15. package/content/learn/registry.mdx +155 -0
  16. package/content/learn/seller-members.mdx +62 -0
  17. package/content/learn/sellers.mdx +118 -0
  18. package/content/migration/from-1-x-to-2-0.mdx +152 -0
  19. package/content/migration/from-2-0-to-2-1.mdx +105 -0
  20. package/content/migration/overview.mdx +58 -0
  21. package/content/references/api/admin/commission-rates/batch-commission-rules.mdx +70 -0
  22. package/content/references/api/admin/commission-rates/create-commission-rate.mdx +95 -0
  23. package/content/references/api/admin/commission-rates/delete-commission-rate.mdx +40 -0
  24. package/content/references/api/admin/commission-rates/list-commission-rates.mdx +92 -0
  25. package/content/references/api/admin/commission-rates/retrieve-commission-rate.mdx +70 -0
  26. package/content/references/api/admin/commission-rates/update-commission-rate.mdx +84 -0
  27. package/content/references/api/admin/members/list-members.mdx +61 -0
  28. package/content/references/api/admin/offers/batch-create-offers.mdx +130 -0
  29. package/content/references/api/admin/offers/delete-offer.mdx +40 -0
  30. package/content/references/api/admin/offers/list-offers.mdx +106 -0
  31. package/content/references/api/admin/offers/retrieve-offer.mdx +82 -0
  32. package/content/references/api/admin/order-groups/list-order-groups.mdx +77 -0
  33. package/content/references/api/admin/order-groups/retrieve-order-group.mdx +56 -0
  34. package/content/references/api/admin/orders/get-order-commission-lines.mdx +65 -0
  35. package/content/references/api/admin/orders/get-order-order-group.mdx +56 -0
  36. package/content/references/api/admin/orders/list-orders.mdx +79 -0
  37. package/content/references/api/admin/payouts/list-payouts.mdx +75 -0
  38. package/content/references/api/admin/payouts/retrieve-payout.mdx +62 -0
  39. package/content/references/api/admin/product-attributes/create-attribute-value.mdx +76 -0
  40. package/content/references/api/admin/product-attributes/create-product-attribute.mdx +99 -0
  41. package/content/references/api/admin/product-attributes/delete-attribute-value.mdx +52 -0
  42. package/content/references/api/admin/product-attributes/delete-product-attribute.mdx +40 -0
  43. package/content/references/api/admin/product-attributes/list-product-attributes.mdx +91 -0
  44. package/content/references/api/admin/product-attributes/retrieve-product-attribute.mdx +81 -0
  45. package/content/references/api/admin/product-attributes/update-attribute-value.mdx +66 -0
  46. package/content/references/api/admin/product-attributes/update-product-attribute.mdx +76 -0
  47. package/content/references/api/admin/product-changes/cancel-product-change.mdx +68 -0
  48. package/content/references/api/admin/product-changes/confirm-product-change.mdx +47 -0
  49. package/content/references/api/admin/products/batch-product-attributes.mdx +96 -0
  50. package/content/references/api/admin/products/confirm-product.mdx +59 -0
  51. package/content/references/api/admin/products/create-product-variant.mdx +78 -0
  52. package/content/references/api/admin/products/create-product.mdx +169 -0
  53. package/content/references/api/admin/products/delete-product-variant.mdx +48 -0
  54. package/content/references/api/admin/products/delete-product.mdx +40 -0
  55. package/content/references/api/admin/products/list-product-variants.mdx +91 -0
  56. package/content/references/api/admin/products/list-products.mdx +109 -0
  57. package/content/references/api/admin/products/preview-product.mdx +78 -0
  58. package/content/references/api/admin/products/reject-product.mdx +59 -0
  59. package/content/references/api/admin/products/request-product-changes.mdx +59 -0
  60. package/content/references/api/admin/products/retrieve-product-variant.mdx +73 -0
  61. package/content/references/api/admin/products/retrieve-product.mdx +96 -0
  62. package/content/references/api/admin/products/set-product-sellers.mdx +47 -0
  63. package/content/references/api/admin/products/update-product-variant.mdx +89 -0
  64. package/content/references/api/admin/products/update-product.mdx +133 -0
  65. package/content/references/api/admin/sellers/add-seller-member.mdx +63 -0
  66. package/content/references/api/admin/sellers/approve-seller.mdx +54 -0
  67. package/content/references/api/admin/sellers/create-seller.mdx +100 -0
  68. package/content/references/api/admin/sellers/delete-member-invite.mdx +42 -0
  69. package/content/references/api/admin/sellers/delete-professional-details.mdx +52 -0
  70. package/content/references/api/admin/sellers/invite-seller-member.mdx +63 -0
  71. package/content/references/api/admin/sellers/list-member-invites.mdx +71 -0
  72. package/content/references/api/admin/sellers/list-seller-members.mdx +71 -0
  73. package/content/references/api/admin/sellers/list-seller-products.mdx +85 -0
  74. package/content/references/api/admin/sellers/list-sellers.mdx +96 -0
  75. package/content/references/api/admin/sellers/remove-seller-member.mdx +42 -0
  76. package/content/references/api/admin/sellers/resend-member-invite.mdx +55 -0
  77. package/content/references/api/admin/sellers/retrieve-seller.mdx +81 -0
  78. package/content/references/api/admin/sellers/suspend-seller.mdx +60 -0
  79. package/content/references/api/admin/sellers/terminate-seller.mdx +60 -0
  80. package/content/references/api/admin/sellers/unsuspend-seller.mdx +52 -0
  81. package/content/references/api/admin/sellers/unterminate-seller.mdx +52 -0
  82. package/content/references/api/admin/sellers/update-seller.mdx +83 -0
  83. package/content/references/api/admin/sellers/upsert-payment-details.mdx +88 -0
  84. package/content/references/api/admin/sellers/upsert-professional-details.mdx +78 -0
  85. package/content/references/api/admin/sellers/upsert-seller-address.mdx +91 -0
  86. package/content/references/api/admin.mdx +134 -0
  87. package/content/references/api/conventions.mdx +109 -0
  88. package/content/references/api/store/carts/add-line-item.mdx +115 -0
  89. package/content/references/api/store/carts/add-shipping-methods.mdx +84 -0
  90. package/content/references/api/store/carts/apply-promotions.mdx +83 -0
  91. package/content/references/api/store/carts/complete-cart.mdx +98 -0
  92. package/content/references/api/store/offers/list-offers.mdx +161 -0
  93. package/content/references/api/store/offers/retrieve-offer.mdx +112 -0
  94. package/content/references/api/store/order-groups/list-order-groups.mdx +105 -0
  95. package/content/references/api/store/order-groups/retrieve-order-group.mdx +78 -0
  96. package/content/references/api/store/product-attributes/list-product-attributes.mdx +134 -0
  97. package/content/references/api/store/product-attributes/retrieve-product-attribute.mdx +78 -0
  98. package/content/references/api/store/product-categories/list-product-categories.mdx +126 -0
  99. package/content/references/api/store/product-categories/retrieve-product-category.mdx +79 -0
  100. package/content/references/api/store/products/list-products.mdx +184 -0
  101. package/content/references/api/store/products/retrieve-product.mdx +107 -0
  102. package/content/references/api/store/search/search.mdx +136 -0
  103. package/content/references/api/store/sellers/list-sellers.mdx +105 -0
  104. package/content/references/api/store/sellers/retrieve-seller.mdx +62 -0
  105. package/content/references/api/store/shipping-options/list-shipping-options.mdx +74 -0
  106. package/content/references/api/store.mdx +67 -0
  107. package/content/references/api/vendor/members/accept-member-invite.mdx +65 -0
  108. package/content/references/api/vendor/members/retrieve-current-member.mdx +51 -0
  109. package/content/references/api/vendor/members/update-current-member.mdx +70 -0
  110. package/content/references/api/vendor/offers/batch-create-offers.mdx +123 -0
  111. package/content/references/api/vendor/offers/batch-offer-inventory-items.mdx +103 -0
  112. package/content/references/api/vendor/offers/create-offer.mdx +141 -0
  113. package/content/references/api/vendor/offers/delete-offer.mdx +51 -0
  114. package/content/references/api/vendor/offers/list-offers.mdx +125 -0
  115. package/content/references/api/vendor/offers/retrieve-offer.mdx +74 -0
  116. package/content/references/api/vendor/offers/update-offer.mdx +82 -0
  117. package/content/references/api/vendor/orders/cancel-fulfillment.mdx +63 -0
  118. package/content/references/api/vendor/orders/cancel-order.mdx +56 -0
  119. package/content/references/api/vendor/orders/complete-order.mdx +55 -0
  120. package/content/references/api/vendor/orders/create-fulfillment.mdx +76 -0
  121. package/content/references/api/vendor/orders/create-shipment.mdx +99 -0
  122. package/content/references/api/vendor/orders/get-order-commission-lines.mdx +66 -0
  123. package/content/references/api/vendor/orders/list-order-changes.mdx +75 -0
  124. package/content/references/api/vendor/orders/list-orders.mdx +103 -0
  125. package/content/references/api/vendor/orders/mark-fulfillment-delivered.mdx +62 -0
  126. package/content/references/api/vendor/orders/preview-order.mdx +65 -0
  127. package/content/references/api/vendor/orders/retrieve-order.mdx +84 -0
  128. package/content/references/api/vendor/payout-accounts/create-onboarding.mdx +68 -0
  129. package/content/references/api/vendor/payout-accounts/create-payout-account.mdx +59 -0
  130. package/content/references/api/vendor/payout-accounts/retrieve-payout-account-by-id.mdx +60 -0
  131. package/content/references/api/vendor/payout-accounts/retrieve-payout-account.mdx +77 -0
  132. package/content/references/api/vendor/payouts/list-payouts.mdx +90 -0
  133. package/content/references/api/vendor/payouts/retrieve-payout.mdx +63 -0
  134. package/content/references/api/vendor/product-attributes/list-product-attributes.mdx +135 -0
  135. package/content/references/api/vendor/product-attributes/retrieve-product-attribute.mdx +71 -0
  136. package/content/references/api/vendor/product-variants/list-variants.mdx +136 -0
  137. package/content/references/api/vendor/products/batch-product-attributes.mdx +104 -0
  138. package/content/references/api/vendor/products/cancel-product-change.mdx +62 -0
  139. package/content/references/api/vendor/products/create-product-variant.mdx +92 -0
  140. package/content/references/api/vendor/products/create-product.mdx +197 -0
  141. package/content/references/api/vendor/products/delete-product-variant.mdx +68 -0
  142. package/content/references/api/vendor/products/delete-product.mdx +62 -0
  143. package/content/references/api/vendor/products/list-product-variants.mdx +114 -0
  144. package/content/references/api/vendor/products/list-products.mdx +163 -0
  145. package/content/references/api/vendor/products/preview-product.mdx +61 -0
  146. package/content/references/api/vendor/products/retrieve-product-variant.mdx +76 -0
  147. package/content/references/api/vendor/products/retrieve-product.mdx +69 -0
  148. package/content/references/api/vendor/products/update-product-variant.mdx +104 -0
  149. package/content/references/api/vendor/products/update-product.mdx +148 -0
  150. package/content/references/api/vendor/sellers/create-seller.mdx +150 -0
  151. package/content/references/api/vendor/sellers/delete-professional-details.mdx +54 -0
  152. package/content/references/api/vendor/sellers/invite-seller-member.mdx +67 -0
  153. package/content/references/api/vendor/sellers/list-member-invites.mdx +82 -0
  154. package/content/references/api/vendor/sellers/list-seller-members.mdx +80 -0
  155. package/content/references/api/vendor/sellers/list-sellers.mdx +71 -0
  156. package/content/references/api/vendor/sellers/remove-seller-member.mdx +48 -0
  157. package/content/references/api/vendor/sellers/retrieve-current-seller-member.mdx +59 -0
  158. package/content/references/api/vendor/sellers/retrieve-current-seller.mdx +69 -0
  159. package/content/references/api/vendor/sellers/select-seller.mdx +44 -0
  160. package/content/references/api/vendor/sellers/update-current-seller.mdx +108 -0
  161. package/content/references/api/vendor/sellers/update-member-role.mdx +51 -0
  162. package/content/references/api/vendor/sellers/upsert-payment-details.mdx +74 -0
  163. package/content/references/api/vendor/sellers/upsert-professional-details.mdx +70 -0
  164. package/content/references/api/vendor/sellers/upsert-seller-address.mdx +81 -0
  165. package/content/references/api/vendor.mdx +150 -0
  166. package/content/references/configuration.mdx +155 -0
  167. package/content/references/modules/commission.mdx +106 -0
  168. package/content/references/modules/custom-fields.mdx +45 -0
  169. package/content/references/modules/media.mdx +55 -0
  170. package/content/references/modules/offer.mdx +64 -0
  171. package/content/references/modules/payout.mdx +121 -0
  172. package/content/references/modules/product-attribute.mdx +111 -0
  173. package/content/references/modules/product-edit.mdx +80 -0
  174. package/content/references/modules/search.mdx +112 -0
  175. package/content/references/modules/seller.mdx +175 -0
  176. package/content/references/overview.mdx +70 -0
  177. package/content/references/workflows/cart/add-seller-shipping-method-to-cart.mdx +44 -0
  178. package/content/references/workflows/cart/complete-cart-with-split-orders.mdx +36 -0
  179. package/content/references/workflows/cart/list-seller-shipping-options-for-cart.mdx +39 -0
  180. package/content/references/workflows/cart/update-cart-seller-promotions.mdx +42 -0
  181. package/content/references/workflows/commission/batch-commission-rules.mdx +45 -0
  182. package/content/references/workflows/commission/create-commission-rates.mdx +41 -0
  183. package/content/references/workflows/commission/delete-commission-rates.mdx +34 -0
  184. package/content/references/workflows/commission/refresh-order-commission-lines.mdx +30 -0
  185. package/content/references/workflows/commission/update-commission-rates.mdx +35 -0
  186. package/content/references/workflows/media/set-category-images.mdx +41 -0
  187. package/content/references/workflows/media/set-collection-images.mdx +41 -0
  188. package/content/references/workflows/member/accept-member-invite.mdx +33 -0
  189. package/content/references/workflows/member/add-seller-member.mdx +30 -0
  190. package/content/references/workflows/member/create-member-invites.mdx +34 -0
  191. package/content/references/workflows/member/delete-member-invite.mdx +24 -0
  192. package/content/references/workflows/member/remove-seller-member.mdx +28 -0
  193. package/content/references/workflows/member/resend-member-invite.mdx +28 -0
  194. package/content/references/workflows/member/update-member-role.mdx +28 -0
  195. package/content/references/workflows/member/update-member.mdx +35 -0
  196. package/content/references/workflows/offer/batch-offer-inventory-items.mdx +58 -0
  197. package/content/references/workflows/offer/create-offers.mdx +63 -0
  198. package/content/references/workflows/offer/delete-offers.mdx +35 -0
  199. package/content/references/workflows/offer/update-offers.mdx +51 -0
  200. package/content/references/workflows/order/cancel-order-fulfillment.mdx +34 -0
  201. package/content/references/workflows/order/confirm-claim-request.mdx +25 -0
  202. package/content/references/workflows/order/confirm-exchange-request.mdx +25 -0
  203. package/content/references/workflows/order/confirm-order-edit-request.mdx +25 -0
  204. package/content/references/workflows/order/confirm-return-receive.mdx +25 -0
  205. package/content/references/workflows/order/create-order-fulfillment.mdx +45 -0
  206. package/content/references/workflows/order-group/get-order-group-detail.mdx +29 -0
  207. package/content/references/workflows/order-group/get-order-groups-list.mdx +36 -0
  208. package/content/references/workflows/overview.mdx +72 -0
  209. package/content/references/workflows/payout/create-onboarding.mdx +36 -0
  210. package/content/references/workflows/payout/create-payout-account.mdx +33 -0
  211. package/content/references/workflows/payout/create-payout.mdx +30 -0
  212. package/content/references/workflows/payout/process-payout-for-webhook.mdx +32 -0
  213. package/content/references/workflows/product/confirm-products.mdx +46 -0
  214. package/content/references/workflows/product/create-products.mdx +63 -0
  215. package/content/references/workflows/product/link-sellers-to-product-category.mdx +40 -0
  216. package/content/references/workflows/product/link-sellers-to-product.mdx +40 -0
  217. package/content/references/workflows/product/reject-product.mdx +46 -0
  218. package/content/references/workflows/product/request-product-change.mdx +46 -0
  219. package/content/references/workflows/product-attribute/add-product-attributes-to-product.mdx +49 -0
  220. package/content/references/workflows/product-attribute/create-and-link-product-attributes-to-product.mdx +46 -0
  221. package/content/references/workflows/product-attribute/create-product-attribute-values.mdx +43 -0
  222. package/content/references/workflows/product-attribute/create-product-attributes.mdx +56 -0
  223. package/content/references/workflows/product-attribute/delete-product-attribute-values.mdx +30 -0
  224. package/content/references/workflows/product-attribute/delete-product-attributes.mdx +30 -0
  225. package/content/references/workflows/product-attribute/remove-product-attributes-from-product.mdx +29 -0
  226. package/content/references/workflows/product-attribute/update-product-attribute-values.mdx +44 -0
  227. package/content/references/workflows/product-attribute/update-product-attributes-on-product.mdx +41 -0
  228. package/content/references/workflows/product-attribute/update-product-attributes.mdx +48 -0
  229. package/content/references/workflows/product-attribute/upsert-product-attribute-values.mdx +43 -0
  230. package/content/references/workflows/product-edit/auto-confirm-product-change.mdx +39 -0
  231. package/content/references/workflows/product-edit/cancel-product-change.mdx +49 -0
  232. package/content/references/workflows/product-edit/confirm-product-change.mdx +57 -0
  233. package/content/references/workflows/product-edit/create-product-change.mdx +72 -0
  234. package/content/references/workflows/product-edit/reject-product-change.mdx +54 -0
  235. package/content/references/workflows/product-edit/stage-product-change.mdx +75 -0
  236. package/content/references/workflows/seller/approve-seller.mdx +34 -0
  237. package/content/references/workflows/seller/create-seller-account.mdx +59 -0
  238. package/content/references/workflows/seller/create-seller-defaults.mdx +22 -0
  239. package/content/references/workflows/seller/create-sellers.mdx +65 -0
  240. package/content/references/workflows/seller/delete-seller-professional-details.mdx +37 -0
  241. package/content/references/workflows/seller/delete-sellers.mdx +24 -0
  242. package/content/references/workflows/seller/invite-seller.mdx +28 -0
  243. package/content/references/workflows/seller/suspend-seller.mdx +35 -0
  244. package/content/references/workflows/seller/terminate-seller.mdx +35 -0
  245. package/content/references/workflows/seller/unsuspend-seller.mdx +34 -0
  246. package/content/references/workflows/seller/unterminate-seller.mdx +34 -0
  247. package/content/references/workflows/seller/update-seller-address.mdx +55 -0
  248. package/content/references/workflows/seller/update-seller-payment-details.mdx +52 -0
  249. package/content/references/workflows/seller/update-seller-professional-details.mdx +48 -0
  250. package/content/references/workflows/seller/update-sellers.mdx +57 -0
  251. package/content/resources/ai/llms.mdx +74 -0
  252. package/content/resources/ai/mcp.mdx +152 -0
  253. package/content/resources/ai/overview.mdx +97 -0
  254. package/content/resources/customization/custom-fields.mdx +182 -0
  255. package/content/resources/customization/extend-a-workflow.mdx +39 -0
  256. package/content/resources/customization/extending-panels.mdx +309 -0
  257. package/content/resources/deployment/medusa-cloud.mdx +167 -0
  258. package/content/resources/integrations/notifications.mdx +39 -0
  259. package/content/resources/integrations/search.mdx +122 -0
  260. package/content/resources/integrations/stripe-connect.mdx +395 -0
  261. package/content/resources/tutorials/add-a-block.mdx +74 -0
  262. package/content/resources/tutorials/attributes-and-variant-axes.mdx +111 -0
  263. package/content/resources/tutorials/build-a-block.mdx +134 -0
  264. package/content/resources/tutorials/configure-commissions.mdx +127 -0
  265. package/content/resources/tutorials/custom-api-route.mdx +142 -0
  266. package/content/resources/tutorials/custom-panel-page.mdx +78 -0
  267. package/content/resources/tutorials/first-marketplace.mdx +45 -0
  268. package/content/resources/tutorials/handle-product-requests.mdx +80 -0
  269. package/content/resources/tutorials/import-export-products.mdx +96 -0
  270. package/content/resources/tutorials/master-products-and-offers.mdx +89 -0
  271. package/content/resources/tutorials/recompose-a-page.mdx +129 -0
  272. package/content/resources/tutorials/replace-panel-components.mdx +116 -0
  273. package/content/resources/tutorials/seller-payouts-stripe.mdx +89 -0
  274. package/content/telemetry.mdx +67 -0
  275. package/content/tools/api-client.mdx +155 -0
  276. package/content/tools/cli.mdx +196 -0
  277. package/content/tools/dashboard-sdk.mdx +35 -0
  278. package/content/user-guide/admin/overview.mdx +23 -0
  279. package/content/user-guide/admin/stores.mdx +193 -0
  280. package/content/user-guide/vendor/overview.mdx +23 -0
  281. package/content/user-guide/vendor/stores.mdx +209 -0
  282. package/llms.txt +307 -0
  283. package/package.json +33 -0
@@ -0,0 +1,175 @@
1
+ ---
2
+ title: "Seller module"
3
+ description: "Data models, links, and service methods for the Seller module."
4
+ ---
5
+
6
+ The Seller module owns the marketplace vendor domain: the seller entity and its satellite records (professional details, address, payment details), the seller's team (members and pending invites), and the **order group** — the aggregate that binds the per-seller orders created from a single multi-vendor cart.
7
+
8
+ For the conceptual introduction, see [Sellers](/rc/learn/sellers), [Seller members](/rc/learn/seller-members), and [Order groups](/rc/learn/order-groups).
9
+
10
+ ## Data models
11
+
12
+ ### `Seller`
13
+
14
+ Table `seller`, ID prefix `sel`.
15
+
16
+ | Field | Type | Notes |
17
+ | --- | --- | --- |
18
+ | `id` | text | Primary key |
19
+ | `name` | text | Unique, searchable |
20
+ | `handle` | text | Unique, URL-friendly; auto-generated from `name` when omitted |
21
+ | `email` | text | Unique, searchable |
22
+ | `phone` | text | Nullable |
23
+ | `description` | text | Nullable |
24
+ | `logo` | text | Nullable |
25
+ | `banner` | text | Nullable |
26
+ | `website_url` | text | Nullable |
27
+ | `external_id` | text | Nullable; unique when set |
28
+ | `currency_code` | text | The seller's single operating currency |
29
+ | `status` | enum | `SellerStatus`, default `pending_approval` |
30
+ | `status_reason` | text | Nullable |
31
+ | `approved_at` | dateTime | Nullable |
32
+ | `rejected_at` | dateTime | Nullable |
33
+ | `is_premium` | boolean | Default `false`; operator-set only |
34
+ | `closed_from` / `closed_to` | dateTime | Nullable; scheduled closure window |
35
+ | `closure_note` | text | Nullable |
36
+ | `metadata` | json | Nullable |
37
+
38
+ Relations: `professional_details`, `address`, and `payment_details` (one-to-one, deleted with the seller), `members` (many-to-many through `SellerMember`), `member_invites` (one-to-many, deleted with the seller).
39
+
40
+ ### `ProfessionalDetails`
41
+
42
+ Table `professional_details`, ID prefix `selprodet`. Presence of this record marks the seller as a registered business.
43
+
44
+ | Field | Type |
45
+ | --- | --- |
46
+ | `corporate_name` | text, nullable |
47
+ | `registration_number` | text, nullable |
48
+ | `tax_id` | text, nullable |
49
+
50
+ ### `SellerAddress`
51
+
52
+ Table `seller_address`, ID prefix `seladdr`. Fields: `name`, `company`, `first_name`, `last_name`, `address_1`, `address_2`, `city`, `country_code`, `province`, `postal_code`, `phone`, `metadata` — all nullable.
53
+
54
+ ### `PaymentDetails`
55
+
56
+ Table `payment_details`, ID prefix `selpaydet`. Fields: `country_code`, `holder_name`, `bank_name`, `iban`, `bic`, `routing_number`, `account_number` — all nullable.
57
+
58
+ ### `Member`
59
+
60
+ Table `member`, ID prefix `mem`. A member is a dashboard user that can belong to one or more sellers.
61
+
62
+ | Field | Type | Notes |
63
+ | --- | --- | --- |
64
+ | `email` | text | Unique, searchable |
65
+ | `first_name` / `last_name` | text | Nullable |
66
+ | `locale` | text | Nullable |
67
+ | `is_active` | boolean | Default `true` |
68
+ | `metadata` | json | Nullable |
69
+
70
+ ### `SellerMember`
71
+
72
+ Table `seller_member`, ID prefix `selmem`. Pivot between `Seller` and `Member`; unique on (`seller_id`, `member_id`).
73
+
74
+ | Field | Type | Notes |
75
+ | --- | --- | --- |
76
+ | `role_id` | text | Nullable; resolved against the RBAC roles module |
77
+ | `is_owner` | boolean | Default `false` |
78
+ | `metadata` | json | Nullable |
79
+
80
+ ### `MemberInvite`
81
+
82
+ Table `member_invite`, ID prefix `meminv`. Unique on (`email`, `seller_id`) while unaccepted.
83
+
84
+ | Field | Type | Notes |
85
+ | --- | --- | --- |
86
+ | `email` | text | Searchable |
87
+ | `token` | text | Signed JWT |
88
+ | `accepted` | boolean | Default `false` |
89
+ | `expires_at` | dateTime | Derived from `invite_valid_duration` |
90
+ | `role_id` | text | Role assigned on acceptance |
91
+ | `metadata` | json | Nullable |
92
+
93
+ ### `OrderGroup`
94
+
95
+ Table `order_group`, ID prefix `og`. Created when a multi-vendor cart completes.
96
+
97
+ | Field | Type | Notes |
98
+ | --- | --- | --- |
99
+ | `display_id` | autoincrement | Shopper-facing number |
100
+ | `cart_id` | text | The originating cart |
101
+ | `customer_id` | text | Nullable |
102
+ | `seller_count` | number | Computed |
103
+ | `total` | bigNumber | Computed across child orders |
104
+
105
+ ## Enums
106
+
107
+ ```ts
108
+ enum SellerStatus {
109
+ OPEN = "open",
110
+ PENDING_APPROVAL = "pending_approval",
111
+ SUSPENDED = "suspended",
112
+ TERMINATED = "terminated",
113
+ }
114
+
115
+ enum SellerRole {
116
+ SELLER_ADMINISTRATION = "role_seller_administration",
117
+ INVENTORY_MANAGEMENT = "role_seller_inventory_management",
118
+ ORDER_MANAGEMENT = "role_seller_order_management",
119
+ ACCOUNTING = "role_seller_accounting",
120
+ SUPPORT = "role_seller_support",
121
+ }
122
+ ```
123
+
124
+ ## Links
125
+
126
+ The seller is the anchor of the marketplace graph. Nearly every seller-scoped resource is connected through a module link rather than a foreign key:
127
+
128
+ | Linked entity | Cardinality | Purpose |
129
+ | --- | --- | --- |
130
+ | `Product.product` | many-to-many (`product_seller`) | Selling-eligibility allowlist for [master products](/rc/references/modules/product-edit) |
131
+ | `Order.order` | one seller — many orders | Per-seller child orders |
132
+ | `Payout.payout` | one seller — many payouts | Settlements |
133
+ | `Payout.payoutAccount` | one-to-one | The seller's provider account |
134
+ | `Pricing.priceList` | one seller — many lists | Vendor price lists |
135
+ | `Promotion.promotion` / `Promotion.campaign` | one seller — many | Vendor promotions and campaigns |
136
+ | `Inventory.inventoryItem` | one seller — many items | Vendor inventory |
137
+ | `StockLocation.stockLocation` | one seller — many | Vendor locations |
138
+ | `Fulfillment.shippingProfile` / `shippingOption` / `fulfillmentSet` / `serviceZone` | one seller — many | Vendor shipping setup |
139
+ | `Customer.customer` / `customerGroup` | many-to-many / one seller — many | Vendor customer base |
140
+ | `Product.productCategory` | many-to-many | Categories a seller may sell in |
141
+
142
+ Order groups carry two additional links: a read-only link to the originating `Cart` (via `cart_id`) and a list link to the child `Order` records (table `order_group_order`). The `SellerMember.role_id` field is a read-only link into the RBAC roles module.
143
+
144
+ ## Service
145
+
146
+ `SellerModuleService` extends `MedusaService` with auto-generated CRUD for all models above, plus:
147
+
148
+ | Method | Behavior |
149
+ | --- | --- |
150
+ | `createSellers(data)` / `updateSellers(data)` | Validates the handle and auto-generates it from `name` when missing |
151
+ | `upsertMembers(data)` | Dedupes by email, creates missing members, backfills empty names; returns members in input order |
152
+ | `createMemberInvites(data)` | Rejects emails that already belong to the seller; issues a JWT token with an expiry |
153
+ | `validateMemberInviteToken(token)` | Verifies the JWT and rejects accepted or expired invites |
154
+ | `listOrderGroups` / `listAndCountOrderGroups` / `retrieveOrderGroup` | Custom repository-backed reads that resolve the computed `seller_count` and `total` fields |
155
+
156
+ ## Module options
157
+
158
+ | Option | Type | Default | Purpose |
159
+ | --- | --- | --- | --- |
160
+ | `invite_valid_duration` | number (seconds) | 7 days | Member invite lifetime |
161
+ | `jwt_secret` | string | project `http.jwtSecret` | Signs invite tokens |
162
+ | `vendor_url` | string | `MERCUR_VENDOR_URL` env var | Vendor dashboard base URL used in invite links |
163
+
164
+ ## Related endpoints
165
+
166
+ - [Admin API — sellers, members, order groups](/rc/references/api/admin)
167
+ - [Vendor API — sellers, members](/rc/references/api/vendor)
168
+ - [Store API — public seller storefronts](/rc/references/api/store)
169
+
170
+ ## Next steps
171
+
172
+ <CardGroup cols={2}>
173
+ <Card title="Commission module" href="/rc/references/modules/commission" />
174
+ <Card title="Payout module" href="/rc/references/modules/payout" />
175
+ </CardGroup>
@@ -0,0 +1,70 @@
1
+ ---
2
+ title: "References"
3
+ description: "Technical references for Mercur's modules, HTTP APIs, workflows, and configuration."
4
+ ---
5
+
6
+ This section is the technical contract of the Mercur core plugin. Where the [Learn](/rc/learn/introduction) tab explains concepts, these pages document the exact surface: data models and their fields, module links, service methods, HTTP routes, workflow names, and configuration options.
7
+
8
+ ## Modules
9
+
10
+ Every marketplace capability ships as a Medusa module inside `@mercurjs/core`. Each reference covers the module's data models, enums, links to Medusa core entities, service methods, and options.
11
+
12
+ <CardGroup cols={3}>
13
+ <Card title="Seller" href="/rc/references/modules/seller">
14
+ Sellers, members, invites, and order groups.
15
+ </Card>
16
+ <Card title="Commission" href="/rc/references/modules/commission">
17
+ Commission rates, rules, and per-order commission lines.
18
+ </Card>
19
+ <Card title="Payout" href="/rc/references/modules/payout">
20
+ Payout accounts, onboarding, payouts, and the provider interface.
21
+ </Card>
22
+ <Card title="Offer" href="/rc/references/modules/offer">
23
+ Per-seller listings binding a variant to SKU, price, and inventory.
24
+ </Card>
25
+ <Card title="Product Attribute" href="/rc/references/modules/product-attribute">
26
+ Configurable attributes, values, and variant axes on native product options.
27
+ </Card>
28
+ <Card title="Product Edit" href="/rc/references/modules/product-edit">
29
+ Product change requests and the approval queue.
30
+ </Card>
31
+ <Card title="Media" href="/rc/references/modules/media">
32
+ Image galleries, thumbnails, banners, and icons for categories and collections.
33
+ </Card>
34
+ <Card title="Search" href="/rc/references/modules/search">
35
+ Provider-agnostic search with the built-in Orama provider.
36
+ </Card>
37
+ <Card title="Custom Fields" href="/rc/references/modules/custom-fields">
38
+ Extra columns on any entity without a custom module.
39
+ </Card>
40
+ </CardGroup>
41
+
42
+ ## HTTP API
43
+
44
+ Mercur extends the Medusa server with three route surfaces. Start with the conventions page — authentication, seller scoping, and pagination work the same way across all of them.
45
+
46
+ <CardGroup cols={2}>
47
+ <Card title="API conventions" href="/rc/references/api/conventions">
48
+ Authentication, seller scoping, pagination, field selection, and webhooks.
49
+ </Card>
50
+ <Card title="Admin API" href="/rc/references/api/admin">
51
+ Operator routes under <code>/admin/*</code>.
52
+ </Card>
53
+ <Card title="Vendor API" href="/rc/references/api/vendor">
54
+ Seller-scoped routes under <code>/vendor/*</code>.
55
+ </Card>
56
+ <Card title="Store API" href="/rc/references/api/store">
57
+ Storefront routes under <code>/store/*</code>.
58
+ </Card>
59
+ </CardGroup>
60
+
61
+ ## Workflows and configuration
62
+
63
+ <CardGroup cols={2}>
64
+ <Card title="Workflows" href="/rc/references/workflows">
65
+ Every workflow exported by <code>@mercurjs/core</code>, grouped by domain.
66
+ </Card>
67
+ <Card title="Configuration" href="/rc/references/configuration">
68
+ <code>withMercur()</code>, environment variables, and provider options.
69
+ </Card>
70
+ </CardGroup>
@@ -0,0 +1,44 @@
1
+ ---
2
+ title: "addSellerShippingMethodToCartWorkflow"
3
+ description: "Add shipping methods to a cart, replacing only the same seller's existing methods."
4
+ ---
5
+
6
+ Seller-aware variant of Medusa's `addShippingMethodToCartWorkflow`. Validates the requested options against the cart and their calculated prices, then swaps shipping methods per seller: existing methods belonging to the sellers whose options are being added are removed, while other sellers' methods stay untouched — so a multi-seller cart keeps one shipping method per seller. Refreshes cart items afterwards and emits `cart.updated`. Triggered by `POST /store/carts/:id/shipping-methods`.
7
+
8
+ ## Usage
9
+
10
+ ```ts
11
+ import { addSellerShippingMethodToCartWorkflow } from "@mercurjs/core/workflows"
12
+
13
+ await addSellerShippingMethodToCartWorkflow(container).run({
14
+ input: {
15
+ cart_id: "cart_123",
16
+ options: [{ id: "so_123" }],
17
+ },
18
+ })
19
+ ```
20
+
21
+ ## Input
22
+
23
+ <ParamField body="cart_id" type="string" required>The cart to add shipping methods to.</ParamField>
24
+ <ParamField body="options" type="object[]" required>Shipping options to add as methods.
25
+ <Expandable title="properties">
26
+ <ParamField body="id" type="string" required>The shipping option ID; must have a calculated price for the cart.</ParamField>
27
+ <ParamField body="data" type="object">Custom method data validated by the fulfillment provider.</ParamField>
28
+ </Expandable>
29
+ </ParamField>
30
+ <ParamField body="additional_data" type="object">Custom data passed through to the workflow hooks.</ParamField>
31
+
32
+ ## Result
33
+
34
+ <ResponseField name="result" type="void">No return value; the cart's shipping methods are replaced per seller as a side effect.</ResponseField>
35
+
36
+ ## Hooks
37
+
38
+ - `validate` — runs after the cart is loaded with `{ input, cart }`.
39
+
40
+ ```ts
41
+ addSellerShippingMethodToCartWorkflow.hooks.validate(async ({ input, cart }) => {
42
+ // throw to reject the shipping method
43
+ })
44
+ ```
@@ -0,0 +1,36 @@
1
+ ---
2
+ title: "completeCartWithSplitOrdersWorkflow"
3
+ description: "Complete a multi-seller cart by splitting it into per-seller orders under an order group."
4
+ ---
5
+
6
+ Mercur's replacement for Medusa's `completeCartWorkflow` and the heart of multi-vendor checkout. It groups the cart's items by the seller behind each item's offer, creates one order per seller (each carrying only that seller's items, shipping methods, addresses, and promotion adjustments), and wraps them in a single `OrderGroup` the shopper tracks as one purchase. Along the way it validates seller items and shipping coverage, mirrors line-item ↔ offer links onto the new order items, reserves offer inventory, registers promotion usage, links orders to the cart, sellers, payment collection, and order group, authorizes the single payment session, distributes captured amounts proportionally as order transactions, and refreshes each order's commission lines via `refreshOrderCommissionLinesWorkflow`. The run is idempotent per cart — an existing order group for the cart is returned instead of re-creating orders. Emits `order.placed` (one entry per child order) and `order_group.created`. Triggered by `POST /store/carts/:id/complete`.
7
+
8
+ ## Usage
9
+
10
+ ```ts
11
+ import { completeCartWithSplitOrdersWorkflow } from "@mercurjs/core/workflows"
12
+
13
+ const { result } = await completeCartWithSplitOrdersWorkflow(container).run({
14
+ input: { cart_id: "cart_123" },
15
+ })
16
+ ```
17
+
18
+ ## Input
19
+
20
+ <ParamField body="cart_id" type="string" required>The cart to complete; must have an authorized-able payment session and seller-scoped shipping methods covering every seller in the cart.</ParamField>
21
+
22
+ ## Result
23
+
24
+ <ResponseField name="result.order_group_id" type="string">ID of the order group wrapping the per-seller orders — either newly created or the one already created for this cart.</ResponseField>
25
+
26
+ ## Hooks
27
+
28
+ - `validate` — runs after the cart is loaded (before any orders are created) with `{ input, cart }`.
29
+ - `beforePaymentAuthorization` — runs after orders and links are created, right before the payment session is authorized, with `{ input }`.
30
+ - `orderGroupCreated` — runs at the end of the creation branch with `{ order_group_id, cart_id }`.
31
+
32
+ ```ts
33
+ completeCartWithSplitOrdersWorkflow.hooks.validate(async ({ input, cart }) => {
34
+ // throw to block checkout
35
+ })
36
+ ```
@@ -0,0 +1,39 @@
1
+ ---
2
+ title: "listSellerShippingOptionsForCartWorkflow"
3
+ description: "List available shipping options for a cart, grouped by seller."
4
+ ---
5
+
6
+ Resolves the sellers behind the cart's offers, finds their stock locations valid for the cart's sales channel, and queries shipping options in those locations' fulfillment sets with cart-scoped pricing. Each option carries its calculated `amount`, `is_tax_inclusive`, and an `insufficient_inventory` flag when the seller's location can't cover the cart quantities. Options are translated to the cart locale and returned keyed by seller ID. Triggered by `GET /store/shipping-options`.
7
+
8
+ ## Usage
9
+
10
+ ```ts
11
+ import { listSellerShippingOptionsForCartWorkflow } from "@mercurjs/core/workflows"
12
+
13
+ const { result } = await listSellerShippingOptionsForCartWorkflow(container).run({
14
+ input: { cart_id: "cart_123" },
15
+ })
16
+ ```
17
+
18
+ ## Input
19
+
20
+ <ParamField body="cart_id" type="string" required>The cart to list options for; must have `sales_channel_id`, `region_id`, and `currency_code` set.</ParamField>
21
+ <ParamField body="is_return" type="boolean">List return shipping options instead; defaults to `false`.</ParamField>
22
+ <ParamField body="enabled_in_store" type="boolean">Only options enabled in the storefront; defaults to `true`.</ParamField>
23
+ <ParamField body="fields" type="string[]">Extra shipping-option fields to retrieve on top of the defaults.</ParamField>
24
+ <ParamField body="additional_data" type="object">Custom data passed through to the workflow hooks.</ParamField>
25
+
26
+ ## Result
27
+
28
+ <ResponseField name="result" type="Record<string, ShippingOptionDTO[]>">Map of seller ID to that seller's priced shipping options, each extended with `amount`, `is_tax_inclusive`, and `insufficient_inventory`.</ResponseField>
29
+
30
+ ## Hooks
31
+
32
+ - `setPricingContext` — runs with `{ cart, fulfillmentSetIds, additional_data }`; return a record to merge into the price calculation context.
33
+ - `setShippingOptionsContext` — runs with the same payload; return a record to merge into the shipping-option rule context.
34
+
35
+ ```ts
36
+ listSellerShippingOptionsForCartWorkflow.hooks.setPricingContext(async ({ cart }) => {
37
+ return { customer_tier: "vip" }
38
+ })
39
+ ```
@@ -0,0 +1,42 @@
1
+ ---
2
+ title: "updateCartSellerPromotionsWorkflow"
3
+ description: "Apply, remove, or replace promotion codes on a cart with seller-scoped adjustments."
4
+ ---
5
+
6
+ Seller-aware variant of Medusa's `updateCartPromotionsWorkflow`. Computes promotion actions for the requested codes, then prepares line-item and shipping-method adjustments so each promotion only discounts the owning seller's items, before creating/removing adjustments and syncing the cart's applied promotions. Optionally refreshes the payment collection. Triggered by `POST /store/carts/:id/promotions`.
7
+
8
+ ## Usage
9
+
10
+ ```ts
11
+ import { updateCartSellerPromotionsWorkflow } from "@mercurjs/core/workflows"
12
+
13
+ await updateCartSellerPromotionsWorkflow(container).run({
14
+ input: {
15
+ cart_id: "cart_123",
16
+ promo_codes: ["SUMMER10"],
17
+ action: "add",
18
+ },
19
+ })
20
+ ```
21
+
22
+ ## Input
23
+
24
+ <ParamField body="cart_id" type="string" required>The cart to update promotions on.</ParamField>
25
+ <ParamField body="promo_codes" type="string[]">Promotion codes to apply; defaults to `[]`.</ParamField>
26
+ <ParamField body="action" type="string">One of `add`, `remove`, `replace`; defaults to `add`.</ParamField>
27
+ <ParamField body="cart" type="object">Preloaded cart data; skips the internal cart fetch when provided.</ParamField>
28
+ <ParamField body="force_refresh_payment_collection" type="boolean">Refresh the cart's payment collection after adjustments change.</ParamField>
29
+
30
+ ## Result
31
+
32
+ <ResponseField name="result" type="void">No return value; the cart's adjustments and applied promotions are updated as a side effect.</ResponseField>
33
+
34
+ ## Hooks
35
+
36
+ - `validate` — runs after the cart is loaded with `{ input, cart }`.
37
+
38
+ ```ts
39
+ updateCartSellerPromotionsWorkflow.hooks.validate(async ({ input, cart }) => {
40
+ // throw to reject the promotion change
41
+ })
42
+ ```
@@ -0,0 +1,45 @@
1
+ ---
2
+ title: "batchCommissionRulesWorkflow"
3
+ description: "Create, update, and delete a commission rate's rules in one call."
4
+ ---
5
+
6
+ Runs create, update, and delete operations on a commission rate's rules in parallel. Rules bind a rate to a reference (e.g. a seller, category, or product type) so the rate applies when an order line matches. Triggered by `POST /admin/commission-rates/:id/rules`.
7
+
8
+ ## Usage
9
+
10
+ ```ts
11
+ import { batchCommissionRulesWorkflow } from "@mercurjs/core/workflows"
12
+
13
+ const { result } = await batchCommissionRulesWorkflow(container).run({
14
+ input: {
15
+ commission_rate_id: "comrate_123",
16
+ create: [{ reference: "seller", reference_id: "sel_123" }],
17
+ update: [{ id: "comrule_456", reference_id: "sel_789" }],
18
+ delete: ["comrule_999"],
19
+ },
20
+ })
21
+ ```
22
+
23
+ ## Input
24
+
25
+ <ParamField body="commission_rate_id" type="string" required>The commission rate the rules belong to.</ParamField>
26
+ <ParamField body="create" type="object[]">Rules to create.
27
+ <Expandable title="properties">
28
+ <ParamField body="reference" type="string" required>Entity type the rule targets (e.g. `seller`, `product_category`, `product_type`).</ParamField>
29
+ <ParamField body="reference_id" type="string" required>ID of the referenced entity.</ParamField>
30
+ </Expandable>
31
+ </ParamField>
32
+ <ParamField body="update" type="object[]">Rules to update.
33
+ <Expandable title="properties">
34
+ <ParamField body="id" type="string" required>The rule to update.</ParamField>
35
+ <ParamField body="reference" type="string">New reference type.</ParamField>
36
+ <ParamField body="reference_id" type="string">New referenced entity ID.</ParamField>
37
+ </Expandable>
38
+ </ParamField>
39
+ <ParamField body="delete" type="string[]">IDs of rules to delete.</ParamField>
40
+
41
+ ## Result
42
+
43
+ <ResponseField name="result.created" type="CommissionRuleDTO[]">The created rules.</ResponseField>
44
+ <ResponseField name="result.updated" type="CommissionRuleDTO[]">The updated rules.</ResponseField>
45
+ <ResponseField name="result.deleted" type="string[]">IDs of the deleted rules.</ResponseField>
@@ -0,0 +1,41 @@
1
+ ---
2
+ title: "createCommissionRatesWorkflow"
3
+ description: "Create one or more commission rates."
4
+ ---
5
+
6
+ Creates commission rates — the fee definitions (flat or percentage) applied to seller orders. A unique `code` is auto-generated from the name when not provided. Triggered by `POST /admin/commission-rates`.
7
+
8
+ ## Usage
9
+
10
+ ```ts
11
+ import { createCommissionRatesWorkflow } from "@mercurjs/core/workflows"
12
+
13
+ const { result } = await createCommissionRatesWorkflow(container).run({
14
+ input: [
15
+ {
16
+ name: "Default commission",
17
+ type: "percentage",
18
+ value: 10,
19
+ is_default: true,
20
+ },
21
+ ],
22
+ })
23
+ ```
24
+
25
+ ## Input
26
+
27
+ The input is an array of commission rates to create.
28
+
29
+ <ParamField body="name" type="string" required>Display name of the rate.</ParamField>
30
+ <ParamField body="type" type="string" required>One of `fixed`, `percentage`.</ParamField>
31
+ <ParamField body="value" type="number" required>Rate value — a percentage for `percentage`, an amount for `fixed`.</ParamField>
32
+ <ParamField body="code" type="string">Unique code; auto-generated from the name when omitted.</ParamField>
33
+ <ParamField body="currency_code" type="string | null">Currency of a `fixed` rate.</ParamField>
34
+ <ParamField body="include_tax" type="boolean">Include tax totals in the commission base.</ParamField>
35
+ <ParamField body="include_shipping" type="boolean">Also apply the rate to shipping methods.</ParamField>
36
+ <ParamField body="is_enabled" type="boolean">Whether the rate is active.</ParamField>
37
+ <ParamField body="is_default" type="boolean">Marks the rate as the platform-wide fallback.</ParamField>
38
+
39
+ ## Result
40
+
41
+ <ResponseField name="result" type="CommissionRateDTO[]">The created commission rates.</ResponseField>
@@ -0,0 +1,34 @@
1
+ ---
2
+ title: "deleteCommissionRatesWorkflow"
3
+ description: "Soft-delete commission rates after validating they can be removed."
4
+ ---
5
+
6
+ Validates the rates are deletable, then soft-deletes them. Deletion is reversible on workflow failure (compensation restores the rates). Triggered by `DELETE /admin/commission-rates/:id`.
7
+
8
+ ## Usage
9
+
10
+ ```ts
11
+ import { deleteCommissionRatesWorkflow } from "@mercurjs/core/workflows"
12
+
13
+ await deleteCommissionRatesWorkflow(container).run({
14
+ input: { ids: ["comrate_123"] },
15
+ })
16
+ ```
17
+
18
+ ## Input
19
+
20
+ <ParamField body="ids" type="string[]" required>IDs of the commission rates to delete.</ParamField>
21
+
22
+ ## Result
23
+
24
+ <ResponseField name="result" type="void">No return value; the rates are soft-deleted.</ResponseField>
25
+
26
+ ## Hooks
27
+
28
+ - `commissionRatesDeleted` — runs after deletion with `{ ids }`.
29
+
30
+ ```ts
31
+ deleteCommissionRatesWorkflow.hooks.commissionRatesDeleted(async ({ ids }) => {
32
+ // react to deleted rates
33
+ })
34
+ ```
@@ -0,0 +1,30 @@
1
+ ---
2
+ title: "refreshOrderCommissionLinesWorkflow"
3
+ description: "Recompute the commission lines for one or more orders."
4
+ ---
5
+
6
+ Loads each order with its items, products, sellers, and shipping methods, evaluates the matching commission rates, and upserts a commission line per item and shipping method (delete-then-insert, so re-running is idempotent). Runs inside `completeCartWithSplitOrdersWorkflow` after orders are created, and again from the `order-edit-confirmed` subscriber on order edits, returns, claims, and exchanges.
7
+
8
+ ## Usage
9
+
10
+ ```ts
11
+ import { refreshOrderCommissionLinesWorkflow } from "@mercurjs/core/workflows"
12
+
13
+ const { result } = await refreshOrderCommissionLinesWorkflow(container).run({
14
+ input: { order_ids: ["order_123"] },
15
+ })
16
+ ```
17
+
18
+ ## Input
19
+
20
+ <ParamField body="order_ids" type="string[]" required>IDs of the orders to recompute commission lines for; fails if any order is not found.</ParamField>
21
+
22
+ ## Result
23
+
24
+ <ResponseField name="result" type="CommissionLineDTO[]">The upserted commission lines.</ResponseField>
25
+ <ResponseField name="result[].item_id" type="string | null">The order line item the commission applies to.</ResponseField>
26
+ <ResponseField name="result[].shipping_method_id" type="string | null">The shipping method the commission applies to.</ResponseField>
27
+ <ResponseField name="result[].commission_rate_id" type="string | null">The rate that produced the line.</ResponseField>
28
+ <ResponseField name="result[].code" type="string">Code of the applied rate.</ResponseField>
29
+ <ResponseField name="result[].rate" type="number">Rate value applied.</ResponseField>
30
+ <ResponseField name="result[].amount" type="number">Commission amount in the order currency.</ResponseField>
@@ -0,0 +1,35 @@
1
+ ---
2
+ title: "updateCommissionRatesWorkflow"
3
+ description: "Update one or more commission rates."
4
+ ---
5
+
6
+ Applies partial updates to existing commission rates by ID. Triggered by `POST /admin/commission-rates/:id`.
7
+
8
+ ## Usage
9
+
10
+ ```ts
11
+ import { updateCommissionRatesWorkflow } from "@mercurjs/core/workflows"
12
+
13
+ const { result } = await updateCommissionRatesWorkflow(container).run({
14
+ input: [{ id: "comrate_123", value: 12, is_enabled: true }],
15
+ })
16
+ ```
17
+
18
+ ## Input
19
+
20
+ The input is an array of commission rate updates.
21
+
22
+ <ParamField body="id" type="string" required>The commission rate to update.</ParamField>
23
+ <ParamField body="name" type="string">Display name of the rate.</ParamField>
24
+ <ParamField body="code" type="string">Unique code of the rate.</ParamField>
25
+ <ParamField body="type" type="string">One of `fixed`, `percentage`.</ParamField>
26
+ <ParamField body="value" type="number">Rate value — a percentage for `percentage`, an amount for `fixed`.</ParamField>
27
+ <ParamField body="currency_code" type="string | null">Currency of a `fixed` rate.</ParamField>
28
+ <ParamField body="include_tax" type="boolean">Include tax totals in the commission base.</ParamField>
29
+ <ParamField body="include_shipping" type="boolean">Also apply the rate to shipping methods.</ParamField>
30
+ <ParamField body="is_enabled" type="boolean">Whether the rate is active.</ParamField>
31
+ <ParamField body="is_default" type="boolean">Marks the rate as the platform-wide fallback.</ParamField>
32
+
33
+ ## Result
34
+
35
+ <ResponseField name="result" type="CommissionRateDTO[]">The updated commission rates.</ResponseField>
@@ -0,0 +1,41 @@
1
+ ---
2
+ title: "setCategoryImagesWorkflow"
3
+ description: "Replace a category's media gallery and icon, enforcing single thumbnail/banner."
4
+ ---
5
+
6
+ Replaces a product category's media. When `media` is provided, the entire existing gallery is swapped for the new list; when `icon` is provided, the existing icon image is swapped (pass `null` to clear it). Omitted fields are left untouched. At most one image keeps `is_thumbnail` and one keeps `is_banner` — the first flagged entry wins and later flags are silently dropped. Usually invoked through the `createProductCategoryWithImagesWorkflow`, `updateProductCategoryWithImagesWorkflow`, and `deleteProductCategoryWithImagesWorkflow` wrappers behind the `/admin/product-categories` routes.
7
+
8
+ ## Usage
9
+
10
+ ```ts
11
+ import { setCategoryImagesWorkflow } from "@mercurjs/core/workflows"
12
+
13
+ await setCategoryImagesWorkflow(container).run({
14
+ input: {
15
+ category_id: "pcat_123",
16
+ media: [
17
+ { url: "https://cdn.example.com/hero.jpg", is_banner: true },
18
+ { url: "https://cdn.example.com/thumb.jpg", is_thumbnail: true },
19
+ ],
20
+ icon: "https://cdn.example.com/icon.svg",
21
+ },
22
+ })
23
+ ```
24
+
25
+ ## Input
26
+
27
+ <ParamField body="category_id" type="string" required>The category whose images are replaced.</ParamField>
28
+ <ParamField body="media" type="CategoryMediaInput[]">
29
+ New gallery; replaces all existing non-icon images (pass `[]` to clear).
30
+ <Expandable title="properties">
31
+ <ParamField body="url" type="string" required>Public URL of the image.</ParamField>
32
+ <ParamField body="is_thumbnail" type="boolean">Mark as the thumbnail; only the first flagged image is honoured.</ParamField>
33
+ <ParamField body="is_banner" type="boolean">Mark as the banner; only the first flagged image is honoured.</ParamField>
34
+ <ParamField body="rank" type="number">Sort rank; defaults to the array index.</ParamField>
35
+ </Expandable>
36
+ </ParamField>
37
+ <ParamField body="icon" type="string | null">New icon URL; `null` removes the current icon, omit to keep it.</ParamField>
38
+
39
+ ## Result
40
+
41
+ <ResponseField name="result" type="void">No return value.</ResponseField>