Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Call a marketplace seller a Seller

Damian Legawiec8b3aafdbf4a7
diff --git a/CLAUDE.md b/CLAUDE.md
index be36dd4e99..bc433b7e03 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -12,7 +12,7 @@ When proposing significant architectural changes:
Use `/project:create-plan` and `/project:update-plan` for plan management.
Active plans (6.0 target, work pending):
-- `6.0-multi-vendor-marketplace.md` — Open-source the marketplace core (Vendor, OrderGroup-based order splitting, commission engine with EU commission taxation, `VendorTransfer`/`VendorPayout` ledger + pluggable `PayoutProvider`) per spree/spree#13323. 6.0 headline feature; rebuilds the legacy Enterprise multi-vendor module as native models on the Cart/Order split. Basic Stripe Connect payouts (Express onboarding + on-fulfillment transfers) ship OSS in the monorepo, alongside the Stripe core gateway pulled in from the standalone `spree_stripe` repo (payment-sessions classes only, likely `spree/core` — decisions.md 2026-07-15); Enterprise keeps refund clawbacks/netting, reconciliation, KYC ops, DAC7 payout reports, facilitator taxes + Shopify/WooCommerce vendor apps. **Vendor principal + surface (Decision 10, 2026-08-15):** vendor staff are `Spree.admin_user_class` (no `VendorUser`; membership by `RoleUser.resource_type`, never `store_id`) on a dedicated `/api/v3/vendor` branch — own `vendor_api` JWT audience, own `Spree.vendor_authentication_strategies` + `/vendor/auth/*`, audience-stamped refresh tokens, every endpoint scope-fetched through `current_vendor` (store derived from the vendor); vendors never call the Admin API and admin controllers are never subclassed into the vendor namespace.
+- `6.0-multi-vendor-marketplace.md` — Open-source the marketplace core (Seller, OrderGroup-based order splitting, commission engine with EU commission taxation, `SellerTransfer`/`SellerPayout` ledger + pluggable `PayoutProvider`) per spree/spree#13323. 6.0 headline feature; rebuilds the legacy Enterprise multi-seller module as native models on the Cart/Order split. Basic Stripe Connect payouts (Express onboarding + on-fulfillment transfers) ship OSS in the monorepo, alongside the Stripe core gateway pulled in from the standalone `spree_stripe` repo (payment-sessions classes only, likely `spree/core` — decisions.md 2026-07-15); Enterprise keeps refund clawbacks/netting, reconciliation, KYC ops, DAC7 payout reports, facilitator taxes + Shopify/WooCommerce seller apps. **Seller principal + surface (Decision 10, 2026-08-15):** seller staff are `Spree.admin_user_class` (no `SellerUser`; membership by `RoleUser.resource_type`, never `store_id`) on a dedicated `/api/v3/seller` branch — own `seller_api` JWT audience, own `Spree.seller_authentication_strategies` + `/seller/auth/*`, audience-stamped refresh tokens, every endpoint scope-fetched through `current_seller` (store derived from the seller); sellers never call the Admin API and admin controllers are never subclassed into the seller namespace.
- `6.0-cart-order-split.md` — Cart/Order model separation, dual-FK owner everywhere (`cart_id`/`order_id` exactly-one, `#owner` as method — NOT polymorphic), idempotent copy-on-completion (`Order#cart_id` unique, order-before-payment), Order state machine removed (Checkout::Requirements for steps; payment/fulfillment statuses derived-then-persisted via one recompute service). **Shipped to 6-0-dev (feature/6-0-core-rewrite Waves 1+5):** Cart owns checkout end to end, machine + `spree_orders.state` gone, `Carts::Complete` three-phase pipeline live, `Orders::UpdateStatuses` sole status writer; only Wave 7 data migration (incomplete orders → carts) remains
- `6.0-admin-api.md` — Admin REST API conventions, auth, endpoint list (~300 endpoints)
- `6.0-admin-spa.md` — React admin architecture, extension points, table registry, i18n + server-error mapping
@@ -33,7 +33,7 @@ Active plans (6.0 target, work pending):
- `6.0-drop-country-state-models.md` — Delete the `Spree::Country`/`Spree::State` AR models in 6.0 (the tables and legacy FK columns survive to 6.1 as the upgrade task's source data); constants survive as `countries`-gem-backed value objects (carmen removed), consumers store `country_code` + `state_code` strings (always paired — subdivision codes aren't globally unique), Address validation semantics preserved (`STATES_REQUIRED` constants become runtime source of truth). No `id` was ever exposed, so the only v3 changes are the `state_abbr`→`state_code` and `country_iso`→`country_code` renames (Market's list moves `country_isos`→`country_codes`) — `Spree::Address` alone keeps `state_abbr` and `country_iso` as deprecated read/write bridges until 6.1. Amends tax-provider Phase 5 (TaxRate columns born as ISO strings, not FKs) and delivery-zone members. **Shipped (2026-08-14):** value objects live, carmen + country/state seeds + row-creating fallbacks deleted; `Spree::IsoData` curated registry + drift-guard spec, ISO columns on addresses/delivery-zone-members/market-countries/stock-locations/stores with `spree:upgrade:migrate_country_state_codes` in the 5.6→6.0 manifest, every consumer matching on codes, admin FK params closed, country endpoints uncached, factories built from real ISO data. `Spree::Zone`/`ZoneMember` are migration-only shells (no `zoneable` association; the data tasks resolve member ids against the legacy tables via SQL) and drop in 6.1 with the tables. **Constraint now:** no new `country_id`/`state_id` FKs or `belongs_to :country/:state` anywhere — a new model carrying geography declares `has_iso_geography` (`Spree::HasIsoGeography`, on `Spree::Base`; `state: false` for country-only tables) and stores ISO strings in columns named `country_code` + `state_code` — never `country_iso` or `state_abbr`; preference-based rules follow `Promotion::Rules::Country`
- `6.0-integrations-admin.md` — **Implemented (2026-08-06).** `Spree::Integration` as the single credential surface for all provider seams (delivery rates/tax/fulfillment/pickup points): explicit `Spree.integrations` registry, Admin API v3 CRUD + types discovery (reusing `PreferenceSchema`/`Masking` — secrets are `:password` preferences), dashboard `/settings/integrations` gallery grouped by `integration_group`. Verify-before-activate (`active: true` runs `can_connect?`, 422 on failure), ephemeral connection status. Constraints now: provider gems ship an Integration subclass (no env-var credential contracts for per-store providers); no per-provider credential UIs — pickers deep-link to the integrations page.
- `6.0-rich-text-descriptions.md` — Drop ActionText **entirely** at 6.0 (incl. CustomFields::RichText values + Order/User internal notes; gem dependency removed), store sanitized HTML in text columns, serve `field` + `field_html`, **write via `field_html`** (read/write symmetry). description_html serializer shipped 5.4; sanitizer shipped in **5.6.2** with a permissive-but-safe configurable allowlist + `sanitize_rich_text` step in the 5.5→5.6 upgrade manifest (decisions.md 2026-07-27/28), tightened to the Tiptap set at 6.0
-- `6.0-inventory-operations.md` — StockTransfer lifecycle (draft → ready_to_ship → in_transit → received with partial receive), new `Spree::PurchaseOrder` + `Spree::Supplier` (renamed from Vendor — `Spree::Vendor` is the marketplace seller, see decisions.md 2026-07-14) replacing today's "external receive" hack, variant + stock-location stock history panels. Consumes the typed-movement primitives from `6.0-typed-stock-movements.md`.
+- `6.0-inventory-operations.md` — StockTransfer lifecycle (draft → ready_to_ship → in_transit → received with partial receive), new `Spree::PurchaseOrder` + `Spree::Supplier` (the procurement source; `Spree::Seller` is the marketplace seller — see decisions.md 2026-07-14 and 2026-08-17) replacing today's "external receive" hack, variant + stock-location stock history panels. Consumes the typed-movement primitives from `6.0-typed-stock-movements.md`.
- `6.0-replace-taxons-with-categories.md` — Split Taxon into Category (hierarchy) + Collection (flat/rule-based). **Shipped to 6-0-dev (PR #14302):** the Category surface (5.5–5.6) plus the 6.0 core — `spree_taxons`→`spree_categories` table rename + inheritance flip (`Spree::Category < Spree.base_class`, `Spree::Taxon` alias kept), the full `Collection` stack (model + rules + DB/Meilisearch manual sort + API), the taxon→category/collection data migration, and de-ruling Category. Pending (all 6.1): channel-aware `CollectionRules::AvailableOn` (ships interim now, rides with channels) + dropping `spree_taxon_rules`/`Taxonomy`. No brand feature in 6.0 — brands are modeled as a Category/Collection; `brand_taxon`/`brand_name` removed with `Taxonomy`.
- `6.0-delivery-method-rules.md` — `Spree::DeliveryMethodRule` STI on DeliveryMethod (design finalized 2026-07-29): ItemTotal/Weight rules first (Channel/Market/CustomerGroup later in lockstep with payment-method-rules), enforced solely in `Stock::Estimator`'s method filter so calculator- AND provider-priced methods obey eligibility; replaces the FlatRate-only bound preferences (one-release bridge + data task). **Phase 1 shipped** (rules + Estimator seam + admin nested CRUD/types discovery + dashboard Conditions card). **2026-08-06:** `ExcludedProductsRule` (products via `spree_delivery_method_rule_products` join, Saleor-style method-side exclusion) replaces the dropped `spree_products.excluded_delivery_method_ids` JSON column; rule-reference storage picks by cardinality — small reference sets stay `normalize_id_preference` arrays, catalog-scale (products) gets a join table.
- `6.0-service-workflows.md` — Two-tier services doctrine (2026-07-30). **Tier 1 `app/services/`:** plain `ServiceModule` classes, hand-written `def call(cart:, ...)`, Ruby kwargs as the contract — the permanent default; no DSL, no new `run`-pipelines, no hand-rolled sagas. **Tier 2 `app/workflows/`:** `Spree::Workflow` — named steps inside a plain `def perform(order:, ...)` (the ActiveJob::Continuable shape; bare `super` turns parameters into readers). Vocabulary: `step`/`external_step` (+ `with:`, `on_flow_failure:`), `run_hooks` + class-level `hooks`, `failure`/`halt!`; plain `ApplicationRecord.transaction`/`with_lock`/`rescue`/`publish_event`; every step instrumented as `step.spree_workflow`. Money lives in `Carts::RecalculateTotals` (single totals seam; the completed-order branch is the post-placement resum — rows re-summed, never regenerated), statuses in `Orders::UpdateStatuses` (refreshes each fulfillment's state, then rolls up); Order/CartUpdater are 6.1-removed warning shells. Shared Cart/Order surface lives in `Spree::Purchase::*` concerns; completion side effects (newsletter, account creation, risk) run in the sync `OrderPlacedSubscriber` on order.placed. Reserved for flows needing hooks, compensation/external I/O, or replay — currently `Carts::Complete`, `Carts::AddItem`, `Carts::Recalculate`, `Carts::RecalculateTotals` (+ order twins) and `Orders::Cancel` (absorbed `Order#after_cancel`; gateway settlement is an external_step). A service graduates to the workflow tier when it earns a hook, never speculatively — but hooks on flows already in the tier ship deliberately on the 6.0 boundary (2026-08-02), since hook keys are public API and moving one later is breaking. **New models get no state machine** — plain `status` string + inclusion validation, transitions through workflows; gateway I/O never in a save callback. Three hook families, contracts settled 2026-08-02: **lifecycle** (past tense, read-only), **validate** (handler calls `workflow.reject!(message)` to veto), **context** (`set_*_context`/`get_provider_data` — handler returns a hash, `run_hooks` deep-merges all handlers and returns it; last writer wins on collision). Phase 3 **shipped (2026-08-02)**: `run_hooks` returns the merged hash and `Workflow#reject!` is public API; `validate`/context/lifecycle hooks live on AddItem, Complete, Recalculate, RecalculateTotals, Cancel and Resume; `Fulfillments::Create`, `Payments::Capture`/`Refund`, `Payments::HandleWebhook` and `Carts::Merge` moved to `app/workflows/` (seams `fulfillment_create_workflow`, `payment_capture_workflow`, `payment_refund_workflow`, `payments_handle_webhook_workflow`, `cart_merge_workflow`; legacy names readable one release). **Customer registration (2026-08-05):** `Customers::Create` (seam `customer_create_workflow`, hooks `customers.create.validate`/`after_create`) is the single storefront customer-creation flow — self-registration + checkout account box (optional `order:` adopts addresses and links the order); absorbs `Orders::CreateUserAccount` (deprecated shell); admin create stays plain CRUD; token issuance stays in controllers; core sends NO welcome email — signup email is host-app code on `user.created` or the `after_create` hook. Payment workflows own the transaction boundary and guards — money movement stays in the model, called from an `external_step`. No workflows for plain CRUD. Workflow Dependencies seams use `*_workflow` keys; legacy `*_service` names stay settable/readable with warnings until 6.1 but writes are stashed, never applied (old service classes aren't workflow-contract compatible). `Carts::Complete` battery must pass unmodified. **Durability = plain Rails:** long-running background work uses `ActiveJob::Continuable` directly (reference: `Spree::Imports::ProcessJob` — CSV spine with a row-number cursor; `CreateRowsJob`/`ProcessRowsJob` deprecated shells); workflows are synchronous request-cycle flows and are NOT jobs — Workflow-level durable execution ships only if the payout run proves the need.
@@ -58,7 +58,7 @@ Multi-version plans (some phases shipped, some pending):
- `5.6-dashboard-typed-plugin-routes.md` — Plugin file routes compiled into the host's TanStack route tree: `spree.dashboard.routes` marker + virtual-route-config composition in `@spree/dashboard/vite`, `createDashboardRouter` + `<Dashboard router>` ownership inversion, typed cast-free links, cross-package collision pre-flight with package-named errors. Runtime route registry stays for dynamic/in-app cases (catch-all is lowest priority). Implemented; published-tarball spike passed.
Pending design work (drafts, no implementation yet):
-- `6.1-order-change-substrate.md` — `Spree::OrderChange` + `Spree::OrderChangeAction`: one preview-then-apply substrate behind every post-placement mutation (admin order edits, returns, exchanges, claims, draft-order amendments), replacing four per-domain draft models with one `begin → request → confirm → cancel` lifecycle. Actions are typed `kind` + concrete FKs (never polymorphic); **preview is computed in memory and never persisted**; confirm is a workflow with the balance settlement as an `external_step`. Deliberately 6.1 — new schema + new extension API, and 6.0 already carries the Cart/Order split, typed adjustments and the returns rework. **Resolved 2026-08-10:** a change set belongs to one `Order`, never an `OrderGroup` (multi-vendor edits = N change sets, each settling against its own order); a pending change set does **not** hold stock (`add_item` takes stock at confirm — reservations are checkout-scoped and would have no expiry trigger here). Phase 3 replaces the **6.0 order edit screen** (`/orders/$orderId/edit`) — quantities as inputs, `x` marks a row removed, Save applies the batch (**reshaped 2026-08-11**, reversing the original immediate-write rule); Phase 3 adds `begin`/preview/`confirm` behind the Save/Discard it already has. 6.0 constraints: don't **persist** a draft/preview model (transient React form state is fine and is the shape the substrate wants), don't compute projected totals client-side to fake a preview, expose post-placement money math through a service returning a value object, and keep line-item mutation on the edit screen rather than the fulfillment card. Known gap: the batch save is not atomic (no bulk endpoint; Phase 3's `Confirm` fixes it in one transaction).
+- `6.1-order-change-substrate.md` — `Spree::OrderChange` + `Spree::OrderChangeAction`: one preview-then-apply substrate behind every post-placement mutation (admin order edits, returns, exchanges, claims, draft-order amendments), replacing four per-domain draft models with one `begin → request → confirm → cancel` lifecycle. Actions are typed `kind` + concrete FKs (never polymorphic); **preview is computed in memory and never persisted**; confirm is a workflow with the balance settlement as an `external_step`. Deliberately 6.1 — new schema + new extension API, and 6.0 already carries the Cart/Order split, typed adjustments and the returns rework. **Resolved 2026-08-10:** a change set belongs to one `Order`, never an `OrderGroup` (multi-seller edits = N change sets, each settling against its own order); a pending change set does **not** hold stock (`add_item` takes stock at confirm — reservations are checkout-scoped and would have no expiry trigger here). Phase 3 replaces the **6.0 order edit screen** (`/orders/$orderId/edit`) — quantities as inputs, `x` marks a row removed, Save applies the batch (**reshaped 2026-08-11**, reversing the original immediate-write rule); Phase 3 adds `begin`/preview/`confirm` behind the Save/Discard it already has. 6.0 constraints: don't **persist** a draft/preview model (transient React form state is fine and is the shape the substrate wants), don't compute projected totals client-side to fake a preview, expose post-placement money math through a service returning a value object, and keep line-item mutation on the edit screen rather than the fulfillment card. Known gap: the batch save is not atomic (no bulk endpoint; Phase 3's `Confirm` fixes it in one transaction).
- `6.0-payment-method-rules.md` — `Spree::PaymentMethodRule` STI on PaymentMethod (Channel / Market / OrderTotal / CustomerGroup rules), mirroring the PromotionRule/PriceRule/OrderRoutingRule pattern. Enforced solely through `Order#collect_frontend_payment_methods` (listing + `Payments::Create` + payment sessions all flow through it); admin/backoffice bypasses; no rules = available everywhere. Dashboard-only management (nested Admin API CRUD + `/payment_method_rules/types` discovery). Supersedes the "no distribution concept" rationale in `5.6-6.0-single-store-promotions-payment-methods.md`; per-channel provider credentials (multiple Stripe accounts, multi-entity setups) explicitly deferred for grooming — see decisions.md 2026-07-23.
- `6.0-channel-delivery.md` — **Implemented in PR #14404 (2026-08-09).** Optional Channel→StockLocations allowlist (`spree_channel_stock_locations`, empty = all): constrains which fulfillment origins serve a channel's traffic, enforced origin-side (Coordinator allocation + pickup discovery intersect `Channel#serves_location?`) — never on profiles/groups (channel constraint composes from outside; Medusa-shaped transitive delivery). `preferred_stock_location_id` must be a served location. **Per-channel rates** are a separate axis: `DeliveryMethodRules::ChannelRule` (STI, beside ItemTotal/Weight/ExcludedProducts) gates which methods a channel is *offered* from origins it already reaches — origins decide whether a channel can be served, rules decide what it sees.
- `6.0-channel-markets.md` — Optional Channel→Markets allowlist (`spree_channel_markets` join, empty = all markets). Enforced in market resolution (`set_market_from_country` + channel-aware `Spree::Current.market` fallback), channel-filtered Store API `/store/markets`, and order-level `market must be served by channel` validation. Composes with `MarketRule` from the payment-method-rules plan.
@@ -356,7 +356,7 @@ The Store API is a customer-facing surface. The Admin API is a back-office surfa
- Computed display values (`display_total`, `purchasable`, `in_stock`)
- Customer-facing pricing (`price`, `compare_at_price`, `prior_price` for EU Omnibus)
- **No timestamps** (`created_at`, `updated_at`, `deleted_at`) — these leak operational info and aren't useful to customers
-- **No internal state** — never expose `cost_price`, internal status flags, soft-delete columns, audit logs, internal notes, `metadata`, or admin-only relations (vendors, fulfillment providers)
+- **No internal state** — never expose `cost_price`, internal status flags, soft-delete columns, audit logs, internal notes, `metadata`, or admin-only relations (sellers, fulfillment providers)
**Admin serializer (back-office):**
- Always include `created_at`, `updated_at`, and `deleted_at` (when paranoid)
@@ -519,7 +519,7 @@ The Spree 6.0 admin dashboard — a Vite-built React SPA that replaces the legac
- `@spree/dashboard-core` — registries, providers, generic infra hooks, admin SDK client singleton, `defineDashboardPlugin`.
- `@spree/dashboard` — routes, resource hooks (`use-orders`, `use-products`, …), Zod schemas, locales, app shell.
-The split lets plugin authors register UI via `defineDashboardPlugin` from `@spree/dashboard-core/plugin`, build new pages with `@spree/dashboard-ui` primitives, and reuse the same providers/hooks. It also lets app developers compose custom dashboards (e.g. vendor panels) from the same packages.
+The split lets plugin authors register UI via `defineDashboardPlugin` from `@spree/dashboard-core/plugin`, build new pages with `@spree/dashboard-ui` primitives, and reuse the same providers/hooks. It also lets app developers compose custom dashboards (e.g. seller panels) from the same packages.
**Running the admin UI locally** (from a worktree — see "Development Server" above):
diff --git a/README.md b/README.md
index 41dac7f9af..47f4ed27cd 100755
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
<p>
<a href="https://spreecommerce.org">
- <img src="https://spreecommerce.org/wp-content/themes/spree/images/logo.svg" alt="Spree Commerce open source headless eCommerce platform for B2B, Multi-vendor Marketplace, cross-border eCommerce, multi-tenant eCommerce" width="250" />
+ <img src="https://spreecommerce.org/wp-content/themes/spree/images/logo.svg" alt="Spree Commerce open source headless eCommerce platform for B2B, Multi-seller Marketplace, cross-border eCommerce, multi-tenant eCommerce" width="250" />
</a>
</p>
@@ -118,11 +118,11 @@ Price Lists, Customer Groups, and gated storefronts. Sell to multiple customer s
<img src="https://github.com/spree/spree/assets/12614496/bac1e551-f629-47d6-a983-b385aa65b1bd" alt="Spree Commerce - Wholesale eCommerce Platform" width="600" >
-### [Multi-vendor Marketplace](https://spreecommerce.org/marketplace-ecommerce/)
+### [Multi-seller Marketplace](https://spreecommerce.org/marketplace-ecommerce/)
-Launch a multi-vendor marketplace with vendor accounts, product catalog curation, split payments, vendor payouts, and commission management. The Enterprise Edition adds automated vendor onboarding (Shopify, WooCommerce sync) and Stripe Connect / Adyen for Platforms integrations.
+Launch a multi-seller marketplace with seller accounts, product catalog curation, split payments, seller payouts, and commission management. The Enterprise Edition adds automated seller onboarding (Shopify, WooCommerce sync) and Stripe Connect / Adyen for Platforms integrations.
-<img alt="Spree Commerce - Multi-vendor Marketplace eCommerce" src="https://github.com/spree/spree/assets/12614496/c4ddd118-df4c-464e-b1fe-d43862e5cf25" width="600" >
+<img alt="Spree Commerce - Multi-seller Marketplace eCommerce" src="https://github.com/spree/spree/assets/12614496/c4ddd118-df4c-464e-b1fe-d43862e5cf25" width="600" >
## Community & Contributing
@@ -151,8 +151,8 @@ Enterprise Edition is built on top of the same open-source REST API and BSD 3-Cl
| **B2B Buyer organizations** (companies, locations, contacts) | Coming soon in Spree 6.0 | ✅ |
| **B2B Catalogs** — curated per-segment product assortments | Coming soon in Spree 6.0 | ✅ |
| **B2B approval workflows & ERP integrations** — role-based approval chains, procurement and ERP connectors | — | ✅ |
-| **Multi-vendor Marketplace** — vendor onboarding, vendor panel, commissions, split payments, vendor payouts | Coming soon in Spree 6.0 | ✅ |
-| **Marketplace automations** — Shopify/WooCommerce vendor sync, Stripe Connect onboarding, automated commission rules, advanced reporting | — | ✅ |
+| **Multi-seller Marketplace** — seller onboarding, seller panel, commissions, split payments, seller payouts | Coming soon in Spree 6.0 | ✅ |
+| **Marketplace automations** — Shopify/WooCommerce seller sync, Stripe Connect onboarding, automated commission rules, advanced reporting | — | ✅ |
| **Multi-tenant SaaS** — super-admin layer, tenant provisioning, white-label billing, central operations across hundreds of tenant stores | — | ✅ |
| **Enterprise security** — SSO (SAML/OIDC), encryption at-rest, audit logging, PCI-compliant architecture | — | ✅ |
| **SLA support** — dedicated success manager, guaranteed response times, LTS releases, 24/7 monitoring | — | ✅ |
diff --git a/docs/plans/6.0-6.1-split-adjustments.md b/docs/plans/6.0-6.1-split-adjustments.md
index 6abbffd18c..93dc554e3e 100644
--- a/docs/plans/6.0-6.1-split-adjustments.md
+++ b/docs/plans/6.0-6.1-split-adjustments.md
@@ -99,7 +99,7 @@ Validated by all four: typed structures over polymorphic, winner-only persistenc
- `Spree::Discount` — promotion and manual discounts. Nullable `promotion_action_id`/`promotion_id` FKs (`dependent: :nullify` from the promotion side) plus provenance snapshots: `code`, `value` + `value_type` (the input, e.g. 10%), `kind`. Amount is **enforced** `<= 0` (validation + DB CHECK), and adjusters clamp so combined discounts never push an adjustable's net below zero.
- `Spree::Fee` — extensible charges (surcharge, handling, gift wrap, COD, payment fees). `kind` required, amount `>= 0`. **Fees are taxable**: `TaxLine` accepts `fee_id` as an adjustable (EU VAT applies to surcharges — both competitor fee primitives, the hosted leader's Duty/AdditionalFee and OSS platform C's Surcharge, carry tax lines).
-- **Concrete adjustable FKs, fulfillment vocabulary.** TaxLine and Discount belong to exactly one of `line_item` / `fulfillment` (TaxLine additionally: `fee`). Tables are born with `fulfillment_id` per `6.0-fulfillment-and-delivery.md` — no new `shipment` references. `Fee` may additionally be **order-level** (both FKs nil) — the canonical fee use cases (payment surcharge, COD, small-order fee) belong to no line; at vendor split, order-level fees prorate across child orders by item totals (coordinate with `6.0-multi-vendor-marketplace.md`, which currently assumes strict line/fulfillment attachment).
+- **Concrete adjustable FKs, fulfillment vocabulary.** TaxLine and Discount belong to exactly one of `line_item` / `fulfillment` (TaxLine additionally: `fee`). Tables are born with `fulfillment_id` per `6.0-fulfillment-and-delivery.md` — no new `shipment` references. `Fee` may additionally be **order-level** (both FKs nil) — the canonical fee use cases (payment surcharge, COD, small-order fee) belong to no line; at seller split, order-level fees prorate across child orders by item totals (coordinate with `6.0-multi-vendor-marketplace.md`, which currently assumes strict line/fulfillment attachment).
- **Owner is cart-or-order, not order-only.** Discounts and tax estimates are computed during the **cart** phase (`6.0-cart-order-split.md`). Typed lines carry nullable `cart_id` / `order_id` with an exactly-one validation, mirroring the adjustable XOR. `Spree::Carts::Complete` copies typed lines to the order alongside line items (copy-on-completion), re-pointing `line_item_id` to the new order line items. New code derives the owner via the adjustable (`line_item.owner`), never assumes `order`.
@@ -310,7 +310,7 @@ Custom discounts follow the same pattern writing `Discount` (`kind: 'loyalty'`,
The legacy "manual adjustment with a label" splits by sign, keeping both directions of today's capability:
-- **Compensation / goodwill** (scratched package, late delivery, price-match): manual `Discount(kind: 'manual')`. The admin targets either a **specific line item** (the damaged item) or the **whole order** — order-level manual discounts distribute proportionally to line items at creation time using the same largest-remainder rule as order-level promotions (Resolved Question 1), so vendor splitting and per-line refund math keep working.
+- **Compensation / goodwill** (scratched package, late delivery, price-match): manual `Discount(kind: 'manual')`. The admin targets either a **specific line item** (the damaged item) or the **whole order** — order-level manual discounts distribute proportionally to line items at creation time using the same largest-remainder rule as order-level promotions (Resolved Question 1), so seller splitting and per-line refund math keep working.
- **Surcharge** (customs, handling, phone-order fee): manual `Fee` — order-level or attached to a line/fulfillment. Taxed by the provider like any fee.
On **paid** orders, decreasing the total creates an outstanding credit — the recommended tool there is a partial `Refund` (see `6.0-returns-exchanges-claims.md`); the manual-discount path remains available through the explicit post-placement edit flow (Resolved Question 7) for pre-capture corrections and draft/backoffice orders.
@@ -416,7 +416,7 @@ Order-level rows (`adjustable_type == 'Spree::Order'`): promotion and manual dis
2. **Return credits** are not Discounts — returns flow through the Refund model (`6.0-returns-exchanges-claims.md`). Legacy `ReturnAuthorization` adjustments are skipped at migration and their orders marked recalculation-frozen.
3. **`fee_total` on Order.** Order total formula: `total = item_total + delivery_total + fee_total + additional_tax_total + promo_total` (`delivery_total` per the fulfillment plan's rename).
4. **Fees are taxable** via `TaxLine#fee_id`. EU VAT applies to surcharges/gift wrap/handling; both competitor fee primitives carry tax lines. Fee tax stays itemized in the same reporting pipeline.
-5. **Order-level fees are legal** (both adjustable FKs nil). At vendor split they prorate across child orders by item totals.
+5. **Order-level fees are legal** (both adjustable FKs nil). At seller split they prorate across child orders by item totals.
6. **Promotion stacking targets 6.1; 6.0 ships winner-only, stacking-ready.** Stacking (`Promotion#combines_with`, the hosted leader's model; OSS platform A/OSS platform C stack-with-caps validate the mechanics) is purely additive — no schema change (multiple Discount rows per adjustable are already legal), no breaking window needed. 6.0's obligations: clamping + remaining-base proration land with order-level distribution, and winner-only selection stays isolated in one adjuster method so 6.1 slots in the `combines_with` partition without touching persistence.
7. **State machine replacement = order-level freeze.** `OrderUpdater` refuses adjustment recalculation on completed orders (OSS platform B's status-gating model); post-placement changes go through explicit admin actions writing typed rows. The open/close toggle is dropped with the manual-adjustment CRUD replacement. The freeze ships before the state machine is removed. Deleted sources need no special handling — nullify + snapshots keep rows valid.
8. **Tax write path is provider-owned** (`6.0-tax-provider.md`). Replace-all set semantics per estimate; `Spree.adjusters` covers discounts/fees only.
diff --git a/docs/plans/6.0-admin-api.md b/docs/plans/6.0-admin-api.md
index b16c0bebb8..8b0b64c507 100644
--- a/docs/plans/6.0-admin-api.md
+++ b/docs/plans/6.0-admin-api.md
@@ -153,7 +153,7 @@ Per-record conditions (CanCanCan blocks/hashes) are not serialized — only `has
7. **Categories** ✅ (read) — Collections + write/reposition pending
8. **Store settings ✅, Channels ✅, Markets ✅, Tax Categories ✅, Admin users ✅, Roles ✅ (read), Invitations ✅, API keys ✅, Webhooks ✅, Allowed Origins ✅, Exports ✅, Dashboard ✅**; Policies pending
9. **Custom Fields + Custom Field Definitions** ✅ — Translations (polymorphic) pending
-10. **Returns/Exchanges/Claims, Product Types, Collections, Marketplace (Vendors/Commission/Payouts), Delivery Methods/Zones, Tax Rates/Markets-as-tax, Payment Methods ✅** — remaining 6.0 model work; Catalogs/Companies (B2B) deferred to **6.1** per `decisions.md` 2026-06-16
+10. **Returns/Exchanges/Claims, Product Types, Collections, Marketplace (Sellers/Commission/Payouts), Delivery Methods/Zones, Tax Rates/Markets-as-tax, Payment Methods ✅** — remaining 6.0 model work; Catalogs/Companies (B2B) deferred to **6.1** per `decisions.md` 2026-06-16
11. **Reports, Imports, Integrations, Price History, Stock Movements** — pending
### PR process for each endpoint
@@ -675,7 +675,7 @@ Customer assignment is handled via the standard `PATCH /api/v3/admin/orders/:id`
- [ ] `PATCH /api/v3/admin/suppliers/:id`
- [ ] `DELETE /api/v3/admin/suppliers/:id`
-> **6.0:** `Spree::Supplier` is the procurement source for purchase orders (see `6.0-inventory-operations.md`). Not to be confused with marketplace **Vendors** below — `Spree::Vendor` is the marketplace seller (`6.0-multi-vendor-marketplace.md`, `decisions.md` 2026-07-14).
+> **6.0:** `Spree::Supplier` is the procurement source for purchase orders (see `6.0-inventory-operations.md`). Not to be confused with marketplace **Sellers** below — `Spree::Seller` is the marketplace seller (`6.0-multi-vendor-marketplace.md`, `decisions.md` 2026-07-14).
### Purchase Orders (new in 6.0)
- [ ] `GET /api/v3/admin/purchase_orders`
@@ -691,29 +691,29 @@ Customer assignment is handled via the standard `PATCH /api/v3/admin/orders/:id`
### Marketplace (new in 6.0)
-Per `6.0-multi-vendor-marketplace.md`. Vendor prefix is `ven_` (matches the legacy Enterprise gem).
+Per `6.0-multi-vendor-marketplace.md`. Seller prefix is `sel_` (matches the legacy Enterprise gem).
-- [ ] `GET /api/v3/admin/vendors`
-- [ ] `GET /api/v3/admin/vendors/:id`
-- [ ] `POST /api/v3/admin/vendors`
-- [ ] `PATCH /api/v3/admin/vendors/:id`
-- [ ] `DELETE /api/v3/admin/vendors/:id`
-- [ ] `POST /api/v3/admin/vendors/:id/invite` — (re)send the vendor invitation (`Spree::Invitation`, `resource: vendor`)
-- [ ] `POST /api/v3/admin/vendors/:id/approve` / `POST /api/v3/admin/vendors/:id/reject` / `POST /api/v3/admin/vendors/:id/suspend` — lifecycle transitions (approve also un-suspends)
+- [ ] `GET /api/v3/admin/sellers`
+- [ ] `GET /api/v3/admin/sellers/:id`
+- [ ] `POST /api/v3/admin/sellers`
+- [ ] `PATCH /api/v3/admin/sellers/:id`
+- [ ] `DELETE /api/v3/admin/sellers/:id`
+- [ ] `POST /api/v3/admin/sellers/:id/invite` — (re)send the seller invitation (`Spree::Invitation`, `resource: seller`)
+- [ ] `POST /api/v3/admin/sellers/:id/approve` / `POST /api/v3/admin/sellers/:id/reject` / `POST /api/v3/admin/sellers/:id/suspend` — lifecycle transitions (approve also un-suspends)
- [ ] `GET /api/v3/admin/commission_rates`
- [ ] `GET /api/v3/admin/commission_rates/:id`
- [ ] `POST /api/v3/admin/commission_rates`
- [ ] `PATCH /api/v3/admin/commission_rates/:id` — saves rate fields + nested `rules: []` in one round-trip (PriceList-style)
- [ ] `DELETE /api/v3/admin/commission_rates/:id`
-- [ ] `GET /api/v3/admin/commission_lines` — read-only snapshot ledger (filter by vendor/order)
-- [ ] `GET /api/v3/admin/vendor_transfers` — read-only earnings ledger (filter by vendor/payout/status)
-- [ ] `GET /api/v3/admin/vendor_payouts` / `GET /:id`
-- [ ] `POST /api/v3/admin/vendor_payouts/:id/complete` — manual settlement (system provider)
+- [ ] `GET /api/v3/admin/commission_lines` — read-only snapshot ledger (filter by seller/order)
+- [ ] `GET /api/v3/admin/seller_transfers` — read-only earnings ledger (filter by seller/payout/status)
+- [ ] `GET /api/v3/admin/seller_payouts` / `GET /:id`
+- [ ] `POST /api/v3/admin/seller_payouts/:id/complete` — manual settlement (system provider)
- [ ] `GET /api/v3/admin/order_groups` / `GET /:id` — the multi-order transaction container
-API key scopes: `read_vendors` / `write_vendors`, `read_commissions` / `write_commissions`, `read_payouts` / `write_payouts`.
+API key scopes: `read_sellers` / `write_sellers`, `read_commissions` / `write_commissions`, `read_payouts` / `write_payouts`.
-> **Operator surface only (2026-08-15).** Vendor *users* never call the Admin API. They are `Spree::AdminUser` accounts signing in through a dedicated **`/api/v3/vendor`** branch with its own `vendor_api` JWT audience and login registry, where every endpoint scope-fetches through `current_vendor`; the vendor endpoint list and serializer rules live in `6.0-multi-vendor-marketplace.md` → "Vendor API surface" (Decision 10, `decisions.md` 2026-08-15).
+> **Operator surface only (2026-08-15).** Seller *users* never call the Admin API. They are `Spree::AdminUser` accounts signing in through a dedicated **`/api/v3/seller`** branch with its own `seller_api` JWT audience and login registry, where every endpoint scope-fetches through `current_seller`; the seller endpoint list and serializer rules live in `6.0-multi-vendor-marketplace.md` → "Seller API surface" (Decision 10, `decisions.md` 2026-08-15).
### Price Lists
- [x] `GET /api/v3/admin/price_lists`
diff --git a/docs/plans/6.0-admin-rbac.md b/docs/plans/6.0-admin-rbac.md
index 5926111855..098f270771 100644
--- a/docs/plans/6.0-admin-rbac.md
+++ b/docs/plans/6.0-admin-rbac.md
@@ -224,7 +224,7 @@ pages.
### Already true, kept deliberately
- **Store-scoped role assignment ships as-is; no new scoping model.** Per-store
- roles already work (`RoleUser` + ability + staff API). Vendor-scoped
+ roles already work (`RoleUser` + ability + staff API). Seller-scoped
assignments arrive with `6.0-multi-vendor-marketplace.md` through the same
polymorphic `resource`.
- **`/me` keeps the CanCanCan rules dump and adds `permission_keys`.** The SPA's
@@ -500,52 +500,52 @@ all resolved 2026-08-07 and live in Key Decisions. Genuinely deferred:
stay global reference data; only assignments are store-scoped. Unblocked by:
SaaS multi-tenant demand where tenant A's custom roles must be invisible to
tenant B.
-- **Vendor-scoped assignments** — the schema already carries them: a vendor
- staffer is a `RoleUser` with `resource: vendor` (whose store binding derives
- from the vendor's store), invitations accept the same polymorphic resource,
- and the catalog keys are the same vocabulary (a vendor "Catalog manager"
+- **Seller-scoped assignments** — the schema already carries them: a seller
+ staffer is a `RoleUser` with `resource: seller` (whose store binding derives
+ from the seller's store), invitations accept the same polymorphic resource,
+ and the catalog keys are the same vocabulary (a seller "Catalog manager"
holds `write_products`). Direction settled 2026-08-08 for the marketplace
plan to inherit:
- **Same machinery, separate pools.** Roles gain an *audience* (staff |
- vendor). The operator defines vendor capability tiers in the same editor;
- vendors assign their people to those tiers but do not define roles.
+ seller). The operator defines seller capability tiers in the same editor;
+ sellers assign their people to those tiers but do not define roles.
**Shipped 2026-08-16:** roles are store-owned (`spree_roles.store_id`,
required) and unique per `(store, name, audience)`, so each store defines
- its own tiers and holds its own immutable `admin`. Per-*vendor*-owned
- pools remain a later need — two vendors on one store still cannot each
- define a "Packer", which is why the operator defines vendor tiers.
- - **A per-audience catalog subset.** Vendor roles draw only from
- vendor-safe resources (products, orders, fulfillments, stock, analytics —
+ its own tiers and holds its own immutable `admin`. Per-*seller*-owned
+ pools remain a later need — two sellers on one store still cannot each
+ define a "Packer", which is why the operator defines seller tiers.
+ - **A per-audience catalog subset.** Seller roles draw only from
+ seller-safe resources (products, orders, fulfillments, stock, analytics —
never `settings`, `staff`, `api_keys`); the editor filters the grid by
audience, and assignment / invitation guards pair audience with resource
- type. **Shipped 2026-08-16** as `register_resource(audiences: %i[vendor])`
+ type. **Shipped 2026-08-16** as `register_resource(audiences: %i[seller])`
— a list of the audiences *beyond staff* a resource opens up, rather than
- a vendor-specific boolean, so a third panel adds a value instead of a
+ a seller-specific boolean, so a third panel adds a value instead of a
column (decisions.md 2026-08-16). `Spree.permissions.grantable_keys(audience)`
reads it; a non-staff role validates that it holds only granted keys.
- - **The vendor boundary is tenancy, not new keys** (Axis A/B): vendor-panel
- endpoints scope-fetch through `current_vendor` exactly as admin endpoints
+ - **The seller boundary is tenancy, not new keys** (Axis A/B): seller-panel
+ endpoints scope-fetch through `current_seller` exactly as admin endpoints
scope through `current_store`. The store-admin half of that boundary is
enforced in the ability — `Spree::Ability#staff_roles` and
`RoleGrantGuard#caller_roles` match on `resource_type: 'Spree::Store'`, not
- `store_id` alone, so a vendor-resourced assignment (which binds to the
- vendor's store) confers nothing in the store admin. Regression specs cover
- it, including an `admin`-named vendor role. **`AdminAuthentication`'s
+ `store_id` alone, so a seller-resourced assignment (which binds to the
+ seller's store) confers nothing in the store admin. Regression specs cover
+ it, including an `admin`-named seller role. **`AdminAuthentication`'s
membership check was the hole in that story** — it matched `store_id`
- alone, so a vendor-resourced holder authenticated into the admin API with
+ alone, so a seller-resourced holder authenticated into the admin API with
an empty ability and reached the scope-exempt endpoints; tightened
2026-08-16 with a regression spec (marketplace plan Phase 0). The
- marketplace plan adds the vendor-side ability, which `Spree::Ability` now
+ marketplace plan adds the seller-side ability, which `Spree::Ability` now
supports through a `resource:` option that also confines the `admin`
super-role to store resources.
Surface and enforcement ship with `6.0-multi-vendor-marketplace.md`, not
- here. **Settled there 2026-08-15 (Decision 10):** vendor staff are
- `Spree.admin_user_class` (no `VendorUser`), the surface is a dedicated
- `/api/v3/vendor` branch with its own `vendor_api` JWT audience, its own
- strategy registry and audience-stamped refresh tokens, and the vendor-side
+ here. **Settled there 2026-08-15 (Decision 10):** seller staff are
+ `Spree.admin_user_class` (no `SellerUser`), the surface is a dedicated
+ `/api/v3/seller` branch with its own `seller_api` JWT audience, its own
+ strategy registry and audience-stamped refresh tokens, and the seller-side
ability is `Spree::Ability` with a `resource:` option reading
- `resource: vendor` assignments. One follow-up lands on this plan's code:
+ `resource: seller` assignments. One follow-up lands on this plan's code:
`AdminAuthentication#current_user_member_of_store?` must match
`resource_type: 'Spree::Store'` like `staff_roles` and `RoleGrantGuard` do.
- **Audit trail for role/permission changes** — rides a future admin audit-log
@@ -564,7 +564,7 @@ all resolved 2026-08-07 and live in Key Decisions. Genuinely deferred:
- `6.0-platform-auth.md` — Customer/Staff split (role resolution gated to staff)
- `6.1-channels-catalogs-b2b.md` — catalog visibility as data scoping; Company
models (B2B roles are a separate future Enterprise system)
-- `6.0-multi-vendor-marketplace.md` — future vendor-scoped role assignments
+- `6.0-multi-vendor-marketplace.md` — future seller-scoped role assignments
- `docs/plans/decisions.md` 2026-08-05 — model-level immutability guards
(NamedType precedent) · 2026-08-07 — this plan's catalog/replacement decision
- Prior art: Saleor permission groups, Vendure roles, Shopify staff permissions;
diff --git a/docs/plans/6.0-admin-spa.md b/docs/plans/6.0-admin-spa.md
index b52e4a85e6..f9533eea79 100644
--- a/docs/plans/6.0-admin-spa.md
+++ b/docs/plans/6.0-admin-spa.md
@@ -38,7 +38,7 @@ A new single-page React admin dashboard that replaces the Rails `spree/admin` en
### Package Split
-The dashboard is split into three workspace packages with a strict one-way dependency direction. The split lets plugin authors compose new pages from the same primitives core uses, and lets app developers build bespoke admin variants (vendor panels, white-labels) without forking the SPA.
+The dashboard is split into three workspace packages with a strict one-way dependency direction. The split lets plugin authors compose new pages from the same primitives core uses, and lets app developers build bespoke admin variants (seller panels, white-labels) without forking the SPA.
```
@spree/dashboard (the deployable SPA — routes, resource hooks, Zod schemas, locales, app shell)
@@ -64,7 +64,7 @@ We looked at how Medusa, Vendure, and Saleor structure their admin packages:
Our split matches the industry pattern but goes one step further on UI reuse: instead of bundling primitives into the dashboard app (Vendure) or shipping primitives without compounds (Medusa), `@spree/dashboard-ui` carries both — the primitives **and** the composed components (PageHeader, ResourceTable, AppSidebar, …) — as headless components that accept data via props. This is the gap none of them got right: plugin authors and custom-admin builders can use the same composed components core uses.
-We are not extracting per-feature packages (`@spree/dashboard-orders`, …). The competitor evidence is unanimous that this is the wrong cut, and the vendor-panel use case is better solved by forking the app shell with reuse of `dashboard-ui`/`dashboard-core` than by feature imports. Revisit only if a real consumer hits the boundary.
+We are not extracting per-feature packages (`@spree/dashboard-orders`, …). The competitor evidence is unanimous that this is the wrong cut, and the seller-panel use case is better solved by forking the app shell with reuse of `dashboard-ui`/`dashboard-core` than by feature imports. Revisit only if a real consumer hits the boundary.
#### Package boundaries (the rules)
@@ -106,7 +106,7 @@ defineDashboardPlugin({
})
```
-Custom admin apps (vendor panels, etc.) compose the packages directly: import `@spree/dashboard-ui` for the components, mount `@spree/dashboard-core`'s providers in their own app shell, and ship only the routes they want. No SDK abstraction to fight.
+Custom admin apps (seller panels, etc.) compose the packages directly: import `@spree/dashboard-ui` for the components, mount `@spree/dashboard-core`'s providers in their own app shell, and ship only the routes they want. No SDK abstraction to fight.
#### Component coupling — the headless rule in detail
@@ -342,12 +342,12 @@ Three extension points only (do not add more without discussion):
```tsx
tables.products.addColumn({
- key: 'vendor',
- label: 'Vendor',
+ key: 'seller',
+ label: 'Seller',
sortable: true,
filterable: true,
default: true,
- render: (p) => p.vendor_name ?? '—',
+ render: (p) => p.seller_name ?? '—',
})
tables.products.removeColumn('inventory')
@@ -371,10 +371,10 @@ The legacy Rails admin exposes ~80 named partial slots via `Spree.admin.partials
import { registerSlot } from '@spree/dashboard-core'
registerSlot('product_form_sidebar', {
- id: 'vendor-info',
- component: VendorInfoCard,
+ id: 'seller-info',
+ component: SellerInfoCard,
position: 100,
- if: ({ permissions }) => permissions.can('read', 'Spree::Vendor'),
+ if: ({ permissions }) => permissions.can('read', 'Spree::Seller'),
})
// Spree admin page (built-in)
diff --git a/docs/plans/6.0-delivery-rate-provider.md b/docs/plans/6.0-delivery-rate-provider.md
index ec9d86819d..a21372423a 100644
--- a/docs/plans/6.0-delivery-rate-provider.md
+++ b/docs/plans/6.0-delivery-rate-provider.md
@@ -2,7 +2,7 @@
**Status:** Phases 1–5 shipped (see "Implementation status"; Phase 5 as an initial scaffold — no FulfillmentProvider/CI wiring yet). Reference aggregator: **EasyPost** (decisions.md 2026-08-06 — Shippo pick reversed same day: BYOCA fit for larger merchants + the only actively maintained official Ruby SDK)
**Target:** Spree 6.0
-**Depends on:** Fulfillment & Delivery (6.0-fulfillment-and-delivery.md) for the DeliveryMethod/DeliveryRate rename. Coordinates with: `6.0-multi-vendor-marketplace.md` (vendor-scoped method filtering — this plan owns the filter), `6.0-cart-order-split.md` (where estimation is invoked pre-completion), `5.6-6.0-single-store-promotions-payment-methods.md` (single-store pattern reused for `store_id`)
+**Depends on:** Fulfillment & Delivery (6.0-fulfillment-and-delivery.md) for the DeliveryMethod/DeliveryRate rename. Coordinates with: `6.0-multi-vendor-marketplace.md` (seller-scoped method filtering — this plan owns the filter), `6.0-cart-order-split.md` (where estimation is invoked pre-completion), `5.6-6.0-single-store-promotions-payment-methods.md` (single-store pattern reused for `store_id`)
**Author:** Damian + Claude
**Last updated:** 2026-08-06
@@ -126,7 +126,7 @@ A carrier-backed DeliveryMethod is the carrier connection, not one service: `Del
### Provider wraps the Estimator; it does not replace it
-`Stock::Estimator` **stays**. It owns responsibilities no provider should re-implement per-vendor:
+`Stock::Estimator` **stays**. It owns responsibilities no provider should re-implement per-seller:
- method filtering (display target, zone `include?`, `calculator.available?`, currency match) — `estimator.rb:61-71`
- VAT gross-up via `Spree::VatPriceCalculation#gross_amount` — `estimator.rb:4, 38`
@@ -206,13 +206,13 @@ end
**No join table and no `LegacyMultiStoreSupport` bridge.** Promotion and PaymentMethod needed those because they were migrating *away from* `has_many :stores`. ShippingMethod has no sharing semantics to preserve, so there is nothing to deprecate — this is a pure addition. That also makes it the cheapest of the single-store migrations.
-**Interaction with `VendorConcern`.** `ShippingMethod` conditionally includes `Spree::VendorConcern` (`shipping_method.rb:10-12`) for the marketplace. Store ownership and vendor ownership are different axes: the store is the tenant boundary (and the credential scope); the vendor is the seller within it. A vendor's shipping methods belong to the marketplace's store. Coordinate with `6.0-multi-vendor-marketplace.md` before enforcing `null: false`.
+**Interaction with `SellerConcern`.** `ShippingMethod` conditionally includes `Spree::SellerConcern` (`shipping_method.rb:10-12`) for the marketplace. Store ownership and seller ownership are different axes: the store is the tenant boundary (and the credential scope); the seller is the seller within it. A seller's shipping methods belong to the marketplace's store. Coordinate with `6.0-multi-vendor-marketplace.md` before enforcing `null: false`.
-### Vendor-scoped methods filter in the Estimator (marketplace)
+### Seller-scoped methods filter in the Estimator (marketplace)
-`6.0-multi-vendor-marketplace.md` requires per-vendor delivery selection at checkout: line items partition into per-vendor packages **before** the order split, and "a `DeliveryMethod` with `vendor_id` is offered only on that vendor's packages; `vendor_id: nil` methods are marketplace-wide" — and it delegates that filtering to this plan.
+`6.0-multi-vendor-marketplace.md` requires per-seller delivery selection at checkout: line items partition into per-seller packages **before** the order split, and "a `DeliveryMethod` with `seller_id` is offered only on that seller's packages; `seller_id: nil` methods are marketplace-wide" — and it delegates that filtering to this plan.
-Because the provider wraps the Estimator, this lands in exactly one place: `Estimator#shipping_methods(package, filter)` gains a vendor gate — skip methods whose `vendor_id` is present and differs from the package's vendor; `nil` means marketplace-wide. The `vendor_id` column itself is added by the marketplace plan's schema wave (it replaces today's Enterprise `VendorConcern` decorator seam at `shipping_method.rb:10-12`); this plan owns the filter. Per-package granularity is native here — the Estimator already runs per package, which is exactly the granularity per-vendor selection needs. Single-vendor stores are unaffected (`vendor_id` is nil everywhere, the gate is a no-op).
+Because the provider wraps the Estimator, this lands in exactly one place: `Estimator#shipping_methods(package, filter)` gains a seller gate — skip methods whose `seller_id` is present and differs from the package's seller; `nil` means marketplace-wide. The `seller_id` column itself is added by the marketplace plan's schema wave (it replaces today's Enterprise `SellerConcern` decorator seam at `shipping_method.rb:10-12`); this plan owns the filter. Per-package granularity is native here — the Estimator already runs per package, which is exactly the granularity per-seller selection needs. Single-seller stores are unaffected (`seller_id` is nil everywhere, the gate is a no-op).
### Credentials live in Spree::Integration
@@ -476,7 +476,7 @@ The Store API already speaks this vocabulary: `Spree::Api::V3::DeliveryRateSeria
- `ShippingMethod` includes `SingleStoreResource`, declares `belongs_to :store`.
- Backfill rake task. **Unlike Promotion/PaymentMethod there is no join table to read from**, so ownership is derived: assign `Spree::Store.default` when only one store exists (the overwhelmingly common case); where multiple stores exist, use the zone-overlap signal from `Store#countries_with_shipping_coverage` (`store.rb:342`) and log every ambiguous method loudly rather than guessing silently. Idempotent — skip rows that already have `store_id`.
- Update `shipping_method_factory.rb` and the admin controller (`shipping_methods_controller.rb`) to set/scope by store.
-- `null: false` is deferred to the 6.0 cleanup, after the vendor interaction is settled.
+- `null: false` is deferred to the 6.0 cleanup, after the seller interaction is settled.
### Phase 2 — provider interface + Internal provider ✅ shipped
diff --git a/docs/plans/6.0-fulfillment-and-delivery.md b/docs/plans/6.0-fulfillment-and-delivery.md
index 26a94fed82..49bc2237fd 100644
--- a/docs/plans/6.0-fulfillment-and-delivery.md
+++ b/docs/plans/6.0-fulfillment-and-delivery.md
@@ -1,8 +1,8 @@
# Fulfillment & Delivery Rework
-**Status:** Phases 1–5 shipped to `feat/fulfillment-delivery-rework`; remaining 6.0 work is the vendor axis (gated) — see "Implementation status"
+**Status:** Phases 1–5 shipped to `feat/fulfillment-delivery-rework`; remaining 6.0 work is the seller axis (gated) — see "Implementation status"
**Target:** Spree 6.0
-**Depends on:** `6.0-product-types.md` (`fulfillment_types` addendum 2026-07-27 — ProductType replaces ShippingCategory; **shipped**, including the `fulfillment_types` column), `6.0-cart-order-split.md` (where fulfillments/rates live pre-completion), `6.0-order-routing.md` (packages come from `for_allocation`), `6.0-normalize-state-to-status.md`. Coordinates with: `6.0-delivery-rate-provider.md` (owns `store_id` on DeliveryMethod; calculators stay per decisions.md 2026-07-27), `5.5-6.0-display-on-to-boolean.md` (`storefront_visible` — DeliveryMethod moved off the `Spree::DisplayOn` concern 2026-08-05), `6.0-multi-vendor-marketplace.md` (`vendor_id`, lifecycle events, `delivery_amount`). Gates: `6.0-6.1-split-adjustments.md` and `6.0-typed-stock-movements.md` are born with `fulfillment_id` — **this plan's Phase 1 must land before both**.
+**Depends on:** `6.0-product-types.md` (`fulfillment_types` addendum 2026-07-27 — ProductType replaces ShippingCategory; **shipped**, including the `fulfillment_types` column), `6.0-cart-order-split.md` (where fulfillments/rates live pre-completion), `6.0-order-routing.md` (packages come from `for_allocation`), `6.0-normalize-state-to-status.md`. Coordinates with: `6.0-delivery-rate-provider.md` (owns `store_id` on DeliveryMethod; calculators stay per decisions.md 2026-07-27), `5.5-6.0-display-on-to-boolean.md` (`storefront_visible` — DeliveryMethod moved off the `Spree::DisplayOn` concern 2026-08-05), `6.0-multi-vendor-marketplace.md` (`seller_id`, lifecycle events, `delivery_amount`). Gates: `6.0-6.1-split-adjustments.md` and `6.0-typed-stock-movements.md` are born with `fulfillment_id` — **this plan's Phase 1 must land before both**.
**Author:** Damian + Claude
**Last updated:** 2026-08-10 (partial fulfillment lands as `Fulfillments::Fulfill` — resolved question 12)
@@ -44,7 +44,7 @@ Three changes in one:
**Mitigation for deferring a signature change on a public class:** the pickup point provider interface is **not documented in 6.0 at all** — the v6 developer docs cover only the delivery rate provider interface. A class-level comment on `PickupPointProvider::Base` notes the constructor and `find_nearby` signature change in 6.1. With no docs inviting third-party providers, the 6.1 change breaks no sanctioned contract. Accepted trade-off for keeping 6.0 scope down; do not add pickup-provider docs or guides in any 6.0 work.
-**Remaining for 6.0:** only the vendor axis (`belongs_to :vendor` replacing the `Spree::VendorConcern` decorator seam, `DeliveryMethodStockLocation` vendor-consistency validation, and refusing `pickup_stock_policy: 'any'` on vendor-owned locations). It is gated on `6.0-multi-vendor-marketplace.md` shipping the `vendor_id` column in its schema wave. Everything else outstanding is Phase 6 (6.1) cleanup.
+**Remaining for 6.0:** only the seller axis (`belongs_to :seller` replacing the `Spree::SellerConcern` decorator seam, `DeliveryMethodStockLocation` seller-consistency validation, and refusing `pickup_stock_policy: 'any'` on seller-owned locations). It is gated on `6.0-multi-vendor-marketplace.md` shipping the `seller_id` column in its schema wave. Everything else outstanding is Phase 6 (6.1) cleanup.
### Shipped earlier (verified 2026-07-27, HEAD 4e5b6fd)
@@ -96,7 +96,7 @@ Replacement semantics:
- `DeliveryMethod#fulfillment_type` (single string) must be **included in every package item's** `fulfillment_types` for the method to be eligible.
- `Package#eligible_delivery_methods` replaces `Package#shipping_methods`: intersect items' fulfillment types. ~~Then subtract per-product exclusions via `Product.excluded_delivery_method_ids` (JSON array column)~~ — **superseded 2026-08-06**: the column is dropped; the restriction case ("fragile item can't ship express") is `Spree::DeliveryMethodRules::ExcludedProductsRule`, enforced at the Estimator's rule seam like every other eligibility constraint. See `6.0-delivery-method-rules.md`.
- `Stock::Splitter::ShippingCategory` → `Stock::Splitter::FulfillmentType` — packages stay homogeneous by fulfillment type, so mixed carts (physical + digital) still split automatically. `Splitter::Digital` folds into it.
-- The eligibility seam stays **inside `Stock::Estimator#shipping_methods`** (per the delivery-rate-provider plan, which owns filtering — including the marketplace vendor gate). This plan changes the *inputs* to that filter, not its location. No separate `DeliveryMethods::Available` service.
+- The eligibility seam stays **inside `Stock::Estimator#shipping_methods`** (per the delivery-rate-provider plan, which owns filtering — including the marketplace seller gate). This plan changes the *inputs* to that filter, not its location. No separate `DeliveryMethods::Available` service.
### The digital discriminator moves off the calculator class
@@ -128,23 +128,23 @@ end
Built-ins: `Manual` (default — current admin-driven behavior), `Digital`, `Pickup`, `PickupPoint`. Third-party: `SpreeEasyPost::FulfillmentProvider`, `SpreeShipStation::FulfillmentProvider`. Stored as a string class name on DeliveryMethod, constantized at call time. Registered via `Spree.fulfillment_providers`.
-**Digital auto-fulfillment is new behavior, not a refactor.** Today digital shipments sit at `ready` until an admin clicks Ship (`Shipment#shippable?` exists precisely for that button), and DigitalLinks are created by a checkout state-machine callback (`checkout.rb:87-89` — nested inside `if states[:payment]`, non-idempotent, one link per line item regardless of quantity). `FulfillmentProvider::Digital` takes over both: on order completion it fires `fulfill!` directly and generates DigitalLinks idempotently, per quantity. This also gives the multi-vendor ledger its "digital vendor order earns immediately after payment" path.
+**Digital auto-fulfillment is new behavior, not a refactor.** Today digital shipments sit at `ready` until an admin clicks Ship (`Shipment#shippable?` exists precisely for that button), and DigitalLinks are created by a checkout state-machine callback (`checkout.rb:87-89` — nested inside `if states[:payment]`, non-idempotent, one link per line item regardless of quantity). `FulfillmentProvider::Digital` takes over both: on order completion it fires `fulfill!` directly and generates DigitalLinks idempotently, per quantity. This also gives the multi-vendor ledger its "digital seller order earns immediately after payment" path.
### Lifecycle events are first-class (multi-vendor ledger depends on them)
-`Fulfillment` gets `publishes_lifecycle_events` plus explicit transition events: `fulfillment.ready`, `fulfillment.fulfilled`, `fulfillment.canceled`, `fulfillment.resumed`. Order-level: when the last fulfillment reaches `fulfilled`, publish `order.fulfilled` — the signal `6.0-multi-vendor-marketplace.md`'s `vendor_transfer.due` subscriber keys on ("all the vendor order's fulfillments fulfilled"). `Order#fully_fulfilled?` is the matching queryable predicate.
+`Fulfillment` gets `publishes_lifecycle_events` plus explicit transition events: `fulfillment.ready`, `fulfillment.fulfilled`, `fulfillment.canceled`, `fulfillment.resumed`. Order-level: when the last fulfillment reaches `fulfilled`, publish `order.fulfilled` — the signal `6.0-multi-vendor-marketplace.md`'s `seller_transfer.due` subscriber keys on ("all the seller order's fulfillments fulfilled"). `Order#fully_fulfilled?` is the matching queryable predicate.
**Webhook contract break:** today `Shipment` publishes `shipment.*` events and webhooks (`Shipment::Webhooks`, `Shipment::CustomEvents`). Event names rename with the model; 6.0 dual-emits `shipment.shipped` alongside `fulfillment.fulfilled` for one release with a deprecation note in webhook docs, dropped in 6.1.
-### Vendor axis (marketplace)
+### Seller axis (marketplace)
-`vendor_id` (nullable) on DeliveryMethod — the column ships in the marketplace plan's schema wave; this plan's model carries `belongs_to :vendor, optional: true`, replacing the Enterprise `VendorConcern` decorator seam (`shipping_method.rb:10-12`). Semantics (owned by the delivery-rate plan's Estimator filter): `vendor_id` present → offered only on that vendor's packages; `nil` → marketplace-wide. Store vs vendor are different axes: store = tenant + credential scope (`store_id`, owned by the delivery-rate plan), vendor = seller within it.
+`seller_id` (nullable) on DeliveryMethod — the column ships in the marketplace plan's schema wave; this plan's model carries `belongs_to :seller, optional: true`, replacing the Enterprise `SellerConcern` decorator seam (`shipping_method.rb:10-12`). Semantics (owned by the delivery-rate plan's Estimator filter): `seller_id` present → offered only on that seller's packages; `nil` → marketplace-wide. Store vs seller are different axes: store = tenant + credential scope (`store_id`, owned by the delivery-rate plan), seller = seller within it.
-`DeliveryMethodStockLocation` validates vendor consistency: when both the method and the stock location carry a `vendor_id`, they must match — otherwise one vendor's pickup counter could serve another vendor's items. Pickup stock checks are **package-scoped**, never `order.variants`. `pickup_stock_policy: 'any'` (ship-to-store transfers) is incompatible across vendor boundaries and is refused when the location is vendor-owned.
+`DeliveryMethodStockLocation` validates seller consistency: when both the method and the stock location carry a `seller_id`, they must match — otherwise one seller's pickup counter could serve another seller's items. Pickup stock checks are **package-scoped**, never `order.variants`. `pickup_stock_policy: 'any'` (ship-to-store transfers) is incompatible across seller boundaries and is refused when the location is seller-owned.
### Owner is cart-or-order
-Checkout — where fulfillments and delivery rates are created and selected — happens on the **Cart** under copy-on-completion semantics. `Fulfillment` follows the house pattern: nullable `cart_id` / `order_id` with an exactly-one validation, re-pointed at `Spree::Carts::Complete` (and again at vendor split). `DeliveryRate` carries **no owner columns** (settled 2026-07-28) — a rate belongs to its fulfillment and derives the owner through it; `spree_shipping_rates` has neither FK today, and duplicating the pair would be drift risk at every re-pointing. `belongs_to :order` hard-required is known-wrong and must not be implemented.
+Checkout — where fulfillments and delivery rates are created and selected — happens on the **Cart** under copy-on-completion semantics. `Fulfillment` follows the house pattern: nullable `cart_id` / `order_id` with an exactly-one validation, re-pointed at `Spree::Carts::Complete` (and again at seller split). `DeliveryRate` carries **no owner columns** (settled 2026-07-28) — a rate belongs to its fulfillment and derives the owner through it; `spree_shipping_rates` has neither FK today, and duplicating the pair would be drift risk at every re-pointing. `belongs_to :order` hard-required is known-wrong and must not be implemented.
### `Fulfillment#delivery_amount` (commission base)
@@ -271,7 +271,7 @@ class Spree::DeliveryMethod < Spree.base_class
include Spree::Metadata
belongs_to :store, class_name: 'Spree::Store'
- belongs_to :vendor, class_name: 'Spree::Vendor', optional: true # marketplace; nil = marketplace-wide
+ belongs_to :seller, class_name: 'Spree::Seller', optional: true # marketplace; nil = marketplace-wide
belongs_to :tax_category, -> { with_deleted }, class_name: 'Spree::TaxCategory', optional: true
has_many :delivery_rates, class_name: 'Spree::DeliveryRate', inverse_of: :delivery_method
@@ -371,7 +371,7 @@ Phase 1 as previously drafted was one ~20-operation migration; per CLAUDE.md (da
- `fulfillments`: `fulfillment_type`, `pickup_point_data` (JSON, jsonb-guarded), `cart_id` (per owner decision).
- `spree_delivery_method_stock_locations` join (unique on the pair).
- `products.excluded_delivery_method_ids` (JSON, jsonb-guarded). **Dropped 2026-08-06** (never writable through any API/UI) — replaced by `ExcludedProductsRule` + `spree_delivery_method_rule_products`; see `6.0-delivery-method-rules.md`.
-- NOT here: StockLocation pickup columns (shipped), `store_id` (delivery-rate plan), `vendor_id` (marketplace wave).
+- NOT here: StockLocation pickup columns (shipped), `store_id` (delivery-rate plan), `seller_id` (marketplace wave).
### Phase 2 — data rake tasks (`spree:migrate_shipping_to_delivery`) ✅ shipped
@@ -396,7 +396,7 @@ Batched, idempotent, resumable — same guarantees as the split-adjustments migr
- Lifecycle events + `order.fulfilled`; `shipment.*` → `fulfillment.*` webhook migration with one-release dual-emit.
- DigitalLink creation moves from the checkout callback into `FulfillmentProvider::Digital` (idempotent, per-quantity).
-### Phase 5 — remaining surfaces ✅ shipped (except the vendor axis, gated on the marketplace schema wave)
+### Phase 5 — remaining surfaces ✅ shipped (except the seller axis, gated on the marketplace schema wave)
- API: switch `FulfillmentSerializer#fulfillment_type` from computed to column-backed; pickup endpoints (`/pickup_locations`, `/pickup_points`); `storefront_visible` exposure; regenerate the type pipeline. (Most serializer/route work already shipped — see "Already shipped".)
- **Emails gem** (20 files — never mentioned in the earlier draft): `shipment_mailer`, subscriber, templates → fulfillment vocabulary.
@@ -446,7 +446,7 @@ dashboard has Buy label / Print label and a client-generated packing slip.
4. **Lifecycle events**: `fulfillment.{ready,fulfilled,canceled,resumed}` + `order.fulfilled`; one-release dual-emit of legacy `shipment.*` webhooks.
5. **Digital auto-fulfillment** is new behavior implemented by `FulfillmentProvider::Digital` (fires `fulfill!` + DigitalLinks on completion); today nothing auto-fulfills.
6. **`delivery_amount`** = `cost + fulfillment discounts` — the multi-vendor `include_shipping` commission base.
-7. **Pickup selection routes through `Order#preferred_stock_location_id`** and the `PreferredLocation` routing rule; stock checks are package-scoped; `pickup_stock_policy: 'any'` refused for vendor-owned locations.
+7. **Pickup selection routes through `Order#preferred_stock_location_id`** and the `PreferredLocation` routing rule; stock checks are package-scoped; `pickup_stock_policy: 'any'` refused for seller-owned locations.
8. **Fulfillment numbers**: existing `H` numbers stay; new records use `F`.
9. **Owner shape** (2026-07-27 cart-order-split expansion; refined 2026-07-28): dual `cart_id`/`order_id` exactly-one on `Fulfillment` — no polymorphism; `DeliveryRate` carries no owner columns and derives through its fulfillment. Phase 1b's `cart_id` is unblocked.
diff --git a/docs/plans/6.0-inventory-operations.md b/docs/plans/6.0-inventory-operations.md
index a084df14ca..529c82ee11 100644
--- a/docs/plans/6.0-inventory-operations.md
+++ b/docs/plans/6.0-inventory-operations.md
@@ -6,7 +6,7 @@
**Author:** Damian + Claude
**Last updated:** 2026-07-14
-> **Naming note (2026-07-14):** the procurement-source model this plan introduces is **`Spree::Supplier`** (`spree_suppliers`, prefix `sup_`, `/api/v3/admin/suppliers`). An earlier draft called it `Spree::Vendor`, which collided with the marketplace seller model of `6.0-multi-vendor-marketplace.md` — `Spree::Vendor` is reserved for marketplace sellers (see `decisions.md` 2026-07-14). "Supplier" also matches Shopify's purchase-order vocabulary.
+> **Naming note (2026-07-14):** the procurement-source model this plan introduces is **`Spree::Supplier`** (`spree_suppliers`, prefix `sup_`, `/api/v3/admin/suppliers`). An earlier draft called it `Spree::Seller`, which collided with the marketplace seller model of `6.0-multi-vendor-marketplace.md` — `Spree::Seller` is reserved for marketplace sellers (see `decisions.md` 2026-07-14). "Supplier" also matches Shopify's purchase-order vocabulary.
## Summary
diff --git a/docs/plans/6.0-multi-vendor-marketplace.md b/docs/plans/6.0-multi-vendor-marketplace.md
index afad51555f..017e84766e 100644
--- a/docs/plans/6.0-multi-vendor-marketplace.md
+++ b/docs/plans/6.0-multi-vendor-marketplace.md
@@ -2,17 +2,17 @@
**Status:** Design complete (2026-08-15 — auth/API surface + the last blocking questions settled), implementation not started
**Target:** Spree 6.0 (the "Marketplace" release)
-**Depends on:** `6.0-cart-order-split.md` (Cart/Order split + dual-FK `LineItem` owner (`cart_id`/`order_id`, `#owner` method) — **expanded 2026-07-27; Phase 3 design can now freeze against it**), `6.0-6.1-split-adjustments.md` (TaxLine/Discount/Fee replace polymorphic Adjustment), `6.0-order-routing.md` (per-seller stock location), `6.0-fulfillment-and-delivery.md` (Fulfillment/DeliveryMethod vocabulary, per-vendor delivery selection), `6.0-admin-spa.md` (vendor panel composition), `6.0-admin-api.md` (Marketplace endpoints), `6.0-platform-auth.md` (`Spree::AdminUser` is the vendor principal; strategy registries + JWT audiences — shipped in PR #14380), `6.0-admin-rbac.md` (permission catalog, `RoleUser` resource typing, vendor audience direction — shipped in PR #14412)
+**Depends on:** `6.0-cart-order-split.md` (Cart/Order split + dual-FK `LineItem` owner (`cart_id`/`order_id`, `#owner` method) — **expanded 2026-07-27; Phase 3 design can now freeze against it**), `6.0-6.1-split-adjustments.md` (TaxLine/Discount/Fee replace polymorphic Adjustment), `6.0-order-routing.md` (per-seller stock location), `6.0-fulfillment-and-delivery.md` (Fulfillment/DeliveryMethod vocabulary, per-seller delivery selection), `6.0-admin-spa.md` (seller panel composition), `6.0-admin-api.md` (Marketplace endpoints), `6.0-platform-auth.md` (`Spree::AdminUser` is the seller principal; strategy registries + JWT audiences — shipped in PR #14380), `6.0-admin-rbac.md` (permission catalog, `RoleUser` resource typing, seller audience direction — shipped in PR #14412)
**Author:** Damian + Claude
**Last updated:** 2026-08-15
## Summary
-Open-source the core of Spree's multi-vendor marketplace into Spree 6.0, per [spree/spree#13323](https://github.com/spree/spree/issues/13323). Today multi-vendor lives in the paid Enterprise module as a **decorator-heavy monkey-patch** of core (dozens of prepended core classes, a parent order mutated into a line-item-less "splitted" state). 6.0 brings the **Vendor identity, per-seller order splitting, the commission engine, and the payout ledger** into core as first-class models — built natively on the 6.0 Cart/Order split rather than retrofitted onto the legacy `Order`-only model.
+Open-source the core of Spree's multi-vendor marketplace into Spree 6.0, per [spree/spree#13323](https://github.com/spree/spree/issues/13323). Today multi-vendor lives in the paid Enterprise module as a **decorator-heavy monkey-patch** of core (dozens of prepended core classes, a parent order mutated into a line-item-less "splitted" state). 6.0 brings the **Seller identity, per-seller order splitting, the commission engine, and the payout ledger** into core as first-class models — built natively on the 6.0 Cart/Order split rather than retrofitted onto the legacy `Order`-only model.
What stays paid (Enterprise — boundary amended 2026-07-15, see `decisions.md`): refund **clawbacks** (automatic Stripe transfer reversals + negative-balance netting), ledger⇄provider **reconciliation**, KYC/account-health operations, payout reports (incl. DAC7), marketplace-facilitator taxes, Shopify/WooCommerce sales-channel apps, the category mapper. **Basic Stripe Connect execution — Express onboarding + on-fulfillment transfers — ships open-source in the monorepo**, alongside the Stripe core gateway being pulled in from the standalone `spree_stripe` repo (the payment-sessions-API classes only; the legacy v2-API/storefront code stays behind — likely home: `spree/core`). **Core runs the happy path end-to-end (onboard, sell, get paid); Enterprise operates the unhappy paths and compliance at scale.**
-This plan covers the four subsystems: **(A) vendor identity & teams**, **(B) order splitting**, **(C) the commission engine**, and **(D) the payout/fund-transfer ledger**. It is informed by a source-level port review of the current Enterprise multi-vendor module (private source — internals deliberately not cited here), the Enterprise behavior documented in the public user docs, and a survey of modern open-source marketplace implementations — see References (competitor names and the detailed comparison are likewise kept out of this public file).
+This plan covers the four subsystems: **(A) seller identity & teams**, **(B) order splitting**, **(C) the commission engine**, and **(D) the payout/fund-transfer ledger**. It is informed by a source-level port review of the current Enterprise multi-vendor module (private source — internals deliberately not cited here), the Enterprise behavior documented in the public user docs, and a survey of modern open-source marketplace implementations — see References (competitor names and the detailed comparison are likewise kept out of this public file).
## Key Decisions (do not deviate without discussion)
@@ -20,30 +20,32 @@ This plan covers the four subsystems: **(A) vendor identity & teams**, **(B) ord
| OSS core (this plan) | Enterprise (stays paid) |
|---|---|
-| `Spree::Vendor` identity + invitation **and self-serve application** onboarding state machine + vendor teams (reusing `Role`/`RoleUser`/`Invitation`) | KYC/account-health **operations** (requirements monitoring, restricted-account workflows) |
-| Vendor admin dashboard (composed from `@spree/dashboard-*`) + operator marketplace screens | Refund **clawbacks** — automatic Stripe transfer reversals + negative-balance netting |
+| `Spree::Seller` identity + invitation **and self-serve application** onboarding state machine + seller teams (reusing `Role`/`RoleUser`/`Invitation`) | KYC/account-health **operations** (requirements monitoring, restricted-account workflows) |
+| Seller admin dashboard (composed from `@spree/dashboard-*`) + operator marketplace screens | Refund **clawbacks** — automatic Stripe transfer reversals + negative-balance netting |
| **Basic Stripe Connect payouts** (Express onboarding link + on-fulfillment transfers — ships with the monorepo Stripe gateway) | Ledger⇄Stripe **reconciliation** |
-| Commission engine (vendor- + product- + category-level rules, **commission taxation**) | Payout reports (incl. EU **DAC7** seller-income reporting) |
+| Commission engine (seller- + product- + category-level rules, **commission taxation**) | Payout reports (incl. EU **DAC7** seller-income reporting) |
| Order splitting + payment split | Shopify white-label Sales Channel app |
-| **Fund ledger** — `VendorTransfer` (on-fulfillment earnings) + `VendorPayout` (scheduled settlement) + balance, lifecycle, reversals | WooCommerce integration |
-| Vendor CSV import/export (rides the `Spree::Import`/`Spree::Export` pipeline) | Category mapper (external category → Spree taxon) |
-| Vendors API endpoints (Admin + Store) + lifecycle webhooks/events + onboarding task registry (core tasks) | Enterprise onboarding **tasks** registered into the core checklist (Stripe KYC, Shopify/Woo store connection) |
+| **Fund ledger** — `SellerTransfer` (on-fulfillment earnings) + `SellerPayout` (scheduled settlement) + balance, lifecycle, reversals | WooCommerce integration |
+| Seller CSV import/export (rides the `Spree::Import`/`Spree::Export` pipeline) | Category mapper (external category → Spree taxon) |
+| Sellers API endpoints (Admin + Store) + lifecycle webhooks/events + onboarding task registry (core tasks) | Enterprise onboarding **tasks** registered into the core checklist (Stripe KYC, Shopify/Woo store connection) |
| Merchandising + permissions (via code) | "Automatic taxes" (marketplace-facilitator remittance) |
-The boundary is **operational depth**: you can run a marketplace for free end-to-end — vendors onboard to Stripe Express through a hosted link and get paid automatically on fulfillment — and core records what each vendor is owed (the payout ledger). The moment you need the money *operations* — automatic refund clawbacks, negative-balance netting, ledger⇄Stripe reconciliation, KYC workflows, regulatory reporting, tax remittance — that's Enterprise (Decision 9).
+The boundary is **operational depth**: you can run a marketplace for free end-to-end — sellers onboard to Stripe Express through a hosted link and get paid automatically on fulfillment — and core records what each seller is owed (the payout ledger). The moment you need the money *operations* — automatic refund clawbacks, negative-balance netting, ledger⇄Stripe reconciliation, KYC workflows, regulatory reporting, tax remittance — that's Enterprise (Decision 9).
**The OSS payout story is execution-capable, not just record-keeping (amended 2026-07-15):** the monorepo's Stripe gateway ships a basic `PayoutProvider::StripeConnect` — Express onboarding + on-fulfillment transfers — so the free tier demos money movement end-to-end, at parity with the surveyed OSS competition. `PayoutProvider` stays a public interface, so community providers (PayPal Payouts, Wise, SEPA batch files) are first-class. Enterprise differentiates on the operations *around* the money, not on whether money moves.
-### `Spree::Vendor` name ownership (RESOLVED 2026-07-14)
+### `Spree::Seller` name ownership (RESOLVED 2026-07-14; renamed 2026-08-17)
-`Spree::Vendor` (prefix `ven_`, table `spree_vendors`) is **the marketplace seller — this plan's model**. The purchase-order procurement source that `6.0-inventory-operations.md` had also named `Spree::Vendor` is renamed **`Spree::Supplier`** (`sup_`, `spree_suppliers`, `/api/v3/admin/suppliers`). Rationale in `decisions.md` 2026-07-14: the marketplace name is locked publicly (#13323, the user docs' Vendors area, the legacy Enterprise module's `ven_` prefix and production data), and the two are different lifecycles — a supplier is an address-book entry the merchant buys stock from; a vendor is an onboarded selling party with users, commission, and payouts.
+`Spree::Seller` (prefix `sel_`, table `spree_sellers`) is **the marketplace seller — this plan's model**. The purchase-order procurement source is **`Spree::Supplier`** (`sup_`, `spree_suppliers`, `/api/v3/admin/suppliers`). They are different lifecycles: a supplier is an address-book entry the merchant buys stock from; a seller is an onboarded selling party with users, commission, and payouts.
+
+Both models were originally called `Spree::Vendor` — a hard collision resolved on 2026-07-14 by giving the marketplace the `Vendor` name and renaming the procurement source. The split stood; the naming was reversed on 2026-08-17 once the two reasons for it expired (the user docs are being rewritten for 6.0 stable, and there is no Enterprise production data to keep `ven_` continuity with). **`vendor` was the wrong word for the marketplace side precisely because this schema also holds the supplier**: Amazon's Vendor Central buys from suppliers while Seller Central hosts third parties, so `vendor_id` reads as the procurement relationship to anyone with Amazon experience. `Seller` is also what Gartner, Forrester, VTEX, Marketplacer, Amazon and Mercur all use for this entity. Full rationale in `decisions.md` 2026-08-17.
### 1. Split happens at cart completion, into N child Orders under one parent — never seller-tagged flat line items
The legacy module and current industry implementations agree on the shape, and it maps cleanly onto `6.0-cart-order-split.md`:
-- One mixed **`Spree::Cart`** through the entire shopping + checkout flow (a customer adds items from many vendors to one cart — no per-vendor cart fragmentation).
-- At `cart.complete!` (the `Spree::Carts::Complete` service from the cart/order-split plan), partition cart line items **by the denormalized `line_item.vendor_id` snapshot** (set from `product.vendor` at add-to-cart; revalidated at completion — see Order splitting) and, **when the cart spans more than one partition** (first-party items, `vendor_id: nil`, count as their own partition), fan out into **N child `Spree::Order`s, one per partition**, all owned by **one `Spree::OrderGroup`** that holds customer/payment/address context. Single-partition carts complete as a bare order — no group (see the Trigger & gate bullet).
+- One mixed **`Spree::Cart`** through the entire shopping + checkout flow (a customer adds items from many sellers to one cart — no per-seller cart fragmentation).
+- At `cart.complete!` (the `Spree::Carts::Complete` service from the cart/order-split plan), partition cart line items **by the denormalized `line_item.seller_id` snapshot** (set from `product.seller` at add-to-cart; revalidated at completion — see Order splitting) and, **when the cart spans more than one partition** (first-party items, `seller_id: nil`, count as their own partition), fan out into **N child `Spree::Order`s, one per partition**, all owned by **one `Spree::OrderGroup`** that holds customer/payment/address context. Single-partition carts complete as a bare order — no group (see the Trigger & gate bullet).
- The parent↔child relationship is an explicit FK via a dedicated `Spree::OrderGroup`, **not** the legacy `state == 'splitted'` string hack and **not** a join-table indirection. See Design Details and Decision 8.
This is the single most important integration point with the rest of 6.0: **the split is a consumer of the Cart/Order split, implemented inside the completion service**, not a state-machine `after_transition` callback bolted onto a monolithic `Order` (which is how the legacy module did it). The 6.0 cart/order plan removes the order-level state machine entirely, so the legacy trigger cannot survive — splitting must be invoked explicitly from `Carts::Complete`.
@@ -55,11 +57,11 @@ Mirror the core insight from both the legacy module and the industry references:
- New model **`Spree::CommissionLine`** (NOT a revival of the legacy commission table, NOT a polymorphic `Adjustment`). One row per commissioned line item — plus one per fulfillment when the rate commissions delivery revenue (`include_shipping`, Decision 4) — storing a **snapshot** of `rate`, `amount`, and the resolved rule's identity.
- Written by a service during/after `cart.complete!`, once. A later rate change does not touch existing lines.
- **Frozen, not re-derived (corroborated 2026-08-17).** A source review of the leading surveyed OSS engine found it re-resolves commission from *current* rate configuration on every refresh (order edit, return received, claim created), deleting and reinserting the lines — so editing a rate there retroactively changes what a seller was already charged on past orders. Its own documentation claims the opposite, which is worth knowing if it is ever used as a reference. Ours are a snapshot written once, the same rule the duties work settled ("never re-derive from the live catalog on an existing order").
-- **Commission is NOT a `Spree::Fee`.** `6.0-6.1-split-adjustments.md`'s `Fee` is a *buyer-facing* charge — it rolls into `order.fee_total` and the order total the customer pays. Commission is a *platform ↔ vendor* settlement line the customer never sees; it must never touch order totals. `CommissionLine` is therefore its own off-order ledger table that merely follows the same typed-line design (concrete FKs, no polymorphic source, no state machine) as the split-adjustments family. The only real split-adjustments dependency is that tax lines / discounts / fees are line-item-attached, so they re-home cleanly to the child order during the split. (A *buyer-facing* marketplace service fee — StockX-style — would be a `Spree::Fee` with a `kind`; possible later, out of scope here.)
+- **Commission is NOT a `Spree::Fee`.** `6.0-6.1-split-adjustments.md`'s `Fee` is a *buyer-facing* charge — it rolls into `order.fee_total` and the order total the customer pays. Commission is a *platform ↔ seller* settlement line the customer never sees; it must never touch order totals. `CommissionLine` is therefore its own off-order ledger table that merely follows the same typed-line design (concrete FKs, no polymorphic source, no state machine) as the split-adjustments family. The only real split-adjustments dependency is that tax lines / discounts / fees are line-item-attached, so they re-home cleanly to the child order during the split. (A *buyer-facing* marketplace service fee — StockX-style — would be a `Spree::Fee` with a `kind`; possible later, out of scope here.)
### 3. Commission taxation is a first-class field — this is the OSS differentiator
-This is the one place where the **legacy Enterprise module is ahead of the surveyed industry implementations** and the reason #13323 calls out "commission taxation which is essential for European marketplaces." The common industry pattern uses an `include_tax` toggle that only decides whether the *seller's item tax* inflates the commission base; it charges **no tax on the marketplace fee itself**. The legacy module already charges VAT *on the commission* at a configurable per-vendor rate (`fee_total = fee_amount + fee_amount × tax_rate`, half-up rounding). The marketplace's commission is itself a **taxable B2B service** the platform renders to the seller. 6.0 must model:
+This is the one place where the **legacy Enterprise module is ahead of the surveyed industry implementations** and the reason #13323 calls out "commission taxation which is essential for European marketplaces." The common industry pattern uses an `include_tax` toggle that only decides whether the *seller's item tax* inflates the commission base; it charges **no tax on the marketplace fee itself**. The legacy module already charges VAT *on the commission* at a configurable per-seller rate (`fee_total = fee_amount + fee_amount × tax_rate`, half-up rounding). The marketplace's commission is itself a **taxable B2B service** the platform renders to the seller. 6.0 must model:
- `amount` — the commission (the fee the platform charges the seller),
- `tax_amount` — VAT/tax **on that commission**, at a configurable commission tax rate,
- `tax_rate` — the rate that produced it, so the row explains its own figure,
@@ -72,15 +74,15 @@ Reusing `Spree::TaxLine` was considered and rejected, and the reason is worth re
What is borrowed instead is the **vocabulary**. The line carries `taxability_reason` validated against `Spree::TaxLine.taxability_reasons` — one list, so a provider registering a treatment registers it once — plus `country_code`/`state_code` through `has_iso_geography`, holding the **seller's** jurisdiction rather than the shopper's. `Spree::CommissionTax` is the ephemeral value object the resolver returns, carrying rate and treatment together; only the tax engine sets a jurisdiction, since an operator override or a store default is a number somebody typed and knows no country. Should a fee ever attract two levies at once, these are the columns that move to child rows, and they will already be named as `TaxLine` names them.
-**EU base (RESOLVED 2026-06-25):** commission is computed on the seller's **net (ex-VAT)** item price, and `tax_amount` is applied **on top of the commission** — the marketplace fee is a separate taxable supply from the consumer's item sale, so the two VATs never mix. That base toggle stays available for non-EU/edge merchants who want a gross base (shipped as `tax_inclusive`), but the EU default is net-base + fee-VAT. The **tax-on-the-fee** field is mandatory and is the headline EU feature. The commission tax *rate* is resolved through `6.0-tax-provider.md` (per-Market TaxProvider) rather than a bare `platform_fee_tax_rate` column on the vendor (RESOLVED — see Resolved Decisions).
+**EU base (RESOLVED 2026-06-25):** commission is computed on the seller's **net (ex-VAT)** item price, and `tax_amount` is applied **on top of the commission** — the marketplace fee is a separate taxable supply from the consumer's item sale, so the two VATs never mix. That base toggle stays available for non-EU/edge merchants who want a gross base (shipped as `tax_inclusive`), but the EU default is net-base + fee-VAT. The **tax-on-the-fee** field is mandatory and is the headline EU feature. The commission tax *rate* is resolved through `6.0-tax-provider.md` (per-Market TaxProvider) rather than a bare `platform_fee_tax_rate` column on the seller (RESOLVED — see Resolved Decisions).
### 4. Commission rate resolution: layered rules, first match wins in operator order — generalize the legacy flat rate
-The legacy module resolves a **single flat percentage** with a two-level fallback: the product's platform-fee override if set, else the vendor's default rate. That is "very simplified" — percentage only; no categories, no caps, no currency scoping. The industry pattern generalizes this into a proper `CommissionRate` + `CommissionRule` engine (operator-ordered, first-match-wins, dimension-grouped targeting rules, `percentage | fixed`, `min_amount` floor, currency gate, no-rules = global default).
+The legacy module resolves a **single flat percentage** with a two-level fallback: the product's platform-fee override if set, else the seller's default rate. That is "very simplified" — percentage only; no categories, no caps, no currency scoping. The industry pattern generalizes this into a proper `CommissionRate` + `CommissionRule` engine (operator-ordered, first-match-wins, dimension-grouped targeting rules, `percentage | fixed`, `min_amount` floor, currency gate, no-rules = global default).
-**6.0 adopts the rule-engine shape but keeps the legacy fallback as the default ladder.** New models `Spree::CommissionRate` (position, kind, value, currency, commission tax handling) + `Spree::CommissionRule` (polymorphic `subject` → Product / Category / Vendor / global). Resolution walks enabled rates in list order, first match wins. Seed a marketplace-wide rate at the bottom of the list so narrower rates an operator adds resolve ahead of it.
+**6.0 adopts the rule-engine shape but keeps the legacy fallback as the default ladder.** New models `Spree::CommissionRate` (position, kind, value, currency, commission tax handling) + `Spree::CommissionRule` (polymorphic `subject` → Product / Category / Seller / global). Resolution walks enabled rates in list order, first match wins. Seed a marketplace-wide rate at the bottom of the list so narrower rates an operator adds resolve ahead of it.
-**Rule matching: every rule must hold, and a rule naming several records means any of them.** A rate carries typed rules (Product / Category / Vendor / value band / …); the rate matches a line item when every one of them says yes, and a rule holding several ids is satisfied by any of them. A category rule naming Electronics and Cameras beside a vendor rule naming X reads "(Electronics OR Cameras) AND vendor X" — which expresses plain lists *and* the **vendor × category pairing** today's Enterprise sells (user docs: "per vendor, per category-vendor pairing, or per individual product") with no `match_policy` knob at all. The leading surveyed OSS engine uses the same semantics, so the model is proven; where we differ deliberately is precedence — an explicit operator-ordered list instead of implicit most-specific-wins, which is more predictable (already RESOLVED below).
+**Rule matching: every rule must hold, and a rule naming several records means any of them.** A rate carries typed rules (Product / Category / Seller / value band / …); the rate matches a line item when every one of them says yes, and a rule holding several ids is satisfied by any of them. A category rule naming Electronics and Cameras beside a seller rule naming X reads "(Electronics OR Cameras) AND seller X" — which expresses plain lists *and* the **seller × category pairing** today's Enterprise sells (user docs: "per seller, per category-seller pairing, or per individual product") with no `match_policy` knob at all. The leading surveyed OSS engine uses the same semantics, so the model is proven; where we differ deliberately is precedence — an explicit operator-ordered list instead of implicit most-specific-wins, which is more predictable (already RESOLVED below).
**Rule shape evidence (survey 2026-08-17).** Read against the enterprise platform's own published API contract, our `(subject_type, subject_id)` rule is the weakest of the three models surveyed. There, a rule carries a typed configuration block — seller ids, channel codes, brands, condition codes — plus a validity `period` and an applicability ceiling, and its rate is a list of tiered thresholds rather than one number. Every dimension we currently cannot express without a migration (price band, channel, validity window, product attribute) is a field there. The other OSS engine shares our shape and is equally stuck: five hardcoded dimensions behind a `switch` with no extension point, and it removed its own minimum-amount cap rather than generalising it. The conclusion is that a commission rule needs **its own configuration**, not merely a pointer to a record — which is what the STI rule pattern already used by `Spree::PriceRule` and `Spree::DeliveryMethodRule` provides (see Resolved Decisions).
@@ -88,7 +90,7 @@ Two specifics worth copying rather than inventing. Tiering is expressed as thres
**Precedence evidence (source review 2026-08-17).** That engine is worth reading on this point because it has now tried *both* of the alternatives we rejected. It shipped a `priority` integer, then dropped it in a later migration in favour of most-specific-wins — scoring a rate by how many distinct dimensions it names, tie-broken by creation date. Two failure modes follow from that scoring and are visible in its current source: dimensions are unranked, so a product-specific rate and a seller-wide rate both score 1 and the *older* one wins; and creation order therefore becomes load-bearing configuration a merchant can neither see nor change. Our ordered list is the third option and answers both — the ladder is explicit, visible, and reorderable. The same review found that engine also removed its `min_amount` cap, and has no notion of tax on the commission at all, so our floor/cap and the EU fee-VAT have no prior art there to copy.
-**`include_shipping` on the rate** (default `false`): when the resolved rate has it, the same calculation also runs against the vendor order's delivery amounts, persisting a fulfillment-scoped `CommissionLine`. The surveyed OSS competitor commissions shipping via a global-rate-only flag, and Amazon-style referral fees include it; the legacy module was items-only (its order-level "reverse fee" only prorates *item* commission on whole-order refunds — shipping is excluded from its base). Ours is per-rate — strictly more flexible than a global-only flag, and off by default so legacy behavior is preserved.
+**`include_shipping` on the rate** (default `false`): when the resolved rate has it, the same calculation also runs against the seller order's delivery amounts, persisting a fulfillment-scoped `CommissionLine`. The surveyed OSS competitor commissions shipping via a global-rate-only flag, and Amazon-style referral fees include it; the legacy module was items-only (its order-level "reverse fee" only prorates *item* commission on whole-order refunds — shipping is excluded from its base). Ours is per-rate — strictly more flexible than a global-only flag, and off by default so legacy behavior is preserved.
**Percentage only (RESOLVED 2026-08-17, shipped).** A flat fee cannot charge delivery. A percentage answers "what share of this money is ours?", and postage is money; a flat fee answers "what do we charge for handling this?", and the parcel is part of the sale already being charged for — so a £5 rate on a three-item order was billing £20. The flag is refused on a `fixed` rate and the toggle is hidden for one, matching the surveyed OSS engine, which reads its shipping flag off the percentage default only. A marketplace wanting a flat charge on delivery states it as its own rate, which composes correctly because rates resolve independently.
@@ -108,100 +110,100 @@ The customer makes **one payment** (one gateway charge against the order group).
Two patterns exist in the wild: (a) link one payment collection to all child orders and split captures *proportionally* into per-order transaction rows computed on read; or (b) an explicit **split-payment record** per child order (`authorized_amount`, `captured_amount`, `refunded_amount`).
-**6.0 adopts the explicit per-seller payment record** (pattern b) rather than proportion-on-read, because a marketplace needs a durable per-seller audit trail for partial captures, partial refunds, and payouts. This is also what the legacy module effectively did by creating real `Spree::Payment` rows on each vendor sub-order — but 6.0 does **not** clone `Payment` rows: the gateway object stays singular.
+**6.0 adopts the explicit per-seller payment record** (pattern b) rather than proportion-on-read, because a marketplace needs a durable per-seller audit trail for partial captures, partial refunds, and payouts. This is also what the legacy module effectively did by creating real `Spree::Payment` rows on each seller sub-order — but 6.0 does **not** clone `Payment` rows: the gateway object stays singular.
-Concretely: `Spree::Payment` gains a nullable `order_group_id` — a grouped checkout's payment attaches to the **group** (its `order_id` is nil); a plain ungrouped order keeps `payment.order` as today. The per-seller bookkeeping is a new **`Spree::PaymentSplit`** row per child order (`payment_id`, `order_id`, `authorized_amount` / `captured_amount` / `refunded_amount`, `currency`) — sketched in Design Details. A partial refund on one vendor's order updates that child's split, never the siblings'.
+Concretely: `Spree::Payment` gains a nullable `order_group_id` — a grouped checkout's payment attaches to the **group** (its `order_id` is nil); a plain ungrouped order keeps `payment.order` as today. The per-seller bookkeeping is a new **`Spree::PaymentSplit`** row per child order (`payment_id`, `order_id`, `authorized_amount` / `captured_amount` / `refunded_amount`, `currency`) — sketched in Design Details. A partial refund on one seller's order updates that child's split, never the siblings'.
### 6. Per-seller totals are computed independently, not prorated
-Confirmed by the references and the legacy module (its split moves line items, adjustments, inventory units, and shipments wholesale to the child order, then recomputes). Taxes/discounts/shipping travel with whichever line item or shipment they were attached to, into exactly one vendor's order; each child order recomputes its own totals. **No cart-level total proration** (the one exception is the single payment capture, Decision 5, and store-credit allocation, which the references and the legacy module prorate per item).
+Confirmed by the references and the legacy module (its split moves line items, adjustments, inventory units, and shipments wholesale to the child order, then recomputes). Taxes/discounts/shipping travel with whichever line item or shipment they were attached to, into exactly one seller's order; each child order recomputes its own totals. **No cart-level total proration** (the one exception is the single payment capture, Decision 5, and store-credit allocation, which the references and the legacy module prorate per item).
### 7. Native models, not decorators
-The legacy module is a large decorator layer prepending ~35 core classes. 6.0 brings this into core as **real models, associations, and services** — `Spree::Vendor`, `Spree::OrderGroup`, `Spree::PaymentSplit`, `Spree::CommissionLine`, `Spree::CommissionRate`, `Spree::CommissionRule`, `Spree::VendorTransfer`, `Spree::VendorPayout`, and a `Spree::Carts::SplitByVendor` (or folded into `Carts::Complete`) service. No `prepend`. Follow `CLAUDE.md` model conventions (`Spree.base_class`, prefixed IDs, `class_name`/`dependent` on every association, string status columns, paranoia where needed).
+The legacy module is a large decorator layer prepending ~35 core classes. 6.0 brings this into core as **real models, associations, and services** — `Spree::Seller`, `Spree::OrderGroup`, `Spree::PaymentSplit`, `Spree::CommissionLine`, `Spree::CommissionRate`, `Spree::CommissionRule`, `Spree::SellerTransfer`, `Spree::SellerPayout`, and a `Spree::Carts::SplitBySeller` (or folded into `Carts::Complete`) service. No `prepend`. Follow `CLAUDE.md` model conventions (`Spree.base_class`, prefixed IDs, `class_name`/`dependent` on every association, string status columns, paranoia where needed).
-Deliberately **not** new models: vendor team membership and invitations reuse the existing polymorphic rails — `Spree::RoleUser` (`resource: vendor`) and `Spree::Invitation` (`resource: vendor`; its `resource` docstring already names Vendor as an intended type). The legacy admin's `current_vendor` hooks (`spree/admin` `base_controller.rb:155`, `resource_controller.rb:249`) exist only for the Enterprise module's legacy-admin panel and die with the legacy admin; the 6.0 equivalent is `current_vendor` scope-fetching on a dedicated Vendor API branch (Decision 10 — not ability-level scoping, which the RBAC catalog cannot express).
+Deliberately **not** new models: seller team membership and invitations reuse the existing polymorphic rails — `Spree::RoleUser` (`resource: seller`) and `Spree::Invitation` (`resource: seller`; its `resource` docstring already names Seller as an intended type). The legacy admin's `current_seller` hooks (`spree/admin` `base_controller.rb:155`, `resource_controller.rb:249`) exist only for the Enterprise module's legacy-admin panel and die with the legacy admin; the 6.0 equivalent is `current_seller` scope-fetching on a dedicated Seller API branch (Decision 10 — not ability-level scoping, which the RBAC catalog cannot express).
### 8. The parent is a dedicated `Spree::OrderGroup`, not `Order#parent_id` (RESOLVED 2026-06-16)
The container is a **separate `Spree::OrderGroup` model**, not the legacy "an Order that is secretly a parent" (`Order#parent_id` + `state == 'splitted'`).
-**Crucially, `OrderGroup` is a domain-neutral primitive, not a marketplace concept.** It means "N orders placed together as one customer transaction" — multi-vendor is merely its *first* consumer. The same primitive is reused, without a second container model, for: split-by-fulfillment-location (one checkout → per-warehouse orders), split-by-availability (in-stock + pre-order/backorder in one cart), and B2B split-by-company-location (`6.0-channels-catalogs-b2b.md` → 6.1). Naming it `OrderGroup` (not `VendorOrderSet`) keeps it reusable across all of these. The vendor relationship lives on the **child `Order`** (`order.vendor`), never on the group — the group stays vendor-agnostic.
+**Crucially, `OrderGroup` is a domain-neutral primitive, not a marketplace concept.** It means "N orders placed together as one customer transaction" — multi-vendor is merely its *first* consumer. The same primitive is reused, without a second container model, for: split-by-fulfillment-location (one checkout → per-warehouse orders), split-by-availability (in-stock + pre-order/backorder in one cart), and B2B split-by-company-location (`6.0-channels-catalogs-b2b.md` → 6.1). Naming it `OrderGroup` (not `SellerOrderSet`) keeps it reusable across all of these. The seller relationship lives on the **child `Order`** (`order.seller`), never on the group — the group stays seller-agnostic.
Why a dedicated model beats `parent_id`:
- No ambiguity / no empty parent orders. A parent `Order` with `parent_id: nil` and zero line items (the legacy shape) breaks every "an order has line items" assumption and forces a family of union-association and "is this really a parent?" workarounds. `OrderGroup` simply *has many* orders.
- Clean composition with the Cart/Order split: `Cart` (one, mixed) → on completion → one `OrderGroup` owning N child `Order`s. The group is the natural home for the single payment, the customer, and the shared addresses; children own their own line items, shipments, totals.
- Future-proof: when split-by-location or B2B needs the same fan-out, they reuse `OrderGroup` rather than overloading `Order` again.
-**This requires an Enterprise-side data backfill** (not core — existing OSS stores have no vendors). The Enterprise module must ship a one-time migration that, for every legacy `splitted` parent order, creates an `OrderGroup`, attaches its `parent_id`-children as the group's orders, and migrates the legacy commission rows into `spree_commission_lines`. The backfill lives in Enterprise because only Enterprise customers have legacy marketplace data; core ships clean. Tracked as a hard dependency for the Enterprise 6.0 upgrade. See Migration Path.
+**This requires an Enterprise-side data backfill** (not core — existing OSS stores have no sellers). The Enterprise module must ship a one-time migration that, for every legacy `splitted` parent order, creates an `OrderGroup`, attaches its `parent_id`-children as the group's orders, and migrates the legacy commission rows into `spree_commission_lines`. The backfill lives in Enterprise because only Enterprise customers have legacy marketplace data; core ships clean. Tracked as a hard dependency for the Enterprise 6.0 upgrade. See Migration Path.
-### 9. Two-level fund ledger — `VendorTransfer` (on-fulfillment) + `VendorPayout` (on-interval), generic in core + a pluggable provider that executes it (RESOLVED 2026-06-25)
+### 9. Two-level fund ledger — `SellerTransfer` (on-fulfillment) + `SellerPayout` (on-interval), generic in core + a pluggable provider that executes it (RESOLVED 2026-06-25)
**Transfer and payout are two distinct events** — the legacy module conflated them, and an earlier draft of this plan repeated the mistake. They must be separate models:
-- **`Spree::VendorTransfer`** — the **per-order** fund movement, triggered **on-fulfillment**. When a vendor's order is fully fulfilled (shipped; digital fulfills instantly after payment), the vendor *earns* `sale − commission`; that credits their balance. One transfer per fulfilled vendor order. This is what the legacy Stripe transfer ledger actually modeled (it fires when the vendor sub-order's shipments are all shipped).
-- **`Spree::VendorPayout`** — the **scheduled settlement**, triggered **on-interval** (daily/weekly/biweekly/monthly). It sweeps the vendor's accumulated unpaid transfers, batches them into one bank settlement, and debits the balance. One payout per interval per vendor (per currency).
+- **`Spree::SellerTransfer`** — the **per-order** fund movement, triggered **on-fulfillment**. When a seller's order is fully fulfilled (shipped; digital fulfills instantly after payment), the seller *earns* `sale − commission`; that credits their balance. One transfer per fulfilled seller order. This is what the legacy Stripe transfer ledger actually modeled (it fires when the seller sub-order's shipments are all shipped).
+- **`Spree::SellerPayout`** — the **scheduled settlement**, triggered **on-interval** (daily/weekly/biweekly/monthly). It sweeps the seller's accumulated unpaid transfers, batches them into one bank settlement, and debits the balance. One payout per interval per seller (per currency).
The legacy module only models the transfer and **outsources payouts to Stripe** (it just configures Stripe's native connected-account payout schedule — there is no `Payout` record; its "payouts" screens are *reports* aggregating transfers, not a ledger). That's fine for Stripe-only Enterprise but **wrong for OSS core**: a `system`-provider marketplace has no Stripe to schedule settlements, so it needs its own payout records.
```text
-Spree::VendorTransfer (one per fulfilled vendor order, on-fulfillment) → credits vendor balance
+Spree::SellerTransfer (one per fulfilled seller order, on-fulfillment) → credits seller balance
↓ accumulate (sale − commission)
-Spree::VendorPayout (one per interval per vendor, scheduled) → debits balance, settles to bank
- ↑ has_many transfers (each VendorTransfer.payout_id) (batches N transfers; amount = Σ them)
+Spree::SellerPayout (one per interval per seller, scheduled) → debits balance, settles to bank
+ ↑ has_many transfers (each SellerTransfer.payout_id) (batches N transfers; amount = Σ them)
-vendor.balance = Σ(completed transfers) − Σ(completed payouts) # derived bridge between the two levels
+seller.balance = Σ(completed transfers) − Σ(completed payouts) # derived bridge between the two levels
```
-**Payout ⇄ Transfer link (RESOLVED): transfers `belong_to` a payout.** Each `VendorTransfer` carries a nullable `payout_id`. The scheduled job sweeps all unpaid completed transfers for a vendor, creates one `VendorPayout`, and stamps them with its id; `payout.amount = SUM(its transfers)`. Every payout itemizes *exactly* which order-transfers it settled — auditable, and robust to mid-period reversals (a refund after a transfer was already paid out becomes the **next** period's negative transfer rather than corrupting a closed payout). This is the seller-balance ledger the surveyed industry references *documented but never implemented* — Spree ships it properly.
+**Payout ⇄ Transfer link (RESOLVED): transfers `belong_to` a payout.** Each `SellerTransfer` carries a nullable `payout_id`. The scheduled job sweeps all unpaid completed transfers for a seller, creates one `SellerPayout`, and stamps them with its id; `payout.amount = SUM(its transfers)`. Every payout itemizes *exactly* which order-transfers it settled — auditable, and robust to mid-period reversals (a refund after a transfer was already paid out becomes the **next** period's negative transfer rather than corrupting a closed payout). This is the seller-balance ledger the surveyed industry references *documented but never implemented* — Spree ships it properly.
Both levels are **generic in core + provider-executed**, mirroring `6.0-tax-provider.md` / `6.0-delivery-rate-provider.md`:
-- **Core ships both ledger models** + a **`Spree::PayoutProvider::Base`** strategy with a **`system`** default: it records transfers (on-fulfillment) and payouts (on-interval) but moves no money — the OSS operator sees the per-vendor balance and the itemized payout records, and settles offline (marking the payout complete). This is what #13323 means by core knowing "what's owed."
-- **The monorepo ships the basic `Spree::PayoutProvider::StripeConnect`** (boundary amendment 2026-07-15), alongside the Stripe core gateway being pulled in from the standalone `spree_stripe` repo — only the payment-sessions-API gateway classes come over (likely into `spree/core`); the legacy v2-API/storefront code stays behind. The provider: Express-account creation + hosted onboarding link surfaced in the vendor dashboard + `account.updated` webhook → payout-account status on the vendor. `transfer!` executes an on-fulfillment `Stripe::Transfer` tied to the charge via `source_transaction` (gated on the account being payouts-enabled); `pay!` maps `payouts_schedule_interval` onto Stripe's native connected-account payout schedule and records `VendorPayout` rows from payout webhooks.
+- **Core ships both ledger models** + a **`Spree::PayoutProvider::Base`** strategy with a **`system`** default: it records transfers (on-fulfillment) and payouts (on-interval) but moves no money — the OSS operator sees the per-seller balance and the itemized payout records, and settles offline (marking the payout complete). This is what #13323 means by core knowing "what's owed."
+- **The monorepo ships the basic `Spree::PayoutProvider::StripeConnect`** (boundary amendment 2026-07-15), alongside the Stripe core gateway being pulled in from the standalone `spree_stripe` repo — only the payment-sessions-API gateway classes come over (likely into `spree/core`); the legacy v2-API/storefront code stays behind. The provider: Express-account creation + hosted onboarding link surfaced in the seller dashboard + `account.updated` webhook → payout-account status on the seller. `transfer!` executes an on-fulfillment `Stripe::Transfer` tied to the charge via `source_transaction` (gated on the account being payouts-enabled); `pay!` maps `payouts_schedule_interval` onto Stripe's native connected-account payout schedule and records `SellerPayout` rows from payout webhooks.
- **Enterprise extends that provider with the money operations**: `reverse!` executing prorated Stripe transfer reversals on refund (ports the legacy reversal logic), negative-balance netting against future transfers, KYC/account-health workflows beyond the hosted flow, and ledger⇄Stripe reconciliation + payout reports. The paid tier operates the unhappy paths.
-**OSS funds flow — two modes.** (a) **`system`** (no gateway objects): the customer's single charge settles in full to the operator's own gateway account as a plain payment; the split is pure bookkeeping (`PaymentSplit` + this ledger); disbursement happens outside the gateway — on the payout schedule the operator pays each vendor by bank (SEPA/ACH/wire), guided by the itemized `VendorPayout`, and marks it complete, or automates it (`vendor_payout.due` webhook → banking API → `POST /vendor_payouts/:id/complete`). The platform is merchant of record for the full transaction and carries vendor payables on its own books. (b) **`stripe_connect` basic** (the monorepo Stripe gateway): vendors onboard as Express accounts through Stripe's hosted link; on fulfillment the provider executes a real transfer — money moves automatically. What OSS mode (b) does **not** do is pull money back: a refund always writes the ledger reversal (the books stay correct in every tier), but the Stripe transfer reversal, netting against future transfers, and reconciliation are Enterprise — the first production refund is where the upgrade conversation starts. Note the hard coupling that shapes this seam: a `Stripe::Transfer` requires a connected account, so basic Connect onboarding necessarily ships together with OSS transfer execution; what Enterprise keeps is not onboarding itself but the KYC *operations* around it.
+**OSS funds flow — two modes.** (a) **`system`** (no gateway objects): the customer's single charge settles in full to the operator's own gateway account as a plain payment; the split is pure bookkeeping (`PaymentSplit` + this ledger); disbursement happens outside the gateway — on the payout schedule the operator pays each seller by bank (SEPA/ACH/wire), guided by the itemized `SellerPayout`, and marks it complete, or automates it (`seller_payout.due` webhook → banking API → `POST /seller_payouts/:id/complete`). The platform is merchant of record for the full transaction and carries seller payables on its own books. (b) **`stripe_connect` basic** (the monorepo Stripe gateway): sellers onboard as Express accounts through Stripe's hosted link; on fulfillment the provider executes a real transfer — money moves automatically. What OSS mode (b) does **not** do is pull money back: a refund always writes the ledger reversal (the books stay correct in every tier), but the Stripe transfer reversal, netting against future transfers, and reconciliation are Enterprise — the first production refund is where the upgrade conversation starts. Note the hard coupling that shapes this seam: a `Stripe::Transfer` requires a connected account, so basic Connect onboarding necessarily ships together with OSS transfer execution; what Enterprise keeps is not onboarding itself but the KYC *operations* around it.
-**Transfer amount basis** (ports the legacy allowed-transfer-amount rule, generalized per the resolved store-credit decision): the vendor's sale value minus commission, **payment-source-agnostic** (store credit / gift card is the platform's funding concern, not the vendor's):
+**Transfer amount basis** (ports the legacy allowed-transfer-amount rule, generalized per the resolved store-credit decision): the seller's sale value minus commission, **payment-source-agnostic** (store credit / gift card is the platform's funding concern, not the seller's):
```text
-transfer.amount = vendor_order.total − vendor_order.commission_lines.sum(:total)
+transfer.amount = seller_order.total − seller_order.commission_lines.sum(:total)
```
-`vendor_order.total` is the child order's grand total — items + its delivery + its taxes − its discounts. The deduction is `CommissionLine#total`, i.e. commission **including the VAT on the commission** (the platform invoices the vendor commission + VAT; the vendor reclaims that VAT as input tax). The vendor is **merchant of record** for their child order in v1: consumer tax and shipping revenue are theirs. A *marketplace-facilitator / deemed-supplier* mode — where the platform withholds consumer tax and the basis becomes `total − tax_total − commission` — is selected per vendor by `spree_vendors.tax_remittance` (`vendor` | `platform`, default `vendor`; RESOLVED 2026-08-15): core owns both branches of the math so the ledger stays provider-independent, while *deciding* that a vendor is platform-remitted (nexus, deemed-supplier rules) is Enterprise "automatic taxes" territory (see the scope table).
+`seller_order.total` is the child order's grand total — items + its delivery + its taxes − its discounts. The deduction is `CommissionLine#total`, i.e. commission **including the VAT on the commission** (the platform invoices the seller commission + VAT; the seller reclaims that VAT as input tax). The seller is **merchant of record** for their child order in v1: consumer tax and shipping revenue are theirs. A *marketplace-facilitator / deemed-supplier* mode — where the platform withholds consumer tax and the basis becomes `total − tax_total − commission` — is selected per seller by `spree_sellers.tax_remittance` (`seller` | `platform`, default `seller`; RESOLVED 2026-08-15): core owns both branches of the math so the ledger stays provider-independent, while *deciding* that a seller is platform-remitted (nexus, deemed-supplier rules) is Enterprise "automatic taxes" territory (see the scope table).
-**Reversals** (ports the legacy reversal chain): a refund on a shipped order writes a negative `VendorTransfer` linked to the original via `reversed_from`, so the vendor's net earned is always `Σ(vendor_transfers)`. If the original was already settled in a closed payout, the reversal lands as a negative transfer in the next payout period. Ties into `6.0-returns-exchanges-claims.md`. The reversible-amount rule — original minus already-reversed, floored at zero — carries over as a model method on `VendorTransfer`.
+**Reversals** (ports the legacy reversal chain): a refund on a shipped order writes a negative `SellerTransfer` linked to the original via `reversed_from`, so the seller's net earned is always `Σ(seller_transfers)`. If the original was already settled in a closed payout, the reversal lands as a negative transfer in the next payout period. Ties into `6.0-returns-exchanges-claims.md`. The reversible-amount rule — original minus already-reversed, floored at zero — carries over as a model method on `SellerTransfer`.
-**Triggers (RESOLVED):** `vendor_transfer.due` fires **on-fulfillment** (all the vendor order's fulfillments fulfilled); `vendor_payout.due` fires **on the vendor's `payouts_schedule_interval`** (daily/weekly/biweekly/monthly/manual, `nil` ⇒ store default — the "Use marketplace default interval" semantics in today's Enterprise settings, carried over). Core honors `manual` natively (operator triggers settlement by hand); Enterprise implements the scheduled intervals.
+**Triggers (RESOLVED):** `seller_transfer.due` fires **on-fulfillment** (all the seller order's fulfillments fulfilled); `seller_payout.due` fires **on the seller's `payouts_schedule_interval`** (daily/weekly/biweekly/monthly/manual, `nil` ⇒ store default — the "Use marketplace default interval" semantics in today's Enterprise settings, carried over). Core honors `manual` natively (operator triggers settlement by hand); Enterprise implements the scheduled intervals.
-**Naming & scope (RESOLVED 2026-06-25):** the models keep the `Vendor` prefix and `belongs_to :vendor` — they are deliberately *not* generalized to bare `Transfer`/`Payout`. Rationale: (1) "transfer" and "payout" are heavily overloaded payment terms (gateway ACH/wire transfers, Stripe payout objects) — the `Vendor` prefix is what keeps these ledger records unambiguous and avoids re-introducing the very namespace confusion that made the legacy gateway-namespaced transfer model unclear; (2) the reusability that a dealership / B2B revenue-share scenario would want comes from an **abstract payee** (`belongs_to :payee, polymorphic`), *not* from a generic model name — and we have no second consumer yet, so per YAGNI we bind to `Vendor` now. If a concrete non-vendor payee requirement lands later, the migration path is to make `payee` polymorphic (Vendor + e.g. CompanyLocation) — a localized schema change — rather than a rename. This mirrors `OrderGroup`'s vendor-agnostic structure, but the inverse conclusion is correct here: the container is generic because the vendor lives on its children, whereas these ledger rows are *intrinsically* a payment to one specific payee.
+**Naming & scope (RESOLVED 2026-06-25):** the models keep the `Seller` prefix and `belongs_to :seller` — they are deliberately *not* generalized to bare `Transfer`/`Payout`. Rationale: (1) "transfer" and "payout" are heavily overloaded payment terms (gateway ACH/wire transfers, Stripe payout objects) — the `Seller` prefix is what keeps these ledger records unambiguous and avoids re-introducing the very namespace confusion that made the legacy gateway-namespaced transfer model unclear; (2) the reusability that a dealership / B2B revenue-share scenario would want comes from an **abstract payee** (`belongs_to :payee, polymorphic`), *not* from a generic model name — and we have no second consumer yet, so per YAGNI we bind to `Seller` now. If a concrete non-seller payee requirement lands later, the migration path is to make `payee` polymorphic (Seller + e.g. CompanyLocation) — a localized schema change — rather than a rename. This mirrors `OrderGroup`'s seller-agnostic structure, but the inverse conclusion is correct here: the container is generic because the seller lives on its children, whereas these ledger rows are *intrinsically* a payment to one specific payee.
-### 10. Vendor users are `Spree::AdminUser`, on a dedicated `/api/v3/vendor` API branch with its own JWT audience and login registry (RESOLVED 2026-08-15)
+### 10. Seller users are `Spree::AdminUser`, on a dedicated `/api/v3/seller` API branch with its own JWT audience and login registry (RESOLVED 2026-08-15)
-Two questions were re-examined against the shipped auth (PR #14380) and RBAC (PR #14412) work — should vendor staff be a separate user model, and should they use the Admin API with narrower permissions or their own routes. Both settled the same way: **reuse the principal, separate the surface.**
+Two questions were re-examined against the shipped auth (PR #14380) and RBAC (PR #14412) work — should seller staff be a separate user model, and should they use the Admin API with narrower permissions or their own routes. Both settled the same way: **reuse the principal, separate the surface.**
-**Principal — `Spree.admin_user_class`, no `VendorUser` model.** The platform is two-principal after #14380: `Customer` buys, `AdminUser` operates a back office — and a vendor's team operates a back office. That one class now carries the entire auth stack (`has_secure_password`, lockout, password policy, `generates_token_for :password_reset`, `UserIdentity` SSO linking, invitation acceptance, refresh-token cookie flow); a third principal would duplicate every one of those (and every future MFA/passkey improvement) as a second security surface. The RBAC rails already assume it: `RoleUser` (`user: Spree.admin_user_class`, `resource: vendor`, store binding derived from the vendor), `Invitation` (`resource: vendor`), and `Spree::Ability#staff_roles` deliberately excluding vendor-resourced assignments as belonging to "their own panel's ability". One human, one login, several hats: an `AdminUser` may hold a store role and a vendor role at once (the operator's own first-party seller; a merchant selling on two marketplaces run on two stores). A vendor member is **not** store staff — membership is by *resource type*, never by `store_id`.
+**Principal — `Spree.admin_user_class`, no `SellerUser` model.** The platform is two-principal after #14380: `Customer` buys, `AdminUser` operates a back office — and a seller's team operates a back office. That one class now carries the entire auth stack (`has_secure_password`, lockout, password policy, `generates_token_for :password_reset`, `UserIdentity` SSO linking, invitation acceptance, refresh-token cookie flow); a third principal would duplicate every one of those (and every future MFA/passkey improvement) as a second security surface. The RBAC rails already assume it: `RoleUser` (`user: Spree.admin_user_class`, `resource: seller`, store binding derived from the seller), `Invitation` (`resource: seller`), and `Spree::Ability#staff_roles` deliberately excluding seller-resourced assignments as belonging to "their own panel's ability". One human, one login, several hats: an `AdminUser` may hold a store role and a seller role at once (the operator's own first-party seller; a merchant selling on two marketplaces run on two stores). A seller member is **not** store staff — membership is by *resource type*, never by `store_id`.
-**Surface — a third v3 branch, `/api/v3/vendor/…`, beside `store` and `admin`.** The plan's earlier line ("vendor users hit the same admin API with vendor-scoped abilities — no separate vendor routes") is superseded: it relied on `PermissionSets::VendorUser` with `vendor_id: user.vendor_ids` hash conditions, and #14412 removed permission sets with no bridge — the catalog is flat `read_*`/`write_*` keys with no conditions, and the RBAC plan already re-decided on 2026-08-08 that "vendor-panel endpoints scope-fetch through `current_vendor` exactly as admin endpoints scope through `current_store`". Reusing the ~300 admin endpoints would mean per-principal forks in every `scope`/`find_resource`/incidental lookup (`stock_location_id`, `reason_id`, `variant_id` on line-item writes) — each miss a cross-vendor read or write inside the same store — plus per-principal field masking in serializers. A vendor branch is ~20 controllers, each written scope-first (`current_vendor.products`, `current_vendor.orders`, …): **IDOR by construction**, the same way store isolation works on the admin branch today (controller scoping only — the ability layer has no tenancy conditions). What a vendor may not do (publish to channels, edit orders, refund, approve itself, create stock locations) is an endpoint that does not exist, not an ability rule. Do **not** subclass admin controllers into the vendor namespace — inherited `current_store.*` lookups are precisely the leak; share workflows and permitted-param lists, never controllers.
+**Surface — a third v3 branch, `/api/v3/seller/…`, beside `store` and `admin`.** The plan's earlier line ("seller users hit the same admin API with seller-scoped abilities — no separate seller routes") is superseded: it relied on `PermissionSets::SellerUser` with `seller_id: user.seller_ids` hash conditions, and #14412 removed permission sets with no bridge — the catalog is flat `read_*`/`write_*` keys with no conditions, and the RBAC plan already re-decided on 2026-08-08 that "seller-panel endpoints scope-fetch through `current_seller` exactly as admin endpoints scope through `current_store`". Reusing the ~300 admin endpoints would mean per-principal forks in every `scope`/`find_resource`/incidental lookup (`stock_location_id`, `reason_id`, `variant_id` on line-item writes) — each miss a cross-seller read or write inside the same store — plus per-principal field masking in serializers. A seller branch is ~20 controllers, each written scope-first (`current_seller.products`, `current_seller.orders`, …): **IDOR by construction**, the same way store isolation works on the admin branch today (controller scoping only — the ability layer has no tenancy conditions). What a seller may not do (publish to channels, edit orders, refund, approve itself, create stock locations) is an endpoint that does not exist, not an ability rule. Do **not** subclass admin controllers into the seller namespace — inherited `current_store.*` lookups are precisely the leak; share workflows and permitted-param lists, never controllers.
-**Isolation is enforced at the token layer, not only at membership.** Three requirements, all mandatory (they answer the two concrete objections to a shared model — "staff must be SSO-only while vendors use passwords" and "what happens when a vendor token hits the Admin API"):
+**Isolation is enforced at the token layer, not only at membership.** Three requirements, all mandatory (they answer the two concrete objections to a shared model — "staff must be SSO-only while sellers use passwords" and "what happens when a seller token hits the Admin API"):
-1. **Own JWT audience** — `JWT_AUDIENCE_VENDOR = 'vendor_api'` beside `store_api`/`admin_api`. The admin branch rejects a vendor token at `decode_jwt` (`verify_aud`) with 401 before any store resolution, membership check, or ability is built, and the vendor branch rejects admin tokens symmetrically. Fail-closed at the outermost layer; the `resource_type` filters below remain defense in depth.
-2. **Own login surface** — `Spree.vendor_authentication_strategies` (default: `:email` only) + `/api/v3/vendor/auth/{login,refresh,logout,password_reset}`. Login policy is per surface, not per class: an SSO-only store keeps `Spree.admin_authentication_strategies.remove(:email)` while vendors sign in with passwords, against the same `AdminUser` table. The vendor login **refuses anyone with no vendor membership** (`role_users` on `resource: vendor`), the same "unprovisioned subject is rejected" rule the admin SSO callback applies — so a staff-only account cannot mint a token here, and a token it *could* mint carries the vendor audience anyway.
-3. **Refresh tokens carry the audience** — `spree_refresh_tokens.audience` (string), written at mint and enforced on refresh, with a separate cookie name/path for the vendor panel. Today's `RefreshToken` has no audience, so without this a vendor-minted refresh token could be presented to the admin refresh endpoint and exchanged for an `admin_api` JWT.
+1. **Own JWT audience** — `JWT_AUDIENCE_VENDOR = 'seller_api'` beside `store_api`/`admin_api`. The admin branch rejects a seller token at `decode_jwt` (`verify_aud`) with 401 before any store resolution, membership check, or ability is built, and the seller branch rejects admin tokens symmetrically. Fail-closed at the outermost layer; the `resource_type` filters below remain defense in depth.
+2. **Own login surface** — `Spree.seller_authentication_strategies` (default: `:email` only) + `/api/v3/seller/auth/{login,refresh,logout,password_reset}`. Login policy is per surface, not per class: an SSO-only store keeps `Spree.admin_authentication_strategies.remove(:email)` while sellers sign in with passwords, against the same `AdminUser` table. The seller login **refuses anyone with no seller membership** (`role_users` on `resource: seller`), the same "unprovisioned subject is rejected" rule the admin SSO callback applies — so a staff-only account cannot mint a token here, and a token it *could* mint carries the seller audience anyway.
+3. **Refresh tokens carry the audience** — `spree_refresh_tokens.audience` (string), written at mint and enforced on refresh, with a separate cookie name/path for the seller panel. Today's `RefreshToken` has no audience, so without this a seller-minted refresh token could be presented to the admin refresh endpoint and exchanged for an `admin_api` JWT.
-**Accepted trade-offs:** password policy and lockout stay model-level and therefore shared between staff and vendors (desired — a vendor account locks out too; a stricter *staff-only* policy is a per-surface login concern, like MFA later). Thin controllers are duplicated across the admin and vendor branches; that duplication is the price of an auditable tenancy boundary.
+**Accepted trade-offs:** password policy and lockout stay model-level and therefore shared between staff and sellers (desired — a seller account locks out too; a stricter *staff-only* policy is a per-surface login concern, like MFA later). Thin controllers are duplicated across the admin and seller branches; that duplication is the price of an auditable tenancy boundary.
-**Cross-plan obligation (admin branch, ship ahead of Phase 1):** `AdminAuthentication#current_user_member_of_store?` matches `role_users.exists?(store: current_store)`, which a vendor-resourced assignment passes (its store is the vendor's store) — the Ability then yields no keys so scoped endpoints 403, but the scope-exempt ones (`/admin/tags`, `/admin/store` show, exports/imports index, translation batches) are reachable. Tighten to `resource_type: 'Spree::Store'`, mirroring `Ability#staff_roles` and `RoleGrantGuard`, with a regression spec.
+**Cross-plan obligation (admin branch, ship ahead of Phase 1):** `AdminAuthentication#current_user_member_of_store?` matches `role_users.exists?(store: current_store)`, which a seller-resourced assignment passes (its store is the seller's store) — the Ability then yields no keys so scoped endpoints 403, but the scope-exempt ones (`/admin/tags`, `/admin/store` show, exports/imports index, translation batches) are reachable. Tighten to `resource_type: 'Spree::Store'`, mirroring `Ability#staff_roles` and `RoleGrantGuard`, with a regression spec.
### 11. Several sellers may sell the same item: the seller lives on the **variant**, not on a separate offer record (RESOLVED 2026-08-16)
-Until now this plan assumed one product belongs to one seller (`products.vendor_id`), so two sellers of the same physical item produced two unrelated products and two storefront listings. That is the right shape for unique goods and the wrong one for commodities — the same book, phone or part sold by several sellers. **Supporting both is the single most requested capability the legacy module could not deliver**, so 6.0 must get the grain right; retrofitting it after the split and commission engine are built on one-owner assumptions is the expensive path.
+Until now this plan assumed one product belongs to one seller (`products.seller_id`), so two sellers of the same physical item produced two unrelated products and two storefront listings. That is the right shape for unique goods and the wrong one for commodities — the same book, phone or part sold by several sellers. **Supporting both is the single most requested capability the legacy module could not deliver**, so 6.0 must get the grain right; retrofitting it after the split and commission engine are built on one-owner assumptions is the expensive path.
-**The seller is an attribute of the variant.** `spree_variants.vendor_id` (nullable — `nil` is the operator's own first-party listing) alongside the existing `spree_products.vendor_id`. One product may therefore hold variants from several sellers: a new unit from the marketplace's own warehouse and a refurbished one from a seller, on one product page. **Condition (new / used / refurbished) is an `OptionType`,** so it splits the variant like any other axis and inherits the option machinery already there — presentation kinds, positions, storefront pickers and facets.
+**The seller is an attribute of the variant.** `spree_variants.seller_id` (nullable — `nil` is the operator's own first-party listing) alongside the existing `spree_products.seller_id`. One product may therefore hold variants from several sellers: a new unit from the marketplace's own warehouse and a refurbished one from a seller, on one product page. **Condition (new / used / refurbished) is an `OptionType`,** so it splits the variant like any other axis and inherits the option machinery already there — presentation kinds, positions, storefront pickers and facets.
-**Why not a separate `Offer` record.** The surveyed implementations that model this all introduce one, but they share a constraint Spree does not have: each is built *on top of* a commerce engine or a merchant's existing catalog, so they cannot put a seller on the variant and cannot re-key inventory. Their offer row is a variant they were not allowed to write. Spree owns the variant, and an offer would duplicate almost all of it — seller, sku, price, stock, condition, delivery config. Modelling it separately would mean a second pricing pipeline, a stock anchor migration (`spree_stock_items` is uniquely keyed on `(variant, stock_location)`), a new `line_items.offer_id` with the cart's variant-keyed deduplication reworked around it, and offer-relative rewrites of ~67 purchasability call sites. On the variant, all of that is already true by construction: two sellers are two variant rows, so two stock rows, prices resolve unchanged, and `line_item.variant.vendor_id` gives per-line seller attribution — which is precisely what the split in Decision 1 partitions on.
+**Why not a separate `Offer` record.** The surveyed implementations that model this all introduce one, but they share a constraint Spree does not have: each is built *on top of* a commerce engine or a merchant's existing catalog, so they cannot put a seller on the variant and cannot re-key inventory. Their offer row is a variant they were not allowed to write. Spree owns the variant, and an offer would duplicate almost all of it — seller, sku, price, stock, condition, delivery config. Modelling it separately would mean a second pricing pipeline, a stock anchor migration (`spree_stock_items` is uniquely keyed on `(variant, stock_location)`), a new `line_items.offer_id` with the cart's variant-keyed deduplication reworked around it, and offer-relative rewrites of ~67 purchasability call sites. On the variant, all of that is already true by construction: two sellers are two variant rows, so two stock rows, prices resolve unchanged, and `line_item.variant.seller_id` gives per-line seller attribution — which is precisely what the split in Decision 1 partitions on.
*"Offer" remains the right word for the storefront* ("3 offers from 2 sellers"). Presentation vocabulary need not be a table.
@@ -214,20 +216,20 @@ Until now this plan assumed one product belongs to one seller (`products.vendor_
- **Option filtering must match within one variant.** `with_option_value_ids` issues a separate subquery per option type against `product_id`, so "Blue AND XL" matches a product with a Blue variant and a *different* XL variant. This is a pre-existing storefront bug that sharing a product across sellers makes worse; the fix is to require one variant to satisfy every value.
- **Search documents are per-product** with a single scalar price and a single boolean stock. They describe the buy-box winner, and a seller's write must not silently rewrite a rival's listing facts.
-**Operators see everything; sellers see their own.** Marketplace staff manage every variant on a product, including other sellers' — they run the marketplace. Seller isolation is the `/api/v3/vendor` branch scope-fetching through `current_vendor` (Decision 10), not a narrowing of the admin surface.
+**Operators see everything; sellers see their own.** Marketplace staff manage every variant on a product, including other sellers' — they run the marketplace. Seller isolation is the `/api/v3/seller` branch scope-fetching through `current_seller` (Decision 10), not a narrowing of the admin surface.
-**Both shapes coexist with no mode switch.** A store selling only its own goods has `vendor_id: nil` everywhere and notices none of this. Unique goods keep one seller per product. A commodity gets sibling variants from several sellers. Promoting an exclusive listing to a shared one is a data change, not a migration. What this deliberately does **not** solve in 6.0 is *catalog matching* — deciding that two sellers' submissions are the same item. Every surveyed platform treats that as hard and several sell it separately; core should ship exact matching on a typed identifier (the identifier's namespace stored explicitly, never inferred from its shape) and leave fuzzy matching to an extension.
+**Both shapes coexist with no mode switch.** A store selling only its own goods has `seller_id: nil` everywhere and notices none of this. Unique goods keep one seller per product. A commodity gets sibling variants from several sellers. Promoting an exclusive listing to a shared one is a data change, not a migration. What this deliberately does **not** solve in 6.0 is *catalog matching* — deciding that two sellers' submissions are the same item. Every surveyed platform treats that as hard and several sell it separately; core should ship exact matching on a typed identifier (the identifier's namespace stored explicitly, never inferred from its shape) and leave fuzzy matching to an extension.
-**Supersedes:** the "SKU uniqueness relaxes to per-vendor scope" line under Product ownership & approval, which assumed duplicate product rows per seller.
+**Supersedes:** the "SKU uniqueness relaxes to per-seller scope" line under Product ownership & approval, which assumed duplicate product rows per seller.
## Design Details
-### Vendor identity & teams
+### Seller identity & teams
-The headline model. Ports the Enterprise module's `Spree::Vendor` (keeping prefix `ven_` for Enterprise data continuity) and adopts the lifecycle already shipped in the Enterprise admin (user docs: Invited → Onboarding → Ready for Review → Approved / Rejected / Suspended). **The external-store subsystem is not ported — none of it, ever**: the external store/product/order/category resource family, the per-platform Shopify/WooCommerce connections and sync workers, the category mapper, and the vendor-side hooks that reach into them (external-store shipping-method pulls, external-store-derived settings) all remain Enterprise. Core's `Vendor` carries no external-store associations, columns, or callbacks — the Enterprise module layers its connection models onto core's Vendor from the outside:
+The headline model. Ports the Enterprise module's seller model — renamed to `Spree::Seller` with prefix `sel_` (2026-08-17), so the Enterprise backfill re-stamps ids rather than carrying `ven_` over — and adopts the lifecycle already shipped in the Enterprise admin (user docs: Invited → Onboarding → Ready for Review → Approved / Rejected / Suspended). **The external-store subsystem is not ported — none of it, ever**: the external store/product/order/category resource family, the per-platform Shopify/WooCommerce connections and sync workers, the category mapper, and the seller-side hooks that reach into them (external-store shipping-method pulls, external-store-derived settings) all remain Enterprise. Core's `Seller` carries no external-store associations, columns, or callbacks — the Enterprise module layers its connection models onto core's Seller from the outside:
```ruby
-class Spree::Vendor < Spree.base_class
+class Spree::Seller < Spree.base_class
has_prefix_id :ven
include Spree::SingleStoreResource
include Spree::UserManagement # roles, role_users, users, invitations — the team
@@ -243,40 +245,40 @@ class Spree::Vendor < Spree.base_class
has_many :products, class_name: 'Spree::Product', dependent: :nullify
has_many :stock_locations, class_name: 'Spree::StockLocation', dependent: :nullify
- has_many :orders, class_name: 'Spree::Order' # child (vendor) orders
+ has_many :orders, class_name: 'Spree::Order' # child (seller) orders
has_many :commission_lines, class_name: 'Spree::CommissionLine'
- has_many :vendor_transfers, class_name: 'Spree::VendorTransfer'
- has_many :vendor_payouts, class_name: 'Spree::VendorPayout'
+ has_many :seller_transfers, class_name: 'Spree::SellerTransfer'
+ has_many :seller_payouts, class_name: 'Spree::SellerPayout'
# Teams come from Spree::UserManagement above, not hand-rolled: after the
- # RBAC refactor a RoleUser has no resource of its own, so a vendor's team is
- # whoever holds a role the vendor owns (`roles` → `role_users` → `users`).
+ # RBAC refactor a RoleUser has no resource of its own, so a seller's team is
+ # whoever holds a role the seller owns (`roles` → `role_users` → `users`).
# name, slug (unique per store), contact_email, billing_email
# about : rich text (sanitized HTML column per 6.0-rich-text-descriptions.md)
# NO denormalized sales_total/commission_total counters (legacy has them) — lifetime
- # revenue & commission derive from commission_lines / vendor_transfers (we have a ledger now)
+ # revenue & commission derive from commission_lines / seller_transfers (we have a ledger now)
# NO encrypted name/contact columns (legacy encrypts for its multi-tenant SaaS; core stays plain)
# logo / square_logo / cover_photo : ActiveStorage attachments (storefront-facing branding)
- # terms_accepted_at : datetime — vendor ToS acceptance (store-configured rich-text ToS)
+ # terms_accepted_at : datetime — seller ToS acceptance (store-configured rich-text ToS)
# holiday_mode_until : datetime, nullable — paused storefront presence ("holiday mode")
# payouts_schedule_interval : string, nullable — 'daily'|'weekly'|'biweekly'|'monthly'|'manual';
# nil ⇒ store default (store preference), matching today's
# "Use marketplace default interval" semantics
# minimum_payout_amount : decimal, nullable — sub-threshold balances carry to the next period;
# nil ⇒ store preference default_minimum_payout_amount (RESOLVED 2026-08-15)
- # tax_remittance : string — 'vendor' (default) | 'platform'; selects the transfer basis (Decision 9;
+ # tax_remittance : string — 'seller' (default) | 'platform'; selects the transfer basis (Decision 9;
# RESOLVED 2026-08-15). Enterprise 'automatic taxes' sets it; core only reads it
# Ports the legacy lifecycle (status column renamed from `state` per
# 6.0-normalize-state-to-status.md), but NOT its state machine: approving
# sends mail and provisions payouts, which is exactly the work
# 6.0-service-workflows.md keeps out of save callbacks. Transitions are
- # workflows (Spree::Vendors::Invite, ::Approve, ::Suspend, …); the model
+ # workflows (Spree::Sellers::Invite, ::Approve, ::Suspend, …); the model
# only declares the values.
#
# pending → invited → onboarding → ready_for_review → approved
#
- # `approve` also lifts a suspension and revives a rejected vendor, so the
+ # `approve` also lifts a suspension and revives a rejected seller, so the
# reachable set is wider than that line — which is the permissiveness the
# legacy machine had, now expressed as workflow guards rather than a graph.
include Spree::HasStatus
@@ -290,29 +292,29 @@ class Spree::Vendor < Spree.base_class
end
```
-- **Two entry paths, one lifecycle.** (a) *Invitation*: operator creates a `pending` vendor and invites → `Spree::Invitation` (`resource: vendor`, vendor-role) → acceptance creates the `RoleUser` and fires `start_onboarding`. (b) *Self-serve application* — a public "become a seller" flow: a Store API endpoint creates a `pending` vendor + application; the operator admits into onboarding or rejects. Same state machine, no second flow.
-- **Teams** = `Spree::RoleUser` rows with `resource: vendor` and `user: Spree.admin_user_class`. Vendor admins invite teammates through the same `Invitation` rail the store admin uses. No new membership model.
-- **Authorization** (rewritten 2026-08-15 for the shipped RBAC — Decision 10): vendor users are `Spree.admin_user_class` and sign in through the vendor login surface (own strategy registry, own `vendor_api` JWT audience). Authorization on the Vendor API branch is the same two-axis model the admin branch uses:
- - *Tenancy* is controller scoping — every vendor endpoint scope-fetches through `current_vendor` (resolved from `X-Spree-Vendor-Id` + a `role_users` membership check on `resource: vendor`; `current_store` is **derived** from `current_vendor.store`, never taken from a header). Writes are force-stamped `vendor_id`. Nothing tenancy-related lives in the ability.
- - *Capability* is the permission catalog — the same `read_*`/`write_*` vocabulary, through the same `ScopedAuthorization` key gate. Adopts the RBAC plan's settled direction: `Role#audience` (`staff` | `vendor`); a **vendor-grantable catalog subset** marked at `register_resource` (products, orders, fulfillments, stock, returns, exports/imports, analytics — never `settings`, `staff`, `api_keys`, commissions); the roles editor filters its grid by audience; assignment and invitation guards pair audience with resource type. Vendor roles are defined by the operator (role names are globally unique — vendors assign their people to tiers, they do not define roles). Two vendor-only catalog resources: `vendor_profile` (own profile, branding, addresses, onboarding tasks) and read-only `payouts` (the vendor's ledger view). `Spree::Ability` gains a `resource:` option (default the store) so the vendor branch builds its ability from `role_users` where `resource: current_vendor` — the "vendor-side ability" the RBAC plan deferred here.
- - The legacy `PermissionSets::VendorUser` baseline survives only as the **seeded default vendor role's key set** (`write_products`, `write_orders`, `write_fulfillments`, `write_stock`, `write_returns`, `write_exports`, `write_vendor_profile`, `read_payouts`). "No commission management / no channel publication / no self-approve / no stock-location create" are endpoints that do not exist on the vendor branch, not ability rules. `#13323`'s "manage permissions (via code)" = seeds or the roles API, per the RBAC plan.
- - `Spree::UserRoles` gains `has_many :vendors, through: :role_users, source: :resource, source_type: 'Spree::Vendor'` beside `stores`; the vendor branch's `/me` returns the vendor memberships so a panel can pick its context. `AdminUserMethods#can_be_deleted?` reasons about `Store.current.users` — the vendor branch needs its own "last owner of this vendor" rule.
-- **Onboarding checklist — the registry is core, Enterprise contributes tasks.** Core ships a lightweight task registry (task key + completion check + required flag) and the core tasks: accept ToS, complete profile/branding, billing + returns addresses, at least one delivery method, at least one product. `submit_for_review` requires all required tasks complete (ports the legacy `onboarding_completed?` guard — without a checklist the guard has nothing to check, and vendors can't see what's missing). Extensions **register additional tasks** into the same registry: the monorepo Stripe gateway adds "connect your Stripe account" (Express onboarding); Enterprise adds KYC verification follow-through and Shopify/Woo store connection — the paid value is in *those tasks*, not in the tracker. The vendor dashboard and the operator's onboarding-progress view (the n/m column in today's Enterprise) both render from the registry.
-- **Storefront visibility**: only `approved` vendors (and their products) are exposed; `holiday_mode_until` in the future hides the vendor's products from sale (purchasability gate, not catalog deletion).
+- **Two entry paths, one lifecycle.** (a) *Invitation*: operator creates a `pending` seller and invites → `Spree::Invitation` (`resource: seller`, seller-role) → acceptance creates the `RoleUser` and fires `start_onboarding`. (b) *Self-serve application* — a public "become a seller" flow: a Store API endpoint creates a `pending` seller + application; the operator admits into onboarding or rejects. Same state machine, no second flow.
+- **Teams** = `Spree::RoleUser` rows with `resource: seller` and `user: Spree.admin_user_class`. Seller admins invite teammates through the same `Invitation` rail the store admin uses. No new membership model.
+- **Authorization** (rewritten 2026-08-15 for the shipped RBAC — Decision 10): seller users are `Spree.admin_user_class` and sign in through the seller login surface (own strategy registry, own `seller_api` JWT audience). Authorization on the Seller API branch is the same two-axis model the admin branch uses:
+ - *Tenancy* is controller scoping — every seller endpoint scope-fetches through `current_seller` (resolved from `X-Spree-Seller-Id` + a `role_users` membership check on `resource: seller`; `current_store` is **derived** from `current_seller.store`, never taken from a header). Writes are force-stamped `seller_id`. Nothing tenancy-related lives in the ability.
+ - *Capability* is the permission catalog — the same `read_*`/`write_*` vocabulary, through the same `ScopedAuthorization` key gate. Adopts the RBAC plan's settled direction: `Role#audience` (`staff` | `seller`); a **seller-grantable catalog subset** marked at `register_resource` (products, orders, fulfillments, stock, returns, exports/imports, analytics — never `settings`, `staff`, `api_keys`, commissions); the roles editor filters its grid by audience; assignment and invitation guards pair audience with resource type. Seller roles are defined by the operator (role names are globally unique — sellers assign their people to tiers, they do not define roles). Two seller-only catalog resources: `seller_profile` (own profile, branding, addresses, onboarding tasks) and read-only `payouts` (the seller's ledger view). `Spree::Ability` gains a `resource:` option (default the store) so the seller branch builds its ability from `role_users` where `resource: current_seller` — the "seller-side ability" the RBAC plan deferred here.
+ - The legacy `PermissionSets::SellerUser` baseline survives only as the **seeded default seller role's key set** (`write_products`, `write_orders`, `write_fulfillments`, `write_stock`, `write_returns`, `write_exports`, `write_seller_profile`, `read_payouts`). "No commission management / no channel publication / no self-approve / no stock-location create" are endpoints that do not exist on the seller branch, not ability rules. `#13323`'s "manage permissions (via code)" = seeds or the roles API, per the RBAC plan.
+ - `Spree::UserRoles` gains `has_many :sellers, through: :role_users, source: :resource, source_type: 'Spree::Seller'` beside `stores`; the seller branch's `/me` returns the seller memberships so a panel can pick its context. `AdminUserMethods#can_be_deleted?` reasons about `Store.current.users` — the seller branch needs its own "last owner of this seller" rule.
+- **Onboarding checklist — the registry is core, Enterprise contributes tasks.** Core ships a lightweight task registry (task key + completion check + required flag) and the core tasks: accept ToS, complete profile/branding, billing + returns addresses, at least one delivery method, at least one product. `submit_for_review` requires all required tasks complete (ports the legacy `onboarding_completed?` guard — without a checklist the guard has nothing to check, and sellers can't see what's missing). Extensions **register additional tasks** into the same registry: the monorepo Stripe gateway adds "connect your Stripe account" (Express onboarding); Enterprise adds KYC verification follow-through and Shopify/Woo store connection — the paid value is in *those tasks*, not in the tracker. The seller dashboard and the operator's onboarding-progress view (the n/m column in today's Enterprise) both render from the registry.
+- **Storefront visibility**: only `approved` sellers (and their products) are exposed; `holiday_mode_until` in the future hides the seller's products from sale (purchasability gate, not catalog deletion).
**Columns added to existing tables** (the complete list — everything else in this plan is new tables):
| Table | Column | Why |
|---|---|---|
-| `spree_products` | `vendor_id` (nullable) | listing ownership — a seller's own product; nil on a shared one |
-| `spree_variants` | `vendor_id` (nullable), `delivery_profile_id` (nullable) | which seller sells this variant, and how they ship it (Decision 11) |
-| `spree_stock_locations` | `vendor_id` (nullable) | vendor-owned stock, feeds order routing |
-| `spree_orders` | `vendor_id` (nullable), `order_group_id` (nullable) | child-order identity |
-| `spree_line_items` | `vendor_id` (nullable, denormalized) | split partition + vendor scoping without 3-join hops |
+| `spree_products` | `seller_id` (nullable) | listing ownership — a seller's own product; nil on a shared one |
+| `spree_variants` | `seller_id` (nullable), `delivery_profile_id` (nullable) | which seller sells this variant, and how they ship it (Decision 11) |
+| `spree_stock_locations` | `seller_id` (nullable) | seller-owned stock, feeds order routing |
+| `spree_orders` | `seller_id` (nullable), `order_group_id` (nullable) | child-order identity |
+| `spree_line_items` | `seller_id` (nullable, denormalized) | split partition + seller scoping without 3-join hops |
| `spree_payments` | `order_group_id` (nullable) | the single shared payment (Decision 5) |
-| `spree_delivery_methods` | `vendor_id` (nullable) | optional vendor-scoped delivery options (see Order splitting) |
+| `spree_delivery_methods` | `seller_id` (nullable) | optional seller-scoped delivery options (see Order splitting) |
-Legacy vendor scoping deliberately **not** carried over: `spree_payments.vendor_id` and `spree_shipments.vendor_id` (both derivable — `PaymentSplit`/fulfillment reach the vendor through the child order), and `vendor_id` on reports + webhook subscribers (vendor-scoped reports and vendor-owned webhook subscriptions are post-6.0 dashboard/API work, not v1 schema).
+Legacy seller scoping deliberately **not** carried over: `spree_payments.seller_id` and `spree_shipments.seller_id` (both derivable — `PaymentSplit`/fulfillment reach the seller through the child order), and `seller_id` on reports + webhook subscribers (seller-scoped reports and seller-owned webhook subscriptions are post-6.0 dashboard/API work, not v1 schema).
### Order splitting
@@ -320,25 +322,25 @@ Legacy vendor scoping deliberately **not** carried over: `spree_payments.vendor_
Spree::Cart (one, mixed)
└─ line_items (owner: cart_id set, order_id nil) ← 6.0-cart-order-split.md
- cart.complete! → Spree::Carts::Complete → splits by vendor
+ cart.complete! → Spree::Carts::Complete → splits by seller
│
▼
Spree::OrderGroup (the transaction container — customer, single payment, shared addresses)
- ├─ Spree::Order (vendor A) belongs_to :order_group, belongs_to :vendor
- │ ├─ line_items (owner = this order) — vendor A's items
- │ ├─ fulfillments — vendor A's fulfillment (Shipment pre-rename)
+ ├─ Spree::Order (seller A) belongs_to :order_group, belongs_to :seller
+ │ ├─ line_items (owner = this order) — seller A's items
+ │ ├─ fulfillments — seller A's fulfillment (Shipment pre-rename)
│ ├─ commission_lines — frozen at split
- │ ├─ vendor_transfer — vendor A's earning, on-fulfillment (level-1 ledger)
- │ └─ payment_split — vendor A's share of the single payment
- ├─ Spree::Order (vendor B) …
+ │ ├─ seller_transfer — seller A's earning, on-fulfillment (level-1 ledger)
+ │ └─ payment_split — seller A's share of the single payment
+ ├─ Spree::Order (seller B) …
└─ …
```
-The `OrderGroup` owns the customer + single payment + shared addresses; each child `Order` owns its own line items, fulfillments, and totals. The group carries no vendor reference — `vendor` lives on the child order (Decision 8). Vocabulary follows `6.0-fulfillment-and-delivery.md` throughout: Fulfillment (né Shipment), DeliveryMethod (né ShippingMethod), and the ledger trigger is **on-fulfillment** — which also covers digital/instant fulfillment types (a digital vendor order fulfills, and therefore earns, immediately after payment).
+The `OrderGroup` owns the customer + single payment + shared addresses; each child `Order` owns its own line items, fulfillments, and totals. The group carries no seller reference — `seller` lives on the child order (Decision 8). Vocabulary follows `6.0-fulfillment-and-delivery.md` throughout: Fulfillment (né Shipment), DeliveryMethod (né ShippingMethod), and the ledger trigger is **on-fulfillment** — which also covers digital/instant fulfillment types (a digital seller order fulfills, and therefore earns, immediately after payment).
-- **Trigger & gate:** explicit call inside `Spree::Carts::Complete`, after payment authorization. The gate is **more than one fulfillment partition** — line items partition by the `vendor_id` snapshot, with `nil` (the operator's own first-party items) forming its own partition, and the split + `OrderGroup` happen **only when ≥ 2 partitions exist**. A mixed cart of vendor A + first-party items splits into two child orders (one with `vendor_id: nil`). A single-partition cart — all first-party, or all one vendor — completes as a **bare order exactly as today**: no group, no `PaymentSplit`; when that partition is a vendor's, the order still carries `vendor_id` and commission + ledger apply unchanged (Phase 2's compute-only mode is exactly this). Not a state-machine callback — and not the legacy shape either: the legacy module splits **~30 seconds after checkout** in a background job, leaving a window where the parent order exists un-split. 6.0 splits synchronously inside completion, so the checkout response already returns the finished `OrderGroup` and no `splitted`-pending state ever exists.
-- **Partition key:** `line_item.vendor_id`, denormalized from `variant.vendor` — the variant the customer actually chose, falling back to `variant.product.vendor` for a product whose seller owns the whole listing (Decision 11). Denormalization is load-bearing, not an optimization: the split, vendor ability scoping, and vendor order lists all key on it, and on a shared product the *product* cannot answer which seller was bought from. Because ownership *can* change while an item sits in a cart, `Carts::Complete` revalidates each line's `vendor_id` before partitioning and refreshes stale lines (re-running package/delivery validation) — the same cart-revalidation class as price or availability drift.
-- **Per-vendor delivery selection happens at checkout, before the split.** Today's Enterprise checkout already groups packages by vendor and lets the customer pick a delivery method per vendor package (user docs: multi-vendor-checkout); 6.0 keeps that UX. The cart's packages come from `6.0-order-routing.md` (`for_allocation` — vendor items allocate from that vendor's stock location), delivery options per package come from `6.0-delivery-rate-provider.md` filtered to the package's vendor: a `DeliveryMethod` with `vendor_id` is offered only on that vendor's packages; `vendor_id: nil` methods are marketplace-wide. The chosen method + rate travel with the package into that vendor's child order at split. **This is a hard requirement on the cart/order-split checkout design** (see Constraints).
+- **Trigger & gate:** explicit call inside `Spree::Carts::Complete`, after payment authorization. The gate is **more than one fulfillment partition** — line items partition by the `seller_id` snapshot, with `nil` (the operator's own first-party items) forming its own partition, and the split + `OrderGroup` happen **only when ≥ 2 partitions exist**. A mixed cart of seller A + first-party items splits into two child orders (one with `seller_id: nil`). A single-partition cart — all first-party, or all one seller — completes as a **bare order exactly as today**: no group, no `PaymentSplit`; when that partition is a seller's, the order still carries `seller_id` and commission + ledger apply unchanged (Phase 2's compute-only mode is exactly this). Not a state-machine callback — and not the legacy shape either: the legacy module splits **~30 seconds after checkout** in a background job, leaving a window where the parent order exists un-split. 6.0 splits synchronously inside completion, so the checkout response already returns the finished `OrderGroup` and no `splitted`-pending state ever exists.
+- **Partition key:** `line_item.seller_id`, denormalized from `variant.seller` — the variant the customer actually chose, falling back to `variant.product.seller` for a product whose seller owns the whole listing (Decision 11). Denormalization is load-bearing, not an optimization: the split, seller ability scoping, and seller order lists all key on it, and on a shared product the *product* cannot answer which seller was bought from. Because ownership *can* change while an item sits in a cart, `Carts::Complete` revalidates each line's `seller_id` before partitioning and refreshes stale lines (re-running package/delivery validation) — the same cart-revalidation class as price or availability drift.
+- **Per-seller delivery selection happens at checkout, before the split.** Today's Enterprise checkout already groups packages by seller and lets the customer pick a delivery method per seller package (user docs: multi-vendor-checkout); 6.0 keeps that UX. The cart's packages come from `6.0-order-routing.md` (`for_allocation` — seller items allocate from that seller's stock location), delivery options per package come from `6.0-delivery-rate-provider.md` filtered to the package's seller: a `DeliveryMethod` with `seller_id` is offered only on that seller's packages; `seller_id: nil` methods are marketplace-wide. The chosen method + rate travel with the package into that seller's child order at split. **This is a hard requirement on the cart/order-split checkout design** (see Constraints).
- **Move semantics:** line items, their tax lines / discounts / fees (`6.0-6.1-split-adjustments.md`), fulfillment items, and fulfillments are assigned to the correct child `Order` (created from the cart partition); the owner FK on every typed line is rewritten to the child order. **Order-level `Fee` rows** (both adjustable FKs nil — e.g. a payment surcharge; allowed per split-adjustments 2026-07-27) prorate across child orders by item totals using the same largest-remainder rule as order-level discount distribution, their tax lines following the fee. Stock location per child comes from the routing strategy, not a bare `detect`.
- **Group status:** derived, not a column. The `OrderGroup` is "fully fulfilled" when all its orders are, "partially canceled" when some are, etc. — computed across `order_group.orders`, replacing the legacy `all_shipments`/`splitted?`/`cancel_parent_order` workarounds (which existed only because the legacy parent was itself an `Order`).
@@ -371,7 +373,7 @@ class Spree::OrderGroup < Spree.base_class
end
```
-The child `Order` gains `belongs_to :order_group` (optional — a plain single-vendor / single-fulfillment order has no group) and `belongs_to :vendor` (optional — non-marketplace orders have no vendor). No `parent_id`, no `splitted` status.
+The child `Order` gains `belongs_to :order_group` (optional — a plain single-seller / single-fulfillment order has no group) and `belongs_to :seller` (optional — non-marketplace orders have no seller). No `parent_id`, no `splitted` status.
### Split payment record (Decision 5)
@@ -381,7 +383,7 @@ class Spree::PaymentSplit < Spree.base_class
has_prefix_id :paysp
belongs_to :payment, class_name: 'Spree::Payment' # the group's single gateway payment
- belongs_to :order, class_name: 'Spree::Order' # the child (vendor) order
+ belongs_to :order, class_name: 'Spree::Order' # the child (seller) order
# authorized_amount / captured_amount / refunded_amount : decimal
# currency : string
@@ -404,7 +406,7 @@ class Spree::CommissionLine < Spree.base_class
belongs_to :order, class_name: 'Spree::Order'
belongs_to :line_item, class_name: 'Spree::LineItem', optional: true # the commissioned item…
belongs_to :fulfillment, class_name: 'Spree::Fulfillment', optional: true # …or the commissioned delivery (include_shipping)
- belongs_to :vendor, class_name: 'Spree::Vendor'
+ belongs_to :seller, class_name: 'Spree::Seller'
belongs_to :commission_rate, class_name: 'Spree::CommissionRate', optional: true # nullable: rule may be deleted later
# exactly one of line_item / fulfillment is set (same pattern as TaxLine's adjustable),
@@ -414,7 +416,7 @@ class Spree::CommissionLine < Spree.base_class
# snapshot fields (frozen — never recomputed)
# rate : decimal — the % or flat value applied, as resolved at sale time
# kind : string — 'percentage' | 'fixed'
- # amount : decimal — commission charged to the vendor (the platform's fee)
+ # amount : decimal — commission charged to the seller (the platform's fee)
# tax_amount : decimal — VAT/tax ON the commission (EU) — Decision 3
# total : decimal — amount + tax_amount
# currency : string
@@ -440,7 +442,7 @@ class Spree::CommissionRate < Spree.base_class
# tax_inclusive : bool — commission base is the item's gross vs net price
# (EU default: net — Decision 3). Named to match
# Market#tax_inclusive, not the industry's include_tax.
- # include_shipping : bool — also commission the vendor order's delivery amounts
+ # include_shipping : bool — also commission the seller order's delivery amounts
# (Decision 4); percentage rates only
# commission tax: resolved via 6.0-tax-provider, not a flat column (Decision 3)
#
@@ -476,12 +478,12 @@ class Spree::CommissionRule < Spree.base_class
def applicable?(context); end # Spree::Commissions::Context
end
-# Core kinds: VendorRule, CategoryRule (matches descendants), ProductRule
+# Core kinds: SellerRule, CategoryRule (matches descendants), ProductRule
# (join table — catalog scale), ItemTotalRule (a value band, the kind that
# could not exist while a rule could only name a record).
```
-**Resolution** (`Spree::Commissions::ResolveRate` service): load enabled `CommissionRate`s for the store in list order (`position ASC`) — the currency gate applies **only to `fixed` rates** (a flat fee must state an amount in the order's currency; a `percentage` is a ratio and always passes, its floor and cap simply not applying outside the currencies they were written in) — and return the first whose rules match the line item: rules grouped by `subject_type`, every present group needs ≥1 match (Decision 4). A rate with no rules is the global default (`CommissionRate#global?`) — and because resolution stops at the first match, one placed above a targeted rate makes it unreachable, which is why the seeded default sits at the bottom and the admin surfaces the flag. `Spree::Seeds::CommissionRates` seeds exactly one such rate, **disabled and at zero**: a marketplace that has not set its terms should charge nothing rather than a number core invented. This also untangles the three legacy meanings of `platform_fee` (store preference / vendor column / product override) into one model.
+**Resolution** (`Spree::Commissions::ResolveRate` service): load enabled `CommissionRate`s for the store in list order (`position ASC`) — the currency gate applies **only to `fixed` rates** (a flat fee must state an amount in the order's currency; a `percentage` is a ratio and always passes, its floor and cap simply not applying outside the currencies they were written in) — and return the first whose rules match the line item: rules grouped by `subject_type`, every present group needs ≥1 match (Decision 4). A rate with no rules is the global default (`CommissionRate#global?`) — and because resolution stops at the first match, one placed above a targeted rate makes it unreachable, which is why the seeded default sits at the bottom and the admin surfaces the flag. `Spree::Seeds::CommissionRates` seeds exactly one such rate, **disabled and at zero**: a marketplace that has not set its terms should charge nothing rather than a number core invented. This also untangles the three legacy meanings of `platform_fee` (store preference / seller column / product override) into one model.
**Calculation** (`Spree::Commissions::CalculateLine` service) — ports the legacy per-item fee calculation, generalized:
@@ -497,30 +499,30 @@ tax_amount = amount * commission_tax_rate / 100 # Decision
total = amount + tax_amount
```
-The base is **payment-source-agnostic**: store credit / gift cards are how the customer *paid*, not a price component — they never reduce the commission base (consistent with the resolved transfer-basis decision; the legacy implementation subtracted a store-credit share from the base, and that behavior is deliberately dropped). "Net" here means *net of VAT*; discounts are always subtracted first in both bases (the vendor's commission is charged on what the customer actually paid for the item — promotions are vendor-funded in v1, see Open Questions).
+The base is **payment-source-agnostic**: store credit / gift cards are how the customer *paid*, not a price component — they never reduce the commission base (consistent with the resolved transfer-basis decision; the legacy implementation subtracted a store-credit share from the base, and that behavior is deliberately dropped). "Net" here means *net of VAT*; discounts are always subtracted first in both bases (the seller's commission is charged on what the customer actually paid for the item — promotions are seller-funded in v1, see Open Questions).
-**Commission tax rate source (the contract `CalculateLine` consumes):** precedence is (1) an explicit `commission_tax_rate` override on the `CommissionRate`, else (2) the store's `TaxProvider` asked for the platform-service rate against the **vendor's billing address** (commission is a B2B supply to the vendor — not the consumer's ship address), else (3) a store-preference default, else 0. Missing/erroring provider lookups fall through to (3) — commission lines are written inside the split transaction and must never block checkout on a tax-service outage.
+**Commission tax rate source (the contract `CalculateLine` consumes):** precedence is (1) an explicit `commission_tax_rate` override on the `CommissionRate`, else (2) the store's `TaxProvider` asked for the platform-service rate against the **seller's billing address** (commission is a B2B supply to the seller — not the consumer's ship address), else (3) a store-preference default, else 0. Missing/erroring provider lookups fall through to (3) — commission lines are written inside the split transaction and must never block checkout on a tax-service outage.
**Rounding:** every persisted money field rounds **half-up to the currency's minor unit** (2 dp for most currencies, using the currency exponent — matching legacy behavior): `per_unit` after the percentage step, `amount` after quantity × clamp, `tax_amount` after the tax step; `total` is the sum of the two rounded parts, so `Σ CommissionLine` amounts always reconcile with balances and payouts to the cent.
-Persist one `CommissionLine` per line item on the child order, inside the split transaction. When the resolved rate has `include_shipping`, run the same calculation against the vendor order's delivery amount and persist a fulfillment-scoped `CommissionLine` alongside.
+Persist one `CommissionLine` per line item on the child order, inside the split transaction. When the resolved rate has `include_shipping`, run the same calculation against the seller order's delivery amount and persist a fulfillment-scoped `CommissionLine` alongside.
### Fund ledger — two levels (Decision 9)
```ruby
-# Level 1 — PER-ORDER, on-fulfillment. Credits the vendor's balance with what they earned.
+# Level 1 — PER-ORDER, on-fulfillment. Credits the seller's balance with what they earned.
# CORE; provider-agnostic. The `system` provider records only; StripeConnect executes.
-class Spree::VendorTransfer < Spree.base_class
+class Spree::SellerTransfer < Spree.base_class
has_prefix_id :vtr
include Spree::RansackableAttributes
- belongs_to :vendor, class_name: 'Spree::Vendor'
- belongs_to :order, class_name: 'Spree::Order' # the child (vendor) order
- belongs_to :payout, class_name: 'Spree::VendorPayout', optional: true # nil until settled (Decision 9 link)
- belongs_to :reversed_from, class_name: 'Spree::VendorTransfer', optional: true
- has_many :reversals, class_name: 'Spree::VendorTransfer', foreign_key: :reversed_from_id
+ belongs_to :seller, class_name: 'Spree::Seller'
+ belongs_to :order, class_name: 'Spree::Order' # the child (seller) order
+ belongs_to :payout, class_name: 'Spree::SellerPayout', optional: true # nil until settled (Decision 9 link)
+ belongs_to :reversed_from, class_name: 'Spree::SellerTransfer', optional: true
+ has_many :reversals, class_name: 'Spree::SellerTransfer', foreign_key: :reversed_from_id
- # amount : decimal — vendor_order.total − commission_lines.sum(:total) (payment-source-agnostic)
+ # amount : decimal — seller_order.total − commission_lines.sum(:total) (payment-source-agnostic)
# currency : string
# kind : string — 'earning' | 'refund_reversal'
# provider : string — 'system' | 'stripe_connect'
@@ -544,15 +546,15 @@ end
```
```ruby
-# Level 2 — PER-INTERVAL, scheduled. Batches the vendor's unsettled transfers into one
+# Level 2 — PER-INTERVAL, scheduled. Batches the seller's unsettled transfers into one
# bank settlement and debits the balance. CORE; the `system` provider records the
# settlement, StripeConnect performs it.
-class Spree::VendorPayout < Spree.base_class
+class Spree::SellerPayout < Spree.base_class
has_prefix_id :vpo
include Spree::RansackableAttributes
- belongs_to :vendor, class_name: 'Spree::Vendor'
- has_many :transfers, class_name: 'Spree::VendorTransfer' # the transfers this payout settles
+ belongs_to :seller, class_name: 'Spree::Seller'
+ has_many :transfers, class_name: 'Spree::SellerTransfer' # the transfers this payout settles
# amount : decimal — SUM(transfers.amount); set when the payout is assembled
# currency : string
@@ -574,14 +576,14 @@ class Spree::VendorPayout < Spree.base_class
end
```
-`Spree::Vendor` exposes the derived bridge:
+`Spree::Seller` exposes the derived bridge:
```ruby
-# vendor.rb — per currency; every ledger row carries `currency`, so a multi-currency
-# store accrues separate balances and the payout sweep runs per (vendor, currency).
-def balance(currency) # what we still owe the vendor in that currency
- vendor_transfers.completed.where(currency: currency).sum(:amount) -
- vendor_payouts.completed.where(currency: currency).sum(:amount)
+# seller.rb — per currency; every ledger row carries `currency`, so a multi-currency
+# store accrues separate balances and the payout sweep runs per (seller, currency).
+def balance(currency) # what we still owe the seller in that currency
+ seller_transfers.completed.where(currency: currency).sum(:amount) -
+ seller_payouts.completed.where(currency: currency).sum(:amount)
end
```
@@ -590,16 +592,16 @@ end
# with the monorepo Stripe gateway (2026-07-15 amendment); Enterprise extends it.
# Mirrors 6.0-tax-provider.md / 6.0-delivery-rate-provider.md. Two verbs, one per level.
class Spree::PayoutProvider::Base
- def transfer!(vendor_transfer); raise NotImplementedError; end # on-fulfillment (level 1)
- def pay!(vendor_payout); raise NotImplementedError; end # on-interval (level 2)
- def reverse!(vendor_transfer); raise NotImplementedError; end # refund → reverse transfer
+ def transfer!(seller_transfer); raise NotImplementedError; end # on-fulfillment (level 1)
+ def pay!(seller_payout); raise NotImplementedError; end # on-interval (level 2)
+ def reverse!(seller_transfer); raise NotImplementedError; end # refund → reverse transfer
end
# CORE default — records both ledgers, moves no money (manual/offline settlement).
class Spree::PayoutProvider::System < Spree::PayoutProvider::Base
- def transfer!(vendor_transfer) = vendor_transfer.complete! # earned → credits balance
- def pay!(vendor_payout) = vendor_payout # no-op; admin marks complete manually
- def reverse!(vendor_transfer) = vendor_transfer
+ def transfer!(seller_transfer) = seller_transfer.complete! # earned → credits balance
+ def pay!(seller_payout) = seller_payout # no-op; admin marks complete manually
+ def reverse!(seller_transfer) = seller_transfer
end
# OSS — ships with the monorepo Stripe gateway (pulled in from the standalone
@@ -607,7 +609,7 @@ end
# Spree::PayoutProvider::StripeConnect — Express-account onboarding link + account
# status webhook; transfer! → Stripe::Transfer with source_transaction on fulfillment
# (ports the legacy transfer creation); pay! → Stripe's native connected-account
-# payout schedule (ports the legacy schedule mapping) + VendorPayout rows from payout
+# payout schedule (ports the legacy schedule mapping) + SellerPayout rows from payout
# webhooks; reverse! → ledger-only (records the reversal, moves no money back).
#
# ENTERPRISE — extends the OSS provider with the money OPERATIONS (not in this repo):
@@ -617,86 +619,86 @@ end
# Spree::Integration record, same convention as external tax providers.
```
-**Settlement sweep (level 2):** the scheduled job runs **per `(vendor, currency)` pair** on the vendor's `payouts_schedule_interval`: it collects that pair's unsettled transfers, creates one `VendorPayout` with `amount = Σ`, stamps each transfer's `payout_id`, and invokes `provider.pay!`. `system` leaves it `pending` for manual completion; `stripe_connect` settles and a webhook completes it.
+**Settlement sweep (level 2):** the scheduled job runs **per `(seller, currency)` pair** on the seller's `payouts_schedule_interval`: it collects that pair's unsettled transfers, creates one `SellerPayout` with `amount = Σ`, stamps each transfer's `payout_id`, and invokes `provider.pay!`. `system` leaves it `pending` for manual completion; `stripe_connect` settles and a webhook completes it.
**Claim & idempotency contract:** creating the payout and stamping its transfers' `payout_id` happen in **one transaction — that stamp is the claim**; a re-run sweep only ever sees `payout_id IS NULL` transfers, so a batch can never be swept twice. `provider.pay!` must be idempotent, keyed on the payout's prefixed ID (Stripe idempotency key), so a crashed/retried invocation cannot double-pay. Failure paths: `pay!` raising → `payout.fail!` with its transfers **still stamped** — retry means re-invoking `pay!` on the *same* payout (never re-sweeping into a new one); a payout stuck in `processing` past a timeout is surfaced in the operator payouts queue for manual resolution (webhook lost vs. provider-side failure), never auto-recreated.
-**The same contract applies to level 1.** One `earning` transfer per vendor order — enforced by a partial unique index on `(order_id) WHERE kind = 'earning'` — so a re-fired fulfillment event finds the existing row instead of double-crediting. `provider.transfer!` is idempotent keyed on the transfer's prefixed ID, and the provider `reference` (Stripe transfer id) is unique when present: if `transfer!` succeeded externally but the record never reached `completed` (crash between API call and commit), the retry's idempotency key returns the same external transfer and the recovery path re-syncs `reference` + status rather than creating a second money movement. Ambiguous/timed-out attempts park the record in `processing` for the operator queue, same as payouts.
+**The same contract applies to level 1.** One `earning` transfer per seller order — enforced by a partial unique index on `(order_id) WHERE kind = 'earning'` — so a re-fired fulfillment event finds the existing row instead of double-crediting. `provider.transfer!` is idempotent keyed on the transfer's prefixed ID, and the provider `reference` (Stripe transfer id) is unique when present: if `transfer!` succeeded externally but the record never reached `completed` (crash between API call and commit), the retry's idempotency key returns the same external transfer and the recovery path re-syncs `reference` + status rather than creating a second money movement. Ambiguous/timed-out attempts park the record in `processing` for the operator queue, same as payouts.
-**OSS settlement statements come free.** The ledger is exportable through the standard `Spree::Export` pipeline — a per-vendor CSV of transfers/payouts (sales − commission − commission VAT = net, plus reversals) is just an export of these tables, replacing the legacy `Spree::Reports::VendorsPayout` report. What stays Enterprise under "payout reports" is provider *reconciliation* (ledger ⇄ Stripe) and regulatory reporting (DAC7) — not the raw statement.
+**OSS settlement statements come free.** The ledger is exportable through the standard `Spree::Export` pipeline — a per-seller CSV of transfers/payouts (sales − commission − commission VAT = net, plus reversals) is just an export of these tables, replacing the legacy `Spree::Reports::SellersPayout` report. What stays Enterprise under "payout reports" is provider *reconciliation* (ledger ⇄ Stripe) and regulatory reporting (DAC7) — not the raw statement.
### Reversals (refunds)
The legacy module writes **reverse commission rows** when items are refunded (per returned item, plus an order-scoped prorated row for whole-order refunds) **and** reverse transfers. 6.0 keeps both, symmetric — but reversals are always **per line** (a whole-order refund reverses each line's commission exactly; the legacy order-level proration and its rounding fuzz are not carried over):
- A refund writes a negative/`reversed` `CommissionLine` (net commission = `sum(commission_lines)`).
-- A refund writes a `refund_reversal` `VendorTransfer` linked via `reversed_from` (net earned = `sum(vendor_transfers)`). If the original transfer was already settled in a completed payout, the reversal lands in the next payout period (Decision 9).
+- A refund writes a `refund_reversal` `SellerTransfer` linked via `reversed_from` (net earned = `sum(seller_transfers)`). If the original transfer was already settled in a completed payout, the reversal lands in the next payout period (Decision 9).
-**The hook point is `Spree::Refund`.** `6.0-returns-exchanges-claims.md` funnels Return, Exchange, and Claim money movement through `Spree::Refund` — so a single subscriber on the refund event covers all three flows: it updates the child order's `PaymentSplit.refunded_amount`, writes the reverse `CommissionLine`s for the refunded items, and writes the reversal `VendorTransfer`.
+**The hook point is `Spree::Refund`.** `6.0-returns-exchanges-claims.md` funnels Return, Exchange, and Claim money movement through `Spree::Refund` — so a single subscriber on the refund event covers all three flows: it updates the child order's `PaymentSplit.refunded_amount`, writes the reverse `CommissionLine`s for the refunded items, and writes the reversal `SellerTransfer`.
### Product ownership & approval
-- Products carry `vendor_id` (nullable — the operator's own first-party products have none). Vendor users only see/manage their own (ability tenancy condition).
-- **Approval reuses the product status workflow — no new approval model.** Vendor-created products default to `draft`; a store preference `vendor_products_require_approval` (default `true`) controls whether vendors may activate their own products or an operator must. This covers the seller product-approval workflow competing marketplaces ship, with zero new machinery, and `#13323`'s "merchandise Vendor's products" stays intact — the operator retains full edit rights over vendor products (naming, taxons, publication to channels).
-- Vendor bulk product CSV import/export rides the existing `Spree::Import` / `Spree::Export` pipeline (see `5.6-admin-spa-csv-import.md`) with the vendor context stamped on created records — no marketplace-specific importer.
-- **SKU uniqueness relaxes to per-vendor scope.** Two vendors legitimately sell the same manufacturer SKU (the legacy module disables SKU validation outright); 6.0 scopes the uniqueness check by the **variant's** `vendor_id` instead of dropping it (Decision 11 — sellers share a product, so scoping by the product's owner would not separate them). Note today's scope is `spree_base_uniqueness_scope`, which is empty: SKUs are unique across the whole installation, not even per store.
-- "Shop by vendor" curated pages come from a vendor-subject `CollectionRule` kind (`6.0-replace-taxons-with-categories.md`), replacing the legacy `Spree::TaxonRules::Vendor`.
+- Products carry `seller_id` (nullable — the operator's own first-party products have none). Seller users only see/manage their own (ability tenancy condition).
+- **Approval reuses the product status workflow — no new approval model.** Seller-created products default to `draft`; a store preference `seller_products_require_approval` (default `true`) controls whether sellers may activate their own products or an operator must. This covers the seller product-approval workflow competing marketplaces ship, with zero new machinery, and `#13323`'s "merchandise Seller's products" stays intact — the operator retains full edit rights over seller products (naming, taxons, publication to channels).
+- Seller bulk product CSV import/export rides the existing `Spree::Import` / `Spree::Export` pipeline (see `5.6-admin-spa-csv-import.md`) with the seller context stamped on created records — no marketplace-specific importer.
+- **SKU uniqueness relaxes to per-seller scope.** Two sellers legitimately sell the same manufacturer SKU (the legacy module disables SKU validation outright); 6.0 scopes the uniqueness check by the **variant's** `seller_id` instead of dropping it (Decision 11 — sellers share a product, so scoping by the product's owner would not separate them). Note today's scope is `spree_base_uniqueness_scope`, which is empty: SKUs are unique across the whole installation, not even per store.
+- "Shop by seller" curated pages come from a seller-subject `CollectionRule` kind (`6.0-replace-taxons-with-categories.md`), replacing the legacy `Spree::TaxonRules::Seller`.
-### Vendor notifications
+### Seller notifications
-Vendor notifications are **event-driven, with OSS mailers included** — split along the existing mailer boundary:
+Seller notifications are **event-driven, with OSS mailers included** — split along the existing mailer boundary:
-- **Back-office emails to vendors and admins live in core**, next to the existing back-office mailers (`Spree::ExportMailer`, `Spree::ImportMailer`, `Spree::InvitationMailer`, `Spree::ReportMailer`): a `Spree::VendorMailer` ports the legacy set — vendor approved/rejected/suspended (to the vendor's team), onboarding started/submitted-for-review (to store admins), new vendor order, payout completed — wired as subscribers to the lifecycle events below. Vendor *invitations* need nothing new: they already ride core's `InvitationMailer` via the `Invitation` rail. Core-resident means vendor email works in every installation, regardless of gems.
-- **Consumer-facing emails** (e.g. the per-vendor shipment tracking emails customers receive) belong to `spree/emails` (rebuilt + modernized in 5.6, optional) — or to the storefront's own email stack via webhooks, for headless setups that own transactional email.
+- **Back-office emails to sellers and admins live in core**, next to the existing back-office mailers (`Spree::ExportMailer`, `Spree::ImportMailer`, `Spree::InvitationMailer`, `Spree::ReportMailer`): a `Spree::SellerMailer` ports the legacy set — seller approved/rejected/suspended (to the seller's team), onboarding started/submitted-for-review (to store admins), new seller order, payout completed — wired as subscribers to the lifecycle events below. Seller *invitations* need nothing new: they already ride core's `InvitationMailer` via the `Invitation` rail. Core-resident means seller email works in every installation, regardless of gems.
+- **Consumer-facing emails** (e.g. the per-seller shipment tracking emails customers receive) belong to `spree/emails` (rebuilt + modernized in 5.6, optional) — or to the storefront's own email stack via webhooks, for headless setups that own transactional email.
-Either way the events are the seam — subscribers/webhooks feed n8n/Slack/custom stacks, including OSS payout automation: `vendor_payout.due` → webhook → operator's banking flow → `POST /vendor_payouts/:id/complete`.
+Either way the events are the seam — subscribers/webhooks feed n8n/Slack/custom stacks, including OSS payout automation: `seller_payout.due` → webhook → operator's banking flow → `POST /seller_payouts/:id/complete`.
-Events (via `publishes_lifecycle_events` + explicit publishes): `vendor.created/updated/approved/rejected/suspended`, `order_group.completed`, per-child `order.placed` (existing), `commission_line.created`, `vendor_transfer.completed/reversed`, `vendor_payout.due/completed/failed`.
+Events (via `publishes_lifecycle_events` + explicit publishes): `seller.created/updated/approved/rejected/suspended`, `order_group.completed`, per-child `order.placed` (existing), `commission_line.created`, `seller_transfer.completed/reversed`, `seller_payout.due/completed/failed`.
### Store API surface
-Mirrors what the legacy v2 storefront already exposed for Enterprise (`/api/v2/storefront/vendors`), rebuilt on v3:
+Mirrors what the legacy v2 storefront already exposed for Enterprise (`/api/v2/storefront/sellers`), rebuilt on v3:
-- `GET /api/v3/store/vendors` + `GET /api/v3/store/vendors/:slug` — public profile: `name`, `slug`, `about`, `logo`, `square_logo`, `cover_photo`. Only `approved`, non-holiday vendors. No timestamps, no contact email, no financials (store-serializer rules).
-- Product serializers gain a `vendor { id, name, slug }` object (nil for first-party products); product listing accepts `q[vendor_id_eq]` — that plus the vendor profile endpoint is a complete vendor storefront page. Vendor becomes a search facet through the existing SearchProvider filter registry.
-- `POST /api/v3/store/vendor_applications` — the self-serve "become a seller" application (name, contact email, message) creating a pending vendor + owner invitation for operator review. Rate-limited, no auth required.
-- Checkout completion of a cart that split returns the **order group**: `{ order_group: { id, number, orders: [...] } }`; carts that don't split (a single partition — all one vendor, or all first-party) keep returning the bare order. Customer account history lists groups with nested per-vendor orders + per-order fulfillment tracking (today's "separate tracking per vendor" UX).
+- `GET /api/v3/store/sellers` + `GET /api/v3/store/sellers/:slug` — public profile: `name`, `slug`, `about`, `logo`, `square_logo`, `cover_photo`. Only `approved`, non-holiday sellers. No timestamps, no contact email, no financials (store-serializer rules).
+- Product serializers gain a `seller { id, name, slug }` object (nil for first-party products); product listing accepts `q[seller_id_eq]` — that plus the seller profile endpoint is a complete seller storefront page. Seller becomes a search facet through the existing SearchProvider filter registry.
+- `POST /api/v3/store/seller_applications` — the self-serve "become a seller" application (name, contact email, message) creating a pending seller + owner invitation for operator review. Rate-limited, no auth required.
+- Checkout completion of a cart that split returns the **order group**: `{ order_group: { id, number, orders: [...] } }`; carts that don't split (a single partition — all one seller, or all first-party) keep returning the bare order. Customer account history lists groups with nested per-seller orders + per-order fulfillment tracking (today's "separate tracking per seller" UX).
### Admin API surface
-Endpoint list lives in `6.0-admin-api.md` → "Marketplace (new in 6.0)": vendors CRUD + `invite`/`approve`/`reject`/`suspend` (approve also un-suspends, matching the legacy machine), commission rates CRUD (nested `rules: []`, PriceList-style), read-only `commission_lines` + `vendor_transfers`, `vendor_payouts` + `POST :id/complete` (manual settlement), read-only `order_groups`. API key scopes: `read_vendors`/`write_vendors`, `read_commissions`/`write_commissions`, `read_payouts`/`write_payouts`. This is the **operator's** surface only — vendor *users* never call it (Decision 10; the 2026-07-14 "collapse into ability scoping" wording is superseded).
+Endpoint list lives in `6.0-admin-api.md` → "Marketplace (new in 6.0)": sellers CRUD + `invite`/`approve`/`reject`/`suspend` (approve also un-suspends, matching the legacy machine), commission rates CRUD (nested `rules: []`, PriceList-style), read-only `commission_lines` + `seller_transfers`, `seller_payouts` + `POST :id/complete` (manual settlement), read-only `order_groups`. API key scopes: `read_sellers`/`write_sellers`, `read_commissions`/`write_commissions`, `read_payouts`/`write_payouts`. This is the **operator's** surface only — seller *users* never call it (Decision 10; the 2026-07-14 "collapse into ability scoping" wording is superseded).
-### Vendor API surface (new 2026-08-15 — Decision 10)
+### Seller API surface (new 2026-08-15 — Decision 10)
-A third v3 branch, `/api/v3/vendor/…`, anchored by `Spree::Api::V3::Vendor::BaseController` / `Vendor::ResourceController` (mirroring the admin pair; concerns added to one must be added to the other):
+A third v3 branch, `/api/v3/seller/…`, anchored by `Spree::Api::V3::Seller::BaseController` / `Seller::ResourceController` (mirroring the admin pair; concerns added to one must be added to the other):
-- **Auth & context:** `POST /vendor/auth/login|refresh|logout`, password reset — `Spree.vendor_authentication_strategies`, `vendor_api` JWT audience, audience-stamped refresh token + own cookie. `X-Spree-Vendor-Id` selects the vendor; membership = `role_users` on `resource: vendor`; a header naming a vendor the caller does not belong to is 403; `Spree::Current.store` is set from `current_vendor.store`. `GET /vendor/me` — user + vendor memberships + `permission_keys` for the selected vendor. Invitation acceptance stays on the existing `/admin/invitation_acceptances` (it is store-agnostic and already handles `resource: vendor`).
-- **Own resources:** `GET/PATCH /vendor/profile` (name, about, branding uploads, billing/returns addresses, `payouts_schedule_interval`, ToS acceptance, holiday mode), `GET /vendor/onboarding_tasks` + `POST /vendor/onboarding/submit_for_review`, `GET /vendor/team` + team invitations (`RoleGrantGuard`-bounded to vendor-audience roles), `GET /vendor/balance`, `GET /vendor/transfers`, `GET /vendor/payouts` (read-only ledger).
-- **Catalog:** products (+ nested variants, prices, media, stock items) — every lookup through `current_vendor.products`; create force-stamps `vendor_id`; approval state per the store's vendor-product preference. No channel publication, no categories/collections/tags management (read-only pickers where a product form needs them, store-scoped read).
-- **Orders:** the vendor's child orders (`current_vendor.orders`), fulfillments with `Fulfillments::Fulfill`/`Cancel`/`UpdateTracking`, returns/claims on those orders. **No** refunds, order edits, approvals, payments — the vendor sees its `payment_split`, never the group's `Payment`.
-- **Delivery:** the vendor's own delivery methods (`vendor_id` = self); store-wide methods read-only.
-- **Exports/imports:** the vendor's own runs on the `Spree::Export`/`Import` pipeline, scoped by `vendor_id`.
-- **Serializers:** `Spree::Api::V3::Vendor::*Serializer < V3::*Serializer` (the store serializer) plus an explicit list of operational fields — never a subclass of the admin serializer, so nothing leaks by inheritance. Own typelizer output and a generated `docs/api-reference/vendor.yaml` from `spree/api/spec/integration/spree/api/v3/vendor/`.
-- **Tripwires:** the branch enters `Spree::StoreScopeGuard`'s coverage, and Phase 1 adds a vendor-scope guard on the same pattern (flag store-scoped-but-not-vendor-scoped scans on vendor-owned tables under `/vendor`).
-- **Later, not 6.0:** vendor-bound secret API keys (Enterprise Shopify/Woo apps acting as the vendor) — safe only on this branch, because its base scope is `current_vendor`; a store-bound admin key is `can :manage, :all`.
-- SDK packaging (a `@spree/vendor-sdk` vs a `vendor` namespace in the admin SDK) is decided with Phase 4; the API decision does not depend on it.
+- **Auth & context:** `POST /seller/auth/login|refresh|logout`, password reset — `Spree.seller_authentication_strategies`, `seller_api` JWT audience, audience-stamped refresh token + own cookie. `X-Spree-Seller-Id` selects the seller; membership = `role_users` on `resource: seller`; a header naming a seller the caller does not belong to is 403; `Spree::Current.store` is set from `current_seller.store`. `GET /seller/me` — user + seller memberships + `permission_keys` for the selected seller. Invitation acceptance stays on the existing `/admin/invitation_acceptances` (it is store-agnostic and already handles `resource: seller`).
+- **Own resources:** `GET/PATCH /seller/profile` (name, about, branding uploads, billing/returns addresses, `payouts_schedule_interval`, ToS acceptance, holiday mode), `GET /seller/onboarding_tasks` + `POST /seller/onboarding/submit_for_review`, `GET /seller/team` + team invitations (`RoleGrantGuard`-bounded to seller-audience roles), `GET /seller/balance`, `GET /seller/transfers`, `GET /seller/payouts` (read-only ledger).
+- **Catalog:** products (+ nested variants, prices, media, stock items) — every lookup through `current_seller.products`; create force-stamps `seller_id`; approval state per the store's seller-product preference. No channel publication, no categories/collections/tags management (read-only pickers where a product form needs them, store-scoped read).
+- **Orders:** the seller's child orders (`current_seller.orders`), fulfillments with `Fulfillments::Fulfill`/`Cancel`/`UpdateTracking`, returns/claims on those orders. **No** refunds, order edits, approvals, payments — the seller sees its `payment_split`, never the group's `Payment`.
+- **Delivery:** the seller's own delivery methods (`seller_id` = self); store-wide methods read-only.
+- **Exports/imports:** the seller's own runs on the `Spree::Export`/`Import` pipeline, scoped by `seller_id`.
+- **Serializers:** `Spree::Api::V3::Seller::*Serializer < V3::*Serializer` (the store serializer) plus an explicit list of operational fields — never a subclass of the admin serializer, so nothing leaks by inheritance. Own typelizer output and a generated `docs/api-reference/seller.yaml` from `spree/api/spec/integration/spree/api/v3/seller/`.
+- **Tripwires:** the branch enters `Spree::StoreScopeGuard`'s coverage, and Phase 1 adds a seller-scope guard on the same pattern (flag store-scoped-but-not-seller-scoped scans on seller-owned tables under `/seller`).
+- **Later, not 6.0:** seller-bound secret API keys (Enterprise Shopify/Woo apps acting as the seller) — safe only on this branch, because its base scope is `current_seller`; a store-bound admin key is `can :manage, :all`.
+- SDK packaging (a `@spree/seller-sdk` vs a `seller` namespace in the admin SDK) is decided with Phase 4; the API decision does not depend on it.
## Migration Path
-This is **new OSS code**, not a rename of existing core — there is no in-place data migration for existing Spree stores (they have no vendors). The "migration" is twofold:
+This is **new OSS code**, not a rename of existing core — there is no in-place data migration for existing Spree stores (they have no sellers). The "migration" is twofold:
1. **From the Enterprise module to core**, for existing marketplace customers. A one-time backfill rake task (shipped in Enterprise — only Enterprise has legacy data) must:
- For each legacy `splitted` parent order, create a `Spree::OrderGroup` and attach its `parent_id` children as the group's orders.
- Migrate the legacy per-item commission rows → `spree_commission_lines`. **Sign convention flips**: the legacy module stores order-level fee totals negative (load-bearing in its payout math); `CommissionLine` amounts are positive, reversals are their own negative/`reversed` rows.
- - Decrypt the legacy encrypted vendor contact columns (ActiveRecord encryption — a multi-tenant SaaS choice) into core's plain columns.
- - Migrate the legacy Stripe transfer ledger → `spree_vendor_transfers` (the per-order, on-fulfillment level) with `provider: 'stripe_connect'` and the Stripe transfer id in `reference`. The legacy module has no payout *records* (it delegated scheduling to Stripe), so there is nothing to backfill into `spree_vendor_payouts` — historical Stripe payouts can optionally be reconstructed from Stripe's API, or simply start fresh from the cutover.
+ - Decrypt the legacy encrypted seller contact columns (ActiveRecord encryption — a multi-tenant SaaS choice) into core's plain columns.
+ - Migrate the legacy Stripe transfer ledger → `spree_seller_transfers` (the per-order, on-fulfillment level) with `provider: 'stripe_connect'` and the Stripe transfer id in `reference`. The legacy module has no payout *records* (it delegated scheduling to Stripe), so there is nothing to backfill into `spree_seller_payouts` — historical Stripe payouts can optionally be reconstructed from Stripe's API, or simply start fresh from the cutover.
The Enterprise module then becomes a thin layer on top of core's new models, deleting its splitting + commission + transfer decorators. The basic `Spree::PayoutProvider::StripeConnect` ships in the monorepo with the pulled-in Stripe gateway (2026-07-15 amendment); Enterprise extends it (clawbacks, netting, KYC ops, reconciliation) and keeps Shopify/WooCommerce.
2. **Build order** (each phase shippable):
- - **Phase 0 — admin-branch hardening (ships first, no Vendor model needed). IMPLEMENTED 2026-08-16.** Tighten `AdminAuthentication#current_user_member_of_store?` to `resource_type: 'Spree::Store'` + regression spec; `spree_refresh_tokens.audience` written at mint and enforced on refresh (admin + store surfaces stamp their own); `Role#audience` + the audience marker on `register_resource` (Decision 10 / RBAC plan). **Shipped as:** `audience` on refresh tokens (nullable; `for_audience` scope narrowing every refresh **and** logout lookup on both surfaces — ending a session belongs to the surface that started it; legacy NULL-audience rows match no surface and are rejected on refresh, costing their holders one login) and on roles (`null: false`, backfilled `staff`, immutable after create, `Spree::Role::AUDIENCES` the vocabulary); the catalog takes `audiences:` naming the audiences **beyond staff** a resource opens up, with `grantable_keys(audience)` (unknown audience ⇒ empty, never raises) — a generalization of the originally-planned `vendor_grantable` boolean, so a third panel needs no schema change (decisions.md 2026-08-16); `orders`/`fulfillments`/`products`/`stock`/`dashboard` opened to `vendor`. **Roles became store-owned** (`spree_roles.store_id`, `null: false`, via `SingleStoreResource`): they were global reference data, so two stores could never each define a "Manager" and the marketplace would have inherited that. Names are unique per `(store, name, audience)` — `Spree::UniqueName`'s global uniqueness is deliberately not used on Role — so one store holds a staff "Manager" beside a vendor "Manager", and another store holds its own. `admin` is now one immutable role **per store** (`default_admin_role(store)`; `Seeds::Roles` moved after `Seeds::Stores`, since a role cannot exist before its store). The upgrade fans every existing role out per store and re-points assignments and invitations at the copy for the store they already named, so no grant changes hands. The audience bound is enforced **twice**: `Spree::Role` validates it on write, and `Spree::Ability` re-filters through `grantable_keys(role.audience)` at activation, since a catalog that changes after the role was saved would otherwise leave stale keys live. The staff surface is closed to foreign-audience roles at both ends — `Admin::RolesController#scope` lists only `Spree::Role.staff`, and `RoleGrantGuard` rejects assigning a non-staff role to store staff (invitations + admin_users). `Spree::Ability` takes `resource:` (defaults to the store) and reads `role_users` on it — the `admin` super-role and the implicit-admin fallback apply **only** on a store resource, and the staff baseline narrows `read Spree::Store` to the one store a non-store panel operates under. **The ability answers capability, never tenancy:** a vendor holding `write_orders` gets `can :manage, Spree::Order` on the model class exactly as an admin does; which records it may touch is `current_vendor` scope-fetching in the controller, so a vendor-branch controller that authorizes without scope-fetching reads store-wide.
- - **Phase 1 — Vendor identity.** `Spree::Vendor` model (see Vendor identity & teams: lifecycle, branding, ToS acceptance, holiday mode), onboarding task registry + core tasks, vendor teams via `RoleUser`/`Invitation` (`resource: vendor`) + `UserRoles#vendors`, self-serve application endpoint, core `Spree::VendorMailer` lifecycle emails (see Vendor notifications), product ownership (`products.vendor_id` + approval preference), Admin API Marketplace/vendors endpoints + Store API vendor profiles, vendor CSV import/export on the `Spree::Import` pipeline. **Phase 1b — the shared catalog (Decision 11):** `variants.vendor_id` + `variants.delivery_profile_id`, condition as an OptionType, the ownership filter on `Product#variants=`, first-party `default_variant` priority, the same-variant fix to option filtering, and the buy-box selection service the product rollups then answer through. Sequenced here rather than later because the split's partition key (Phase 3) and the commission line's identity (Phase 2) both read the seller off a line item, and on a shared product only the variant can answer. **The Vendor API branch anchor** (`Vendor::BaseController`/`ResourceController`, `vendor_api` audience, `Spree.vendor_authentication_strategies`, `/vendor/auth/*`, `/vendor/me`, `/vendor/profile`, onboarding, team, vendor-scope guard, `Spree::Ability` `resource:` option) + the seeded default vendor role. Products/orders/fulfillments on the vendor branch follow as each domain lands (products in Phase 1, orders/fulfillments/ledger reads in Phase 3). No splitting yet.
- - **Phase 2 — Commission engine.** `CommissionRate` + `CommissionRule` + `CommissionLine`, resolution + calculation services (dimension-grouped matching, min/max clamps, `include_shipping`), commission-tax field, admin UI for rates. Compute-only (attach to single-vendor orders, no split).
- - **Phase 3 — Order splitting + fund ledger.** `OrderGroup`, `Carts::SplitByVendor` inside `Carts::Complete`, per-vendor delivery selection at checkout, `PaymentSplit`, derived group status, reversals, the two-level `VendorTransfer` (on-fulfillment) + `VendorPayout` (scheduled sweep) + `PayoutProvider::System` + `vendor.balance(currency)`. **Gated on `6.0-cart-order-split.md` and `6.0-6.1-split-adjustments.md` landing first** — and cart-order-split is today a one-page stub: it must be expanded (checkout/delivery-selection/payment flow on Cart) before this phase's design can freeze. Flagging early: the 6.0 headline feature sits downstream of the two biggest unstarted refactors.
- - **Phase 3b — OSS Stripe provider** (after Phase 3, alongside the Stripe gateway pull-in: the payment-sessions-API gateway classes come into the monorepo from the standalone `spree_stripe` repo, likely into `spree/core`, leaving the legacy v2-API/storefront code behind): Express onboarding link in the vendor dashboard, `account.updated` status webhook, `transfer!` on fulfillment with `source_transaction`, payout-schedule mapping + payout webhooks. Ledger-only `reverse!`.
- - **Phase 4 — Dashboards.** (a) Operator marketplace screens in `@spree/dashboard`: Vendors list/detail (lifecycle actions, branding, commission + payout settings, ledger-derived lifetime revenue/commission), Commission Rates settings page, Payouts review queue (owed balances, itemized payouts, mark-paid), OrderGroup rendering on order screens, and a "needs attention" queue on the dashboard home (vendors `ready_for_review` + pending vendor products — a lightweight unified review inbox). (b) Vendor panel: compose `@spree/dashboard-ui` + `@spree/dashboard-core` into a vendor-scoped panel (per `6.0-admin-spa.md` — the package split exists precisely for this) talking to the Vendor API branch (own login page + `vendor_api` tokens; `PermissionProvider` fed by `/vendor/me`). Vendor roles come from the operator's roles editor filtered to the vendor audience; the operator's Vendors detail screen assigns them. Surfaces the vendor's products, orders + fulfillment actions, and the balance + transfer/payout ledger (earned/settled) read-only for OSS.
+ - **Phase 0 — admin-branch hardening (ships first, no Seller model needed). IMPLEMENTED 2026-08-16.** Tighten `AdminAuthentication#current_user_member_of_store?` to `resource_type: 'Spree::Store'` + regression spec; `spree_refresh_tokens.audience` written at mint and enforced on refresh (admin + store surfaces stamp their own); `Role#audience` + the audience marker on `register_resource` (Decision 10 / RBAC plan). **Shipped as:** `audience` on refresh tokens (nullable; `for_audience` scope narrowing every refresh **and** logout lookup on both surfaces — ending a session belongs to the surface that started it; legacy NULL-audience rows match no surface and are rejected on refresh, costing their holders one login) and on roles (`null: false`, backfilled `staff`, immutable after create, `Spree::Role::AUDIENCES` the vocabulary); the catalog takes `audiences:` naming the audiences **beyond staff** a resource opens up, with `grantable_keys(audience)` (unknown audience ⇒ empty, never raises) — a generalization of the originally-planned `seller_grantable` boolean, so a third panel needs no schema change (decisions.md 2026-08-16); `orders`/`fulfillments`/`products`/`stock`/`dashboard` opened to `seller`. **Roles became store-owned** (`spree_roles.store_id`, `null: false`, via `SingleStoreResource`): they were global reference data, so two stores could never each define a "Manager" and the marketplace would have inherited that. Names are unique per `(store, name, audience)` — `Spree::UniqueName`'s global uniqueness is deliberately not used on Role — so one store holds a staff "Manager" beside a seller "Manager", and another store holds its own. `admin` is now one immutable role **per store** (`default_admin_role(store)`; `Seeds::Roles` moved after `Seeds::Stores`, since a role cannot exist before its store). The upgrade fans every existing role out per store and re-points assignments and invitations at the copy for the store they already named, so no grant changes hands. The audience bound is enforced **twice**: `Spree::Role` validates it on write, and `Spree::Ability` re-filters through `grantable_keys(role.audience)` at activation, since a catalog that changes after the role was saved would otherwise leave stale keys live. The staff surface is closed to foreign-audience roles at both ends — `Admin::RolesController#scope` lists only `Spree::Role.staff`, and `RoleGrantGuard` rejects assigning a non-staff role to store staff (invitations + admin_users). `Spree::Ability` takes `resource:` (defaults to the store) and reads `role_users` on it — the `admin` super-role and the implicit-admin fallback apply **only** on a store resource, and the staff baseline narrows `read Spree::Store` to the one store a non-store panel operates under. **The ability answers capability, never tenancy:** a seller holding `write_orders` gets `can :manage, Spree::Order` on the model class exactly as an admin does; which records it may touch is `current_seller` scope-fetching in the controller, so a seller-branch controller that authorizes without scope-fetching reads store-wide.
+ - **Phase 1 — Seller identity.** `Spree::Seller` model (see Seller identity & teams: lifecycle, branding, ToS acceptance, holiday mode), onboarding task registry + core tasks, seller teams via `RoleUser`/`Invitation` (`resource: seller`) + `UserRoles#sellers`, self-serve application endpoint, core `Spree::SellerMailer` lifecycle emails (see Seller notifications), product ownership (`products.seller_id` + approval preference), Admin API Marketplace/sellers endpoints + Store API seller profiles, seller CSV import/export on the `Spree::Import` pipeline. **Phase 1b — the shared catalog (Decision 11):** `variants.seller_id` + `variants.delivery_profile_id`, condition as an OptionType, the ownership filter on `Product#variants=`, first-party `default_variant` priority, the same-variant fix to option filtering, and the buy-box selection service the product rollups then answer through. Sequenced here rather than later because the split's partition key (Phase 3) and the commission line's identity (Phase 2) both read the seller off a line item, and on a shared product only the variant can answer. **The Seller API branch anchor** (`Seller::BaseController`/`ResourceController`, `seller_api` audience, `Spree.seller_authentication_strategies`, `/seller/auth/*`, `/seller/me`, `/seller/profile`, onboarding, team, seller-scope guard, `Spree::Ability` `resource:` option) + the seeded default seller role. Products/orders/fulfillments on the seller branch follow as each domain lands (products in Phase 1, orders/fulfillments/ledger reads in Phase 3). No splitting yet.
+ - **Phase 2 — Commission engine.** `CommissionRate` + `CommissionRule` + `CommissionLine`, resolution + calculation services (dimension-grouped matching, min/max clamps, `include_shipping`), commission-tax field, admin UI for rates. Compute-only (attach to single-seller orders, no split).
+ - **Phase 3 — Order splitting + fund ledger.** `OrderGroup`, `Carts::SplitBySeller` inside `Carts::Complete`, per-seller delivery selection at checkout, `PaymentSplit`, derived group status, reversals, the two-level `SellerTransfer` (on-fulfillment) + `SellerPayout` (scheduled sweep) + `PayoutProvider::System` + `seller.balance(currency)`. **Gated on `6.0-cart-order-split.md` and `6.0-6.1-split-adjustments.md` landing first** — and cart-order-split is today a one-page stub: it must be expanded (checkout/delivery-selection/payment flow on Cart) before this phase's design can freeze. Flagging early: the 6.0 headline feature sits downstream of the two biggest unstarted refactors.
+ - **Phase 3b — OSS Stripe provider** (after Phase 3, alongside the Stripe gateway pull-in: the payment-sessions-API gateway classes come into the monorepo from the standalone `spree_stripe` repo, likely into `spree/core`, leaving the legacy v2-API/storefront code behind): Express onboarding link in the seller dashboard, `account.updated` status webhook, `transfer!` on fulfillment with `source_transaction`, payout-schedule mapping + payout webhooks. Ledger-only `reverse!`.
+ - **Phase 4 — Dashboards.** (a) Operator marketplace screens in `@spree/dashboard`: Sellers list/detail (lifecycle actions, branding, commission + payout settings, ledger-derived lifetime revenue/commission), Commission Rates settings page, Payouts review queue (owed balances, itemized payouts, mark-paid), OrderGroup rendering on order screens, and a "needs attention" queue on the dashboard home (sellers `ready_for_review` + pending seller products — a lightweight unified review inbox). (b) Seller panel: compose `@spree/dashboard-ui` + `@spree/dashboard-core` into a seller-scoped panel (per `6.0-admin-spa.md` — the package split exists precisely for this) talking to the Seller API branch (own login page + `seller_api` tokens; `PermissionProvider` fed by `/seller/me`). Seller roles come from the operator's roles editor filtered to the seller audience; the operator's Sellers detail screen assigns them. Surfaces the seller's products, orders + fulfillment actions, and the balance + transfer/payout ledger (earned/settled) read-only for OSS.
**Phases 1–2 have no dependency on the Cart/Order split** — they can be built (even shipped behind a preview flag in a 5.x release) while the split refactor lands, de-risking the 6.0 timeline.
@@ -704,60 +706,60 @@ This is **new OSS code**, not a rename of existing core — there is no in-place
Even before this lands, work touching adjacent areas should:
-- **Cart/Order split (`6.0-cart-order-split.md`)**: keep `cart.complete!`/`Spree::Carts::Complete` as the single completion entry point — the vendor split hooks in there. Do not reintroduce an order-level `after_transition` extension surface; multi-vendor must not depend on one. When fleshing out the checkout flow on Cart, design delivery selection **per package** (packages come from order routing) — the multi-vendor checkout needs one delivery choice per vendor package before completion, and payments must be attachable to an `OrderGroup`, not only to an `Order`.
-- **Rich text sanitization (`6.0-rich-text-descriptions.md`)**: vendors are the marketplace's lower-trust writers, and today they are protected by the 5.x-only Enterprise gem's `Spree::SanitizeConcern` (`sanitize :description, :meta_description, if: -> { vendor_id.present? }`). That gem does not carry into 6.0 — this plan rewrites its functionality as core models — so **core must own the sanitization before vendor-authored content lands here**. Core's `SanitizableRichText` (shipped 5.6.2) sanitizes on write rather than deriving `sanitized_*` on read, which is the stronger form. Three obligations for this plan: (1) apply it to every vendor-writable rich text field (`Vendor#about`, vendor-authored product descriptions); (2) keep vendor-facing write paths — the vendor dashboard, vendor CSV/feed imports, bulk maintenance jobs — on save-backed writers, since the concern is a `before_save` and does not cover `update_columns`/`update_all`/raw SQL (anything that must bypass callbacks calls `Spree::RichTextSanitizer.sanitize` explicitly); (3) do **not** ship a 6.0 allowlist weaker than the Enterprise scrubber vendors have on 5.x — that one prunes `script`/`style` element bodies entirely.
+- **Cart/Order split (`6.0-cart-order-split.md`)**: keep `cart.complete!`/`Spree::Carts::Complete` as the single completion entry point — the seller split hooks in there. Do not reintroduce an order-level `after_transition` extension surface; multi-vendor must not depend on one. When fleshing out the checkout flow on Cart, design delivery selection **per package** (packages come from order routing) — the multi-vendor checkout needs one delivery choice per seller package before completion, and payments must be attachable to an `OrderGroup`, not only to an `Order`.
+- **Rich text sanitization (`6.0-rich-text-descriptions.md`)**: sellers are the marketplace's lower-trust writers, and today they are protected by the 5.x-only Enterprise gem's `Spree::SanitizeConcern` (`sanitize :description, :meta_description, if: -> { seller_id.present? }`). That gem does not carry into 6.0 — this plan rewrites its functionality as core models — so **core must own the sanitization before seller-authored content lands here**. Core's `SanitizableRichText` (shipped 5.6.2) sanitizes on write rather than deriving `sanitized_*` on read, which is the stronger form. Three obligations for this plan: (1) apply it to every seller-writable rich text field (`Seller#about`, seller-authored product descriptions); (2) keep seller-facing write paths — the seller dashboard, seller CSV/feed imports, bulk maintenance jobs — on save-backed writers, since the concern is a `before_save` and does not cover `update_columns`/`update_all`/raw SQL (anything that must bypass callbacks calls `Spree::RichTextSanitizer.sanitize` explicitly); (3) do **not** ship a 6.0 allowlist weaker than the Enterprise scrubber sellers have on 5.x — that one prunes `script`/`style` element bodies entirely.
- **Split adjustments (`6.0-6.1-split-adjustments.md`)**: `TaxLine` and `Discount` stay strictly line-item- or fulfillment-attached (order-level discounts distribute to line items at application time), so they re-home unambiguously to one child order during the split. `Fee` may additionally be **order-level** (payment surcharge, COD — resolved 2026-07-27); at split, order-level fees prorate across child orders by item totals (largest-remainder), tax lines following the fee. Do **not** add a commission/marketplace `Fee` kind — commission is `Spree::CommissionLine`, off-order (Decision 2); `Fee` stays buyer-facing.
-- **Inventory operations (`6.0-inventory-operations.md`)**: the procurement model is `Spree::Supplier` — never reuse `Spree::Vendor` (reserved for marketplace sellers) for purchase-order sources. See `decisions.md` 2026-07-14.
-- **External-store sync stays Enterprise**: do **not** add external store/resource models, associations, or callbacks to core (no `external_store` on Vendor, no external product/order/category tables, no platform sync hooks). The Shopify/WooCommerce connection layer is an Enterprise concern that decorates core's Vendor from outside; core only needs to stay decorable (events + the onboarding task registry are the seams it plugs into).
-- **Fulfillment & delivery (`6.0-fulfillment-and-delivery.md`)**: the ledger trigger is defined against Fulfillment ("all fulfillments fulfilled"), and `DeliveryMethod` gets an optional `vendor_id` — keep the fulfillment-status surface queryable per order (child orders fulfill independently) and don't assume one order per checkout in fulfillment UIs.
-- **Order routing (`6.0-order-routing.md`)**: the per-child stock-location decision must come from the routing strategy, so a vendor's items allocate from that vendor's stock location. Keep `for_allocation` vendor-aware-friendly (it already takes `order:`).
+- **Inventory operations (`6.0-inventory-operations.md`)**: the procurement model is `Spree::Supplier` — never reuse `Spree::Seller` (reserved for marketplace sellers) for purchase-order sources. See `decisions.md` 2026-07-14.
+- **External-store sync stays Enterprise**: do **not** add external store/resource models, associations, or callbacks to core (no `external_store` on Seller, no external product/order/category tables, no platform sync hooks). The Shopify/WooCommerce connection layer is an Enterprise concern that decorates core's Seller from outside; core only needs to stay decorable (events + the onboarding task registry are the seams it plugs into).
+- **Fulfillment & delivery (`6.0-fulfillment-and-delivery.md`)**: the ledger trigger is defined against Fulfillment ("all fulfillments fulfilled"), and `DeliveryMethod` gets an optional `seller_id` — keep the fulfillment-status surface queryable per order (child orders fulfill independently) and don't assume one order per checkout in fulfillment UIs.
+- **Order routing (`6.0-order-routing.md`)**: the per-child stock-location decision must come from the routing strategy, so a seller's items allocate from that seller's stock location. Keep `for_allocation` seller-aware-friendly (it already takes `order:`).
- **Tax provider (`6.0-tax-provider.md`)** and **Delivery rate provider (`6.0-delivery-rate-provider.md`)**: the `PayoutProvider` follows the same pluggable-strategy shape — keep the provider-registration convention consistent so all three (tax, delivery rate, payout) register and resolve the same way.
-- **Admin API (`6.0-admin-api.md`)**: the `Vendor` prefix is `ven_` (matches legacy `has_prefix_id :ven`). The "Marketplace (new in 6.0)" endpoint group there is the *operator's* API surface — keep it in sync. Vendor users never call the Admin API (Decision 10).
-- **Auth + RBAC (`6.0-platform-auth.md`, `6.0-admin-rbac.md`)**: no third principal — never add a `VendorUser`/`Spree.vendor_user_class`; vendor staff are `Spree.admin_user_class`. Never derive back-office membership from `store_id` alone — match `RoleUser.resource_type` (`Ability#staff_roles` and `RoleGrantGuard` already do; the membership check must follow). New login surfaces get their own strategy registry and JWT audience; refresh tokens must carry the audience they were minted for. Catalog resources that vendors may hold must be marked vendor-grantable at `register_resource`; `settings`/`staff`/`api_keys` never are. Vendor-branch controllers scope-fetch through `current_vendor` and never subclass admin controllers.
-- Do **not** revive the legacy commission model's shape (label-based rows + denormalized fee totals on the order), do **not** model commission as a polymorphic `Adjustment`, and do **not** write commission as a `Spree::Fee` (fees are buyer-facing and roll into order totals — Decision 2) — 6.0 uses the off-order `Spree::CommissionLine` ledger. Do **not** put the fund ledger in a payment-gateway namespace (the legacy gateway-namespaced-transfer mistake) nor collapse transfer and payout into one model — `Spree::VendorTransfer` (on-fulfillment) and `Spree::VendorPayout` (scheduled) are both core and provider-agnostic.
+- **Admin API (`6.0-admin-api.md`)**: the `Seller` prefix is `sel_`. The "Marketplace (new in 6.0)" endpoint group there is the *operator's* API surface — keep it in sync. Seller users never call the Admin API (Decision 10).
+- **Auth + RBAC (`6.0-platform-auth.md`, `6.0-admin-rbac.md`)**: no third principal — never add a `SellerUser`/`Spree.seller_user_class`; seller staff are `Spree.admin_user_class`. Never derive back-office membership from `store_id` alone — match `RoleUser.resource_type` (`Ability#staff_roles` and `RoleGrantGuard` already do; the membership check must follow). New login surfaces get their own strategy registry and JWT audience; refresh tokens must carry the audience they were minted for. Catalog resources that sellers may hold must be marked seller-grantable at `register_resource`; `settings`/`staff`/`api_keys` never are. Seller-branch controllers scope-fetch through `current_seller` and never subclass admin controllers.
+- Do **not** revive the legacy commission model's shape (label-based rows + denormalized fee totals on the order), do **not** model commission as a polymorphic `Adjustment`, and do **not** write commission as a `Spree::Fee` (fees are buyer-facing and roll into order totals — Decision 2) — 6.0 uses the off-order `Spree::CommissionLine` ledger. Do **not** put the fund ledger in a payment-gateway namespace (the legacy gateway-namespaced-transfer mistake) nor collapse transfer and payout into one model — `Spree::SellerTransfer` (on-fulfillment) and `Spree::SellerPayout` (scheduled) are both core and provider-agnostic.
## Resolved Decisions
-- **Vendor lifecycle → four workflows, never a writable `status`** (RESOLVED 2026-08-16, shipped). `Spree::Vendors::Invite` / `Approve` / `Suspend` / `Reject` (seams `vendor_invite_workflow` and siblings), each with `validate` + `after_*` hooks and its own `vendor.*` event. The Admin API exposes them as member actions (`POST invite`, `PATCH approve|suspend|reject`) and deliberately omits `status` from `permitted_params` — a PATCH that moved a vendor would skip the mail, the payout provisioning and the extension hooks, which is exactly what `6.0-service-workflows.md` keeps out of a column write. Guards admit more than the linear path: `Approve` also lifts a suspension (clearing holiday mode with it) and revives a rejected applicant; `Suspend` is for a vendor already on the marketplace while `Reject` is for one that never traded, so rejecting an approved vendor is refused. Suspension and rejection reasons live in `metadata` rather than columns — each is a note about one event, and the next one has its own. Creation stays plain CRUD (it is not a lifecycle transition), so the default status is applied in an `after_initialize` on the model, as on `Spree::Fulfillment`.
-- **Lifecycle emails are seller-facing, event-driven, and skip the invitation** (RESOLVED 2026-08-16, shipped). `Spree::VendorMailer` (approved/suspended/rejected) in `spree_emails`, fired by `Spree::VendorEmailSubscriber` off the `vendor.*` events the workflows already publish — nothing mails from a workflow step, so mail is one listener among several rather than something a transition waits on. Three departures from the legacy module: **no `vendor.invited` email** (inviting creates an `Invitation`, which already mails the invitee — a second message would be the same news to the same address), **no marketplace-staff copies** (the legacy module mailed every store admin on approval and onboarding; staff read status in the dashboard, and per-admin fan-out across many sellers is the kind of noise merchants switch off — staff notifications ride the event/webhook surface), and **suspension/rejection reasons never appear in the email** (the operator's note is an internal record; the seller is asked to get in touch). Gated on a new `send_vendor_transactional_emails` Store preference rather than the consumer one — sellers are a different audience, and silencing customer receipts must not silence seller mail. Onboarding started/completed emails wait for the onboarding task registry.
-- **The storefront sees a seller's profile, never their operational state** (RESOLVED 2026-08-16, shipped). `Spree::Api::V3::VendorSerializer` carries `name`, `slug`, `about`/`about_html` and the three image URLs — and nothing else. `status` and `sellable` are excluded on purpose (a vendor a shopper can reach is sellable by definition), along with settlement/tax configuration, contact and billing addresses, team size and every timestamp; a spec asserts the exact key set so nothing leaks in later. The admin serializer extends this one rather than duplicating it, per the house rule. Store endpoints are read-only `index`/`show` scoped to `sellable` — a vendor onboarding, suspended or away is neither listed nor fetchable (404), since listing them would advertise products nobody can buy — and resolve by slug or prefixed id so a storefront can route `/vendors/<slug>`. Products expose `vendor_id` on **both** APIs without an expand (so a storefront can group or link by seller cheaply) plus `one :vendor` behind `?expand=vendor`; the admin serializer additionally carries `vendor_name` for its list column. `Spree::Product` gains `vendor_id` and `vendor` to its ransack allowlists — without them the products-table filter silently matches nothing.
-- **Vendor management is staff-only, on its own catalog resource** (RESOLVED 2026-08-16, shipped). `register_resource(:vendors, …)` mints `read_vendors`/`write_vendors` with `Spree::Vendor` as its subject, and is deliberately not offered to the `vendor` audience — a seller administering other sellers is the one thing the vendor key must never allow. `vendor_profile` (the seller's own record, on the vendor branch) therefore claims no subject, so the subject→resource lookup stays unambiguous.
-- **Vendor principal → `Spree::AdminUser` (`Spree.admin_user_class`), no `VendorUser` model** (RESOLVED 2026-08-15). Reuse the whole shipped auth stack and the RBAC rails (`RoleUser`/`Invitation` on `resource: vendor`); membership is by resource type, never `store_id`. Isolation guaranteed at the token layer: own `vendor_api` JWT audience, own `Spree.vendor_authentication_strategies` + `/vendor/auth/*` (so staff can be SSO-only while vendors use passwords; the vendor login refuses non-members), `spree_refresh_tokens.audience`. See Decision 10 + `decisions.md` 2026-08-15.
-- **Vendor API → dedicated `/api/v3/vendor` branch, `current_vendor` scope-fetching; vendors never call the Admin API** (RESOLVED 2026-08-15). Supersedes the 2026-07-14 "vendor users hit the same admin API with vendor-scoped abilities" wording — permission sets with tenancy conditions no longer exist (RBAC, PR #14412), and the RBAC plan's 2026-08-08 direction already named `current_vendor` endpoints. Own serializer branch off the store serializers, own OpenAPI spec, no subclassing of admin controllers. See Decision 10.
-- **Store credit / gift cards split across child orders → group-level payments, prorated through `PaymentSplit` like any other payment** (RESOLVED 2026-08-15). A store-credit or gift-card payment is a `Payment` on the `OrderGroup` exactly like the gateway payment; every group payment gets one `PaymentSplit` row per child order, prorated by child totals with the same largest-remainder rule as order-level discounts. One attribution rule for every payment source, no priority ordering, no special-casing — and it composes with the resolved payment-source-agnostic transfer basis (the vendor's earning never depends on how the buyer paid). Confirmed against the shipped `Carts::Complete` pipeline (payments attach before the split runs).
-- **Payout minimum threshold → core; rolling reserve / holdback → Enterprise** (RESOLVED 2026-08-15). `spree_vendors.minimum_payout_amount` (decimal, nullable; nil ⇒ store preference `default_minimum_payout_amount`) — the sweep skips a vendor whose `balance(currency)` is below the threshold and carries the balance to the next period. A percentage holdback with a release window is money-operations policy (chargeback buffer) and stays Enterprise, so core does not grow a third ledger row kind.
-- **Marketplace-facilitator remittance → `spree_vendors.tax_remittance` (`vendor` | `platform`, default `vendor`), honored by core's transfer basis** (RESOLVED 2026-08-15). `platform` ⇒ `transfer.amount = total − tax_total − commission`; `vendor` keeps `total − commission`. Core owns the ledger math so it is provider-independent; *deciding* when a vendor is `platform`-remitted (US facilitator nexus, EU deemed-supplier scenarios) stays Enterprise "automatic taxes", which simply sets the column. Amends the Decision 9 note that this mode is "not core": the flag and the math are core, the policy is not.
-- **Vendor-scoped promotions → post-6.0** (RESOLVED 2026-08-15 as deferred; shape recorded under Open Questions).
+- **Seller lifecycle → four workflows, never a writable `status`** (RESOLVED 2026-08-16, shipped). `Spree::Sellers::Invite` / `Approve` / `Suspend` / `Reject` (seams `seller_invite_workflow` and siblings), each with `validate` + `after_*` hooks and its own `seller.*` event. The Admin API exposes them as member actions (`POST invite`, `PATCH approve|suspend|reject`) and deliberately omits `status` from `permitted_params` — a PATCH that moved a seller would skip the mail, the payout provisioning and the extension hooks, which is exactly what `6.0-service-workflows.md` keeps out of a column write. Guards admit more than the linear path: `Approve` also lifts a suspension (clearing holiday mode with it) and revives a rejected applicant; `Suspend` is for a seller already on the marketplace while `Reject` is for one that never traded, so rejecting an approved seller is refused. Suspension and rejection reasons live in `metadata` rather than columns — each is a note about one event, and the next one has its own. Creation stays plain CRUD (it is not a lifecycle transition), so the default status is applied in an `after_initialize` on the model, as on `Spree::Fulfillment`.
+- **Lifecycle emails are seller-facing, event-driven, and skip the invitation** (RESOLVED 2026-08-16, shipped). `Spree::SellerMailer` (approved/suspended/rejected) in `spree_emails`, fired by `Spree::SellerEmailSubscriber` off the `seller.*` events the workflows already publish — nothing mails from a workflow step, so mail is one listener among several rather than something a transition waits on. Three departures from the legacy module: **no `seller.invited` email** (inviting creates an `Invitation`, which already mails the invitee — a second message would be the same news to the same address), **no marketplace-staff copies** (the legacy module mailed every store admin on approval and onboarding; staff read status in the dashboard, and per-admin fan-out across many sellers is the kind of noise merchants switch off — staff notifications ride the event/webhook surface), and **suspension/rejection reasons never appear in the email** (the operator's note is an internal record; the seller is asked to get in touch). Gated on a new `send_seller_transactional_emails` Store preference rather than the consumer one — sellers are a different audience, and silencing customer receipts must not silence seller mail. Onboarding started/completed emails wait for the onboarding task registry.
+- **The storefront sees a seller's profile, never their operational state** (RESOLVED 2026-08-16, shipped). `Spree::Api::V3::SellerSerializer` carries `name`, `slug`, `about`/`about_html` and the three image URLs — and nothing else. `status` and `sellable` are excluded on purpose (a seller a shopper can reach is sellable by definition), along with settlement/tax configuration, contact and billing addresses, team size and every timestamp; a spec asserts the exact key set so nothing leaks in later. The admin serializer extends this one rather than duplicating it, per the house rule. Store endpoints are read-only `index`/`show` scoped to `sellable` — a seller onboarding, suspended or away is neither listed nor fetchable (404), since listing them would advertise products nobody can buy — and resolve by slug or prefixed id so a storefront can route `/sellers/<slug>`. Products expose `seller_id` on **both** APIs without an expand (so a storefront can group or link by seller cheaply) plus `one :seller` behind `?expand=seller`; the admin serializer additionally carries `seller_name` for its list column. `Spree::Product` gains `seller_id` and `seller` to its ransack allowlists — without them the products-table filter silently matches nothing.
+- **Seller management is staff-only, on its own catalog resource** (RESOLVED 2026-08-16, shipped). `register_resource(:sellers, …)` mints `read_sellers`/`write_sellers` with `Spree::Seller` as its subject, and is deliberately not offered to the `seller` audience — a seller administering other sellers is the one thing the seller key must never allow. `seller_profile` (the seller's own record, on the seller branch) therefore claims no subject, so the subject→resource lookup stays unambiguous.
+- **Seller principal → `Spree::AdminUser` (`Spree.admin_user_class`), no `SellerUser` model** (RESOLVED 2026-08-15). Reuse the whole shipped auth stack and the RBAC rails (`RoleUser`/`Invitation` on `resource: seller`); membership is by resource type, never `store_id`. Isolation guaranteed at the token layer: own `seller_api` JWT audience, own `Spree.seller_authentication_strategies` + `/seller/auth/*` (so staff can be SSO-only while sellers use passwords; the seller login refuses non-members), `spree_refresh_tokens.audience`. See Decision 10 + `decisions.md` 2026-08-15.
+- **Seller API → dedicated `/api/v3/seller` branch, `current_seller` scope-fetching; sellers never call the Admin API** (RESOLVED 2026-08-15). Supersedes the 2026-07-14 "seller users hit the same admin API with seller-scoped abilities" wording — permission sets with tenancy conditions no longer exist (RBAC, PR #14412), and the RBAC plan's 2026-08-08 direction already named `current_seller` endpoints. Own serializer branch off the store serializers, own OpenAPI spec, no subclassing of admin controllers. See Decision 10.
+- **Store credit / gift cards split across child orders → group-level payments, prorated through `PaymentSplit` like any other payment** (RESOLVED 2026-08-15). A store-credit or gift-card payment is a `Payment` on the `OrderGroup` exactly like the gateway payment; every group payment gets one `PaymentSplit` row per child order, prorated by child totals with the same largest-remainder rule as order-level discounts. One attribution rule for every payment source, no priority ordering, no special-casing — and it composes with the resolved payment-source-agnostic transfer basis (the seller's earning never depends on how the buyer paid). Confirmed against the shipped `Carts::Complete` pipeline (payments attach before the split runs).
+- **Payout minimum threshold → core; rolling reserve / holdback → Enterprise** (RESOLVED 2026-08-15). `spree_sellers.minimum_payout_amount` (decimal, nullable; nil ⇒ store preference `default_minimum_payout_amount`) — the sweep skips a seller whose `balance(currency)` is below the threshold and carries the balance to the next period. A percentage holdback with a release window is money-operations policy (chargeback buffer) and stays Enterprise, so core does not grow a third ledger row kind.
+- **Marketplace-facilitator remittance → `spree_sellers.tax_remittance` (`seller` | `platform`, default `seller`), honored by core's transfer basis** (RESOLVED 2026-08-15). `platform` ⇒ `transfer.amount = total − tax_total − commission`; `seller` keeps `total − commission`. Core owns the ledger math so it is provider-independent; *deciding* when a seller is `platform`-remitted (US facilitator nexus, EU deemed-supplier scenarios) stays Enterprise "automatic taxes", which simply sets the column. Amends the Decision 9 note that this mode is "not core": the flag and the math are core, the policy is not.
+- **Seller-scoped promotions → post-6.0** (RESOLVED 2026-08-15 as deferred; shape recorded under Open Questions).
- **Basic Stripe Connect execution → OSS (boundary amendment)** (RESOLVED 2026-07-15). Express onboarding + on-fulfillment transfers ship in the monorepo alongside the pulled-in Stripe gateway, for demo/adoption parity with the surveyed competitor — "money moves automatically" is the demo that sells, and transfers are inseparable from basic onboarding (a `Stripe::Transfer` needs a connected account). Enterprise repositions on money **operations**: automatic refund clawbacks (prorated transfer reversals + negative-balance netting), KYC/account-health workflows, ledger⇄Stripe reconciliation, payout reports incl. DAC7, facilitator taxes. Ledger reversal rows stay OSS in every mode — only the pullback execution is paid. Supersedes #13323's "execution stays Enterprise" framing (amendment by the issue author; update the issue). See `decisions.md` 2026-07-15.
-- **`Spree::Vendor` name ownership → marketplace seller; inventory-operations' procurement model renamed `Spree::Supplier`** (RESOLVED 2026-07-14). See the Key Decisions entry and `decisions.md` 2026-07-14.
-- **Commission is not a `Spree::Fee`** (RESOLVED 2026-07-14). `Fee` is buyer-facing and rolls into order totals; `CommissionLine` is an off-order platform↔vendor ledger. See Decision 2.
+- **`Spree::Seller` name ownership → marketplace seller; inventory-operations' procurement model renamed `Spree::Supplier`** (RESOLVED 2026-07-14). See the Key Decisions entry and `decisions.md` 2026-07-14.
+- **Commission is not a `Spree::Fee`** (RESOLVED 2026-07-14). `Fee` is buyer-facing and rolls into order totals; `CommissionLine` is an off-order platform↔seller ledger. See Decision 2.
- **Rule reference storage → arrays for sellers and categories, a table for products** (RESOLVED 2026-08-17). Follows the cardinality rule from `6.0-delivery-method-rules.md`, with one deliberate exception: `Promotion::Rules::Category` keeps its categories in a join table, and commission keeps them in a `category_ids` preference. The reason is what the array actually holds — matching walks *upward from the product* through `self_and_ancestors`, so a rule names only the categories an operator picked, never their descendants. A rate on "Electronics" is one id however deep the tree goes, and in practice nobody enumerates hundreds of categories or sellers into a single rule. Products stay in `spree_commission_rule_products` because a marketplace genuinely does name thousands.
- **A parent category covers everything beneath it, to any depth** (RESOLVED 2026-08-17). Matching the promotion rules' behavior, and for the same reason: a marketplace that sets a rate on "Electronics" and later gets a "Electronics → Cameras → Mirrorless" leaf must not have that leaf silently fall through to the catch-all because the catalog was reorganised. Verified to four levels, with a sibling branch correctly not matching.
- **Retiring a rate retires its rules, and keeps them readable** (RESOLVED 2026-08-17, shipped). `CommissionRule` and `CommissionRuleProduct` are `acts_as_paranoid`, so a soft-deleted rate's conditions are retired with it rather than deleted — and an edit that replaces a rule keeps the one it superseded. There is no restore UI for a rate any more than for a price list; soft delete exists to keep the historical picture, and a commission line is explained by the rule that matched it, so "why was this charged" has to stay answerable after the rule stops applying. This is a deliberate departure — no other rule model in core is paranoid — justified by commission lines being settlement records rather than configuration. Two consequences to keep: both uniqueness indexes constrain **live rows only** (partial on PostgreSQL/SQLite, a stored generated column on MySQL/MariaDB, verified against both), and `CommissionRate#rules=` identifies an incoming row against the rule of that kind the rate already carries, since clients send the whole set without ids and a blind build would collide with the live rule it was meant to replace.
-- **Commission rules → typed classes, not a polymorphic subject** (RESOLVED 2026-08-17, shipped; supersedes the original shape). A rule was `(subject_type, subject_id)`, which could only ever name a record: a price band, a channel, a promotional window were each a migration plus an edit to the matcher, and a third party could add nothing. It is now STI over `Spree.commission_rules`, matching `Spree::PriceRule` and `Spree::DeliveryMethodRule` — a rule carries its own configuration, declares it through `preference_schema`, and a new kind is a subclass and a registration. Matching semantics are unchanged: every rule must hold, and a rule naming several records means any of them, so the OR moved inside a rule and there is still no `match_policy`. Reference lists follow the house cardinality rule — vendors and categories as `normalize_id_preference` arrays, products in a join table — which also deleted the hand-rolled store check in the controller, since the preference writer scope-checks as it writes. The admin surface follows the delivery-method rules editor: `GET /commission_rates/rule_types` for discovery, one row per condition, a picker where the kind names records and its preference schema otherwise.
-- **Commission rule matching → every rule must hold (AND), a rule naming several records means any of them (OR)** (RESOLVED 2026-07-14, restated 2026-08-17 for the typed shape). Expresses plain lists and the vendor × category pairings today's Enterprise sells, with no `match_policy` knob; same semantics as the leading surveyed OSS engine, but precedence stays the operator's own ordering rather than implicit specificity. See Decision 4.
+- **Commission rules → typed classes, not a polymorphic subject** (RESOLVED 2026-08-17, shipped; supersedes the original shape). A rule was `(subject_type, subject_id)`, which could only ever name a record: a price band, a channel, a promotional window were each a migration plus an edit to the matcher, and a third party could add nothing. It is now STI over `Spree.commission_rules`, matching `Spree::PriceRule` and `Spree::DeliveryMethodRule` — a rule carries its own configuration, declares it through `preference_schema`, and a new kind is a subclass and a registration. Matching semantics are unchanged: every rule must hold, and a rule naming several records means any of them, so the OR moved inside a rule and there is still no `match_policy`. Reference lists follow the house cardinality rule — sellers and categories as `normalize_id_preference` arrays, products in a join table — which also deleted the hand-rolled store check in the controller, since the preference writer scope-checks as it writes. The admin surface follows the delivery-method rules editor: `GET /commission_rates/rule_types` for discovery, one row per condition, a picker where the kind names records and its preference schema otherwise.
+- **Commission rule matching → every rule must hold (AND), a rule naming several records means any of them (OR)** (RESOLVED 2026-07-14, restated 2026-08-17 for the typed shape). Expresses plain lists and the seller × category pairings today's Enterprise sells, with no `match_policy` knob; same semantics as the leading surveyed OSS engine, but precedence stays the operator's own ordering rather than implicit specificity. See Decision 4.
- **Commission on delivery revenue → `include_shipping` on the rate** (RESOLVED 2026-07-14). Per-rate flag, default off (legacy was items-only); a fulfillment-scoped `CommissionLine` (nullable `fulfillment_id`, exactly-one-of with `line_item_id`). Matches the surveyed OSS competitor (global-only there) and Amazon referral-fee behavior. See Decision 4.
- **Split payment record → `Spree::PaymentSplit` + `payments.order_group_id`** (RESOLVED 2026-07-14). One gateway payment on the group, one split row per child order; no cloned `Payment` rows. See Decision 5 + Design Details.
-- **Vendor teams → reuse `Role`/`RoleUser`/`Invitation` with `resource: vendor`** (RESOLVED 2026-07-14). The polymorphic rails already exist in core (Invitation's docstring names Vendor); no `VendorUser` model. See Vendor identity & teams.
+- **Seller teams → reuse `Role`/`RoleUser`/`Invitation` with `resource: seller`** (RESOLVED 2026-07-14). The polymorphic rails already exist in core (Invitation's docstring names Seller); no `SellerUser` model. See Seller identity & teams.
- **Parent representation → dedicated `Spree::OrderGroup`** (RESOLVED 2026-06-16). See Decision 8 + Design Details. Diverges from the legacy `parent_id`/`splitted` shape; requires the Enterprise backfill.
-- **Commission tax rate source → per-`CommissionRate` field, resolved through the `TaxProvider`** (RESOLVED 2026-06-16). Not a per-vendor `platform_fee_tax_rate` column (legacy) and not a bare per-market lookup. The rate carries its own commission-tax configuration with a sensible store default; the actual rate is resolved via `6.0-tax-provider.md` so it stays jurisdiction-correct. See Decision 3.
-- **Fund ledger → two levels: `Spree::VendorTransfer` (per-order, on-fulfillment) + `Spree::VendorPayout` (per-interval settlement), both generic in core + pluggable `PayoutProvider` (system no-op in core; basic StripeConnect with the monorepo Stripe gateway per the 2026-07-15 amendment, extended by Enterprise with the money operations)** (RESOLVED 2026-06-25). See Decision 9. Transfer credits the vendor balance on fulfillment; payout sweeps unsettled transfers into a scheduled bank settlement (transfers `belong_to` their payout — auditable). `vendor.balance(currency) = Σ completed transfers − Σ completed payouts` per currency. Splits the legacy gateway-namespaced transfer ledger (which conflated the two and outsourced settlement to Stripe) into core ledger + provider execution along the OSS/Enterprise seam.
+- **Commission tax rate source → per-`CommissionRate` field, resolved through the `TaxProvider`** (RESOLVED 2026-06-16). Not a per-seller `platform_fee_tax_rate` column (legacy) and not a bare per-market lookup. The rate carries its own commission-tax configuration with a sensible store default; the actual rate is resolved via `6.0-tax-provider.md` so it stays jurisdiction-correct. See Decision 3.
+- **Fund ledger → two levels: `Spree::SellerTransfer` (per-order, on-fulfillment) + `Spree::SellerPayout` (per-interval settlement), both generic in core + pluggable `PayoutProvider` (system no-op in core; basic StripeConnect with the monorepo Stripe gateway per the 2026-07-15 amendment, extended by Enterprise with the money operations)** (RESOLVED 2026-06-25). See Decision 9. Transfer credits the seller balance on fulfillment; payout sweeps unsettled transfers into a scheduled bank settlement (transfers `belong_to` their payout — auditable). `seller.balance(currency) = Σ completed transfers − Σ completed payouts` per currency. Splits the legacy gateway-namespaced transfer ledger (which conflated the two and outsourced settlement to Stripe) into core ledger + provider execution along the OSS/Enterprise seam.
- **Commission tax → one scalar on the line, in TaxLine's vocabulary** (RESOLVED 2026-08-17). `tax_amount` + `tax_rate` + `taxability_reason` + the seller's `country_code`/`state_code` on `Spree::CommissionLine`, with `Spree::CommissionTax` as the value object the resolver returns. Reusing `Spree::TaxLine` itself was rejected: its rows sum into the order total and are exposed on the buyer-facing `/orders/:id/tax_lines`, so a commission row there would overcharge the shopper and leak settlement data. Same shape, opposite side of the ledger — so the words are shared and the rows are not. See Decision 3.
- **Commission VAT base → net item price, VAT added on top of the fee** (RESOLVED 2026-06-25). For EU, commission is computed on the seller's **net (ex-VAT)** item price; the commission `tax_amount` (Decision 3) is then applied **on top of the commission** as a separate B2B service supply — the marketplace fee is a distinct taxable event from the consumer's item sale, so the two VATs never mix. The base toggle stays available for non-EU/edge merchants who genuinely want a gross base, but the EU default is net-base + fee-VAT. Shipped as **`tax_inclusive`** (2026-08-17), matching `Spree::Market#tax_inclusive` rather than the surveyed industry's `include_tax` — the flag says the commission base is tax-inclusive, which is the same adjective the rest of Spree already uses for a price that carries its tax. This makes the marketplace's commission invoice to the seller stand on its own (correct for EU invoicing + remittance).
-- **Store-credit/gift-card payout → payment-source-agnostic** (RESOLVED 2026-06-25). The `VendorTransfer` amount (which rolls up into the payout) is `(vendor's sale value) − (commission owed)`, **independent of how the customer paid**. Store credit / gift cards are the platform's funding concern, not the vendor's — the vendor is owed their full cut of the sale regardless. This **drops the legacy store-credit dual-basis** from the amount calculation; that branch existed only to reconcile the old store-credit funding model and does not belong in the payout basis. (The platform still tracks its own store-credit liability separately — that's orthogonal to what the vendor receives.)
+- **Store-credit/gift-card payout → payment-source-agnostic** (RESOLVED 2026-06-25). The `SellerTransfer` amount (which rolls up into the payout) is `(seller's sale value) − (commission owed)`, **independent of how the customer paid**. Store credit / gift cards are the platform's funding concern, not the seller's — the seller is owed their full cut of the sale regardless. This **drops the legacy store-credit dual-basis** from the amount calculation; that branch existed only to reconcile the old store-credit funding model and does not belong in the payout basis. (The platform still tracks its own store-credit liability separately — that's orthogonal to what the seller receives.)
- **Commission precedence → an operator-ordered list** (RESOLVED 2026-06-25 as integer priority; **reshaped 2026-08-17 to `acts_as_list`, shipped**). `CommissionRate` carries `position` (`acts_as_list scope: :store_id, add_new_at: :top`) and resolution walks it top-down, first match wins (Decision 4). The list on screen is the precedence, so reordering is dragging rather than assigning numbers; new rates land at the top so they take effect on creation instead of behind the catch-all. `Spree::Seeds::CommissionRates` puts one disabled marketplace-wide rate at the bottom, which yields the product > category > seller order merchants asked for without hardcoding a ladder. No specificity inference — a rate can name all three dimensions at once, so there is nothing to infer from.
- **Commission rate currency → required for fixed, ignored for percentage** (RESOLVED 2026-06-25). A `kind: 'fixed'` rate **must** carry a `currency` (a flat "2" is meaningless without one); a `kind: 'percentage'` rate ignores currency (10% applies in any currency). Enforced by a model validation: `validates :currency, presence: true, if: -> { kind == 'fixed' }`. See the `CommissionRate` model.
-- **Payout vs transfer trigger → transfer on-fulfillment, payout on-interval** (RESOLVED 2026-06-25). These are the two distinct events of Decision 9: a `VendorTransfer` becomes due **on-fulfillment** (the vendor earned it); a `VendorPayout` settles on the vendor's **scheduled interval** (`payouts_schedule_interval`). The earlier "on-ship vs on-deliver vs scheduled" framing was a category error — it conflated the two. Core's `system` provider honors `manual` settlement natively; Enterprise implements daily/weekly/biweekly/monthly.
+- **Payout vs transfer trigger → transfer on-fulfillment, payout on-interval** (RESOLVED 2026-06-25). These are the two distinct events of Decision 9: a `SellerTransfer` becomes due **on-fulfillment** (the seller earned it); a `SellerPayout` settles on the seller's **scheduled interval** (`payouts_schedule_interval`). The earlier "on-ship vs on-deliver vs scheduled" framing was a category error — it conflated the two. Core's `system` provider honors `manual` settlement natively; Enterprise implements daily/weekly/biweekly/monthly.
## Open Questions
-1. **Vendor-funded vs platform-funded promotions.** v1: discounts reduce the vendor's sale value (vendor-funded). Platform-funded promos ("we run a 10% site-wide sale and make vendors whole") need a funding flag on Promotion and a compensating ledger line — **post-6.0**. Unblocked by: a merchant asking for platform-funded campaigns once the ledger is live; the shape is a `funded_by` on Promotion + a positive `VendorTransfer` compensating row.
-2. **Vendor-scoped promotions** (a vendor creates promotions limited to its own products) — **post-6.0** (resolved 2026-08-15 as deferred). Shape when it lands: `spree_promotions.vendor_id` (nullable), a `/api/v3/vendor/promotions` endpoint on the vendor branch, and a rule guard that a vendor promotion only matches line items with the same `vendor_id`. Cheap on the single-store Promotion model; unblocked by the 6.0 headline scope shipping first.
+1. **Seller-funded vs platform-funded promotions.** v1: discounts reduce the seller's sale value (seller-funded). Platform-funded promos ("we run a 10% site-wide sale and make sellers whole") need a funding flag on Promotion and a compensating ledger line — **post-6.0**. Unblocked by: a merchant asking for platform-funded campaigns once the ledger is live; the shape is a `funded_by` on Promotion + a positive `SellerTransfer` compensating row.
+2. **Seller-scoped promotions** (a seller creates promotions limited to its own products) — **post-6.0** (resolved 2026-08-15 as deferred). Shape when it lands: `spree_promotions.seller_id` (nullable), a `/api/v3/seller/promotions` endpoint on the seller branch, and a rule guard that a seller promotion only matches line items with the same `seller_id`. Cheap on the single-store Promotion model; unblocked by the 6.0 headline scope shipping first.
## References
-- [spree/spree#13323](https://github.com/spree/spree/issues/13323) — "Open source Spree Multi Vendor for Spree 6" (the OSS/Enterprise scope split; amended 2026-07-15 — basic Stripe Connect execution moved to OSS, see `decisions.md`; the issue text needs a matching update).
-- Current Enterprise multi-vendor module (private source, actively maintained against Spree 5.4+): source-read for this port — the Vendor lifecycle, per-item commission + commission-VAT formula, parent/child split flow, Stripe transfer ledger + reversal chain, vendor-user permission baseline, and the settlement-statement report. **Internals (file paths, class/table names) are deliberately not cited in this public file** — the Enterprise repository holds the detailed port map. Public behavior cross-checked against the user docs (next bullet).
+- [spree/spree#13323](https://github.com/spree/spree/issues/13323) — "Open source Spree Multi Seller for Spree 6" (the OSS/Enterprise scope split; amended 2026-07-15 — basic Stripe Connect execution moved to OSS, see `decisions.md`; the issue text needs a matching update).
+- Current Enterprise multi-vendor module (private source, actively maintained against Spree 5.4+): source-read for this port — the Seller lifecycle, per-item commission + commission-VAT formula, parent/child split flow, Stripe transfer ledger + reversal chain, seller-user permission baseline, and the settlement-statement report. **Internals (file paths, class/table names) are deliberately not cited in this public file** — the Enterprise repository holds the detailed port map. Public behavior cross-checked against the user docs (next bullet).
- Surveyed modern open-source marketplace implementations (primary-source survey 2026-07-14; names and the detailed comparison deliberately kept out of this public file): source of the commission rule-engine shape (dimension-grouped matching, `percentage | fixed`, `include_tax`/`include_shipping`), the `OrderGroup` container pattern, and the payout-provider abstraction. **Framework-specific machinery NOT to copy:** big-number jsonb sidecar columns, remote-link join-table indirection (use Rails FKs + `has_many`), and external workflow/step engines (use Spree services + `publish_event`). The leading implementation's payout pipeline creates per-order payouts after capture and keeps no balance ledger and no reversal chain — Spree's two-level ledger is designed from scratch.
-- Current Enterprise behavior (user docs, spreecommerce.org/docs): `user/vendors/vendor-management` (lifecycle: Invited → Onboarding → Ready for Review → Approved/Rejected/Suspended; branding; onboarding checklist), `user/vendors/commission-rates` (product > vendor > marketplace-default ladder, category-vendor pairing), `user/vendors/vendor-payouts` (schedule intervals incl. bi-weekly + "use marketplace default"), `user/vendors/multi-vendor-checkout` (per-vendor delivery selection, suborder split, per-vendor tracking), `user/settings/marketplace` (default rate copied at invite, vendor ToS), `api-reference/storefront/vendors` (public vendor profile fields).
+- Current Enterprise behavior (user docs, spreecommerce.org/docs): `user/vendors/seller-management` (lifecycle: Invited → Onboarding → Ready for Review → Approved/Rejected/Suspended; branding; onboarding checklist), `user/vendors/commission-rates` (product > seller > marketplace-default ladder, category-seller pairing), `user/vendors/seller-payouts` (schedule intervals incl. bi-weekly + "use marketplace default"), `user/vendors/multi-vendor-checkout` (per-seller delivery selection, suborder split, per-seller tracking), `user/settings/marketplace` (default rate copied at invite, seller ToS), `api-reference/storefront/sellers` (public seller profile fields).
- Related plans: `6.0-cart-order-split.md`, `6.0-6.1-split-adjustments.md`, `6.0-order-routing.md`, `6.0-tax-provider.md`, `6.0-delivery-rate-provider.md`, `6.0-fulfillment-and-delivery.md`, `6.0-returns-exchanges-claims.md`, `6.0-inventory-operations.md` (Supplier disambiguation), `5.4-6.0-eu-legal-compliance.md`, `5.6-admin-spa-csv-import.md`, `6.0-admin-spa.md`, `6.0-admin-api.md`, `6.0-channels-catalogs-b2b.md` (B2B — deferred to 6.1, see `decisions.md`).
diff --git a/docs/plans/6.1-exchange-rates.md b/docs/plans/6.1-exchange-rates.md
index c3c98959f7..af131390bd 100644
--- a/docs/plans/6.1-exchange-rates.md
+++ b/docs/plans/6.1-exchange-rates.md
@@ -26,7 +26,7 @@ The boundary is the whole design: **rates suggest, they never compute a charge.*
5. **The provider follows the established registry shape**, copying `Spree.tax_providers` / `Spree.delivery_rate_providers` exactly — including the `before: :load_config_initializers` empty-array initializer and `.concat` (never `=`) for core's own entry. Credentials come from a `Spree::Integration` subclass declared through `self.integration_class`, so per-store availability is derived rather than hand-written.
-6. **ECB is the bundled default and needs no credentials.** No API key, no quota, no attribution, no vendor. Keyed commercial providers (Open Exchange Rates and the APILayer family) are extension gems.
+6. **ECB is the bundled default and needs no credentials.** No API key, no quota, no attribution, no seller. Keyed commercial providers (Open Exchange Rates and the APILayer family) are extension gems.
7. **No rounding-rule feature in 6.1.** Shopify needs rounding rules *because* it converts and must avoid €9.73 price tags. We hand a merchant a suggestion they then edit, so the human is the rounding rule. Revisit only if a bulk apply path lands (Phase 4).
diff --git a/docs/plans/6.1-order-change-substrate.md b/docs/plans/6.1-order-change-substrate.md
index 0b1689ab58..293d61fbad 100644
--- a/docs/plans/6.1-order-change-substrate.md
+++ b/docs/plans/6.1-order-change-substrate.md
@@ -88,11 +88,11 @@ The concrete pain it solves for us:
explicit that line items, fulfillments and totals live on the **children** —
the group holds only customer, payment and addresses. A change set mutates
exactly those child-owned rows, so it binds to the child order. Editing two
- vendors' items is two change sets, which is also the correct commercial
- answer: each vendor's balance settles against its own order. This keeps the
+ sellers' items is two change sets, which is also the correct commercial
+ answer: each seller's balance settles against its own order. This keeps the
partial unique index on `(order_id)` as designed, with no group-level
- variant. The cost is that a single admin edit spanning vendors is not one
- atomic operation — accepted, because a cross-vendor atomic edit would need a
+ variant. The cost is that a single admin edit spanning sellers is not one
+ atomic operation — accepted, because a cross-seller atomic edit would need a
distributed settle across N gateway captures, which the group cannot offer
either.
- **A pending change set does not hold stock** (RESOLVED 2026-08-10).
diff --git a/docs/plans/decisions.md b/docs/plans/decisions.md
index b3eeb39a9f..fb3818e3b2 100644
--- a/docs/plans/decisions.md
+++ b/docs/plans/decisions.md
@@ -1980,6 +1980,11 @@ Plan: `6.0-multi-vendor-marketplace.md`.
## 2026-07-14: `Spree::Vendor` = marketplace seller; procurement source renamed `Spree::Supplier`
+> **Superseded in part by 2026-08-17.** The *split* stands — the marketplace
+> seller and the procurement source are separate models — but the marketplace
+> model is now `Spree::Seller` (`sel_`, `spree_sellers`), not `Spree::Vendor`.
+> `Spree::Supplier` is unchanged.
+
Two 6.0 plans introduced a `Spree::Vendor`: the marketplace seller
(`6.0-multi-vendor-marketplace.md`, prefix `ven_`) and the purchase-order
procurement source (`6.0-inventory-operations.md`, prefix `vnd_`). Same class
@@ -3105,3 +3110,58 @@ Enterprise never forks core ledger code — it configures rows, it does not
override the basis service. **Consequences:** amends the marketplace plan's
Decision 9 note that facilitator mode is "not core" (the flag and the math
are; the policy is not). Plan: `6.0-multi-vendor-marketplace.md`.
+
+## 2026-08-17 — The marketplace seller is `Spree::Seller`; `Vendor` is retired
+
+Reverses the naming half of 2026-07-14. That entry gave the marketplace the
+`Vendor` name on two grounds, and by 2026-08-17 both were gone: the user docs'
+Vendors area is being rewritten wholesale for the 6.0 stable release, and there
+is no Enterprise production data to keep `ven_` continuity with. Nothing was
+released, so nothing had to be carried over — the migrations were edited in
+place rather than added to.
+
+**The decisive argument is Amazon's, and it is about the second party.** Spree
+models both a business selling *through* the marketplace and a supplier the
+merchant buys stock *from*. Amazon names those two relationships in opposite
+directions: Seller Central hosts third parties, Vendor Central buys from
+suppliers. So `vendor` was the single worst available word for a marketplace
+seller in a schema that also contains the supplier — every integrator with
+Amazon experience reads `vendor_id` as the procurement relationship. Shopify
+agrees by construction: when it built purchase orders it chose `supplier`.
+
+`Seller` also matches the buyers we are selling to. Gartner's category is
+"Enterprise Marketplaces" and its definition says "third-party sellers";
+Forrester's Wave criteria are "seller onboarding" and "seller compliance".
+Neither analyst firm uses "multi-vendor" for anything. VTEX (`sellerId`,
+`/sellers/`), Marketplacer (`Seller`), Amazon (`sellerId`) and Mercur
+(`seller`, `sel_`) all name the entity that way in public APIs. Mirakl is the
+one mixed case — its data entity is `shop_id` while its docs and API routing
+say seller — and its `shop` is a legacy artefact we have no reason to inherit.
+Spryker's `merchant` is the sole enterprise divergence, and "merchant" fits
+Spree badly since it most naturally means the store owner running the
+marketplace.
+
+**Scope:** `Spree::Seller`, `spree_sellers`, prefix `sel_`, `seller_id`,
+`current_seller`, `SellerMailer`, `read_sellers`/`write_sellers`, and all three
+API surfaces (store `/sellers` public profiles, admin `/sellers` operator CRUD,
+and the seller-facing `/api/v3/seller` branch). `Spree::Supplier` is unchanged
+and keeps the procurement source — 2026-07-14's *split* stands; only which word
+lands on which side changed.
+
+**Category naming, separately:** describe the product as a **marketplace**
+platform, not a "multi-vendor" one. Every platform leading with "multi-vendor"
+sits in the $29–$6,999 plugin tier (CS-Cart, Dokan, WCFM, Yo!Kart); every
+analyst-recognised vendor says "marketplace platform". Keep "multi-vendor
+marketplace" in SEO surfaces only — meta descriptions, comparison pages — which
+is exactly what Marketplacer does, capturing the search volume without letting
+the term define the positioning. Internal branch and plan filenames keep their
+`multi-vendor` prefixes for stable cross-references; this is positioning, not
+engineering.
+
+**Consequences:** `Rails`/Bundler `vendor/` directories, gemspec
+`{app,config,db,lib,vendor}` globs, the "vendor lock-in" idiom, and EasyPost's
+carrier-meaning "vendor" are all deliberately untouched — a blanket rename
+breaks CI and ships broken gems, and each of those was caught only by running
+the suites. `docs/user/vendors/` and the rest of the published documentation
+are **not** renamed here; they are part of the 6.0 stable docs overhaul. Plan:
+`6.0-multi-vendor-marketplace.md`.
diff --git a/packages/README.md b/packages/README.md
index cdc0ab7849..95178689f4 100644
--- a/packages/README.md
+++ b/packages/README.md
@@ -47,7 +47,7 @@ The Spree 6.0 admin is a three-package stack:
- **`@spree/dashboard-core`** — the framework. The four registries (table, nav, slot, settings-nav), the four providers (auth, permission, store, theme), generic infra hooks (`use-auth`, `use-permissions`, `use-resource-mutation`, `use-direct-upload`, `use-global-search`, …), the admin SDK client singleton, and the `defineDashboardPlugin` extension facade. **This is what plugin authors import** to register navigation, slots, table columns, and routes.
- **`@spree/dashboard`** — the deployable SPA. Routes, resource hooks (`use-orders`, `use-products`, `use-customers`, …), Zod schemas, locale strings, the app shell. Composes the other two. Built with Vite + TanStack Router (file-based) + TanStack Query + React Hook Form + Tailwind.
-Plugin authors install `@spree/dashboard-ui` + `@spree/dashboard-core` as peer dependencies. Vendor panels, white-label admins, and other custom variants compose the same packages with their own routes/shell.
+Plugin authors install `@spree/dashboard-ui` + `@spree/dashboard-core` as peer dependencies. Seller panels, white-label admins, and other custom variants compose the same packages with their own routes/shell.
Architecture, extension points (table registry, navigation registry, component injection), the package boundary rules, and the phased migration are documented in [`docs/plans/6.0-admin-spa.md`](../docs/plans/6.0-admin-spa.md). Local setup for the SPA is in [`packages/dashboard/README.md`](./dashboard/README.md).
diff --git a/packages/admin-sdk/CHANGELOG.md b/packages/admin-sdk/CHANGELOG.md
index 9c05b163d1..1cd19e1e16 100644
--- a/packages/admin-sdk/CHANGELOG.md
+++ b/packages/admin-sdk/CHANGELOG.md
@@ -132,7 +132,7 @@ This is the Admin API surface the 5.6 React Dashboard consumes — hosts install
- `client.taxCategories` gains `get / create / update / delete`. Backed by `/api/v3/admin/tax_categories`. The serializer now exposes `description` alongside `name`, `tax_code`, and `is_default`. Setting `is_default: true` on create or update auto-demotes the previous default.
- `client.stockItems` is new with `list / get / update / delete`. Adjust `count_on_hand` and `backorderable` on existing variant/location pairings. Stock items are auto-created when a variant lands at a stock location, so there's no `create` here — use the variants and stock-locations endpoints for that flow. Filterable via Ransack on `count_on_hand`, `stock_location_id`, and `variant_id`.
- - `client.stockTransfers` is new with `list / get / create / delete`. Backed by `/api/v3/admin/stock_transfers`. The create body takes a `variants: [{ variant_id, quantity }]` array; pass `source_location_id` for a transfer between two locations or omit it to record an external vendor receive at the destination. The model fans the payload out across `stock_movements` and adjusts source/destination `count_on_hand` atomically.
+ - `client.stockTransfers` is new with `list / get / create / delete`. Backed by `/api/v3/admin/stock_transfers`. The create body takes a `variants: [{ variant_id, quantity }]` array; pass `source_location_id` for a transfer between two locations or omit it to record an external seller receive at the destination. The model fans the payload out across `stock_movements` and adjusts source/destination `count_on_hand` atomically.
- `client.paymentMethods` gains `create / update / delete / types`. The create body requires `type` (the fully-qualified STI subclass, e.g. `'Spree::PaymentMethod::Check'`); unknown types return a 422 with `unknown_payment_method_type`. New payment methods are scoped to the current store automatically. The serializer now exposes `display_on` and `position` on top of the existing `name`, `description`, `type`, `active`, and `auto_capture`. `client.paymentMethods.types()` returns the registered subclasses as `[{ type, label, description }]` so admin UIs can render a provider dropdown without hard-coding class names.
Provider-specific configuration (Stripe API keys, PayPal credentials, etc.) is **not** part of this release — that lands with the universal preferences form in the next sprint.
diff --git a/packages/admin-sdk/examples/commission_rates/create.ts b/packages/admin-sdk/examples/commission_rates/create.ts
index d390df0730..ea3a40a4df 100644
--- a/packages/admin-sdk/examples/commission_rates/create.ts
+++ b/packages/admin-sdk/examples/commission_rates/create.ts
@@ -13,7 +13,7 @@ const commissionRate = await client.commissionRates.create({
name: 'Audio sellers',
kind: 'percentage',
value: 12.5,
- rules: [{ type: 'vendor_rule', preferences: { vendor_ids: ['ven_a1b2c3'] } }],
+ rules: [{ type: 'seller_rule', preferences: { seller_ids: ['sel_a1b2c3'] } }],
})
// endregion:example
diff --git a/packages/admin-sdk/examples/vendors/approve.ts b/packages/admin-sdk/examples/sellers/approve.ts
similarity index 64%
rename from packages/admin-sdk/examples/vendors/approve.ts
rename to packages/admin-sdk/examples/sellers/approve.ts
index b6d70e3411..9191e4dfc2 100644
--- a/packages/admin-sdk/examples/vendors/approve.ts
+++ b/packages/admin-sdk/examples/sellers/approve.ts
@@ -6,10 +6,10 @@ const client = createAdminClient({
})
// region:example
-// Also the way back for a vendor that was suspended or turned down — and it
+// Also the way back for a seller that was suspended or turned down — and it
// clears any holiday along with the suspension.
-const vendor = await client.vendors.approve('ven_UkLWZg9DAJ')
+const seller = await client.sellers.approve('sel_UkLWZg9DAJ')
// endregion:example
-export { vendor }
+export { seller }
diff --git a/packages/admin-sdk/examples/vendors/create.ts b/packages/admin-sdk/examples/sellers/create.ts
similarity index 69%
rename from packages/admin-sdk/examples/vendors/create.ts
rename to packages/admin-sdk/examples/sellers/create.ts
index 77f4727871..323c559055 100644
--- a/packages/admin-sdk/examples/vendors/create.ts
+++ b/packages/admin-sdk/examples/sellers/create.ts
@@ -6,13 +6,13 @@ const client = createAdminClient({
})
// region:example
-// The vendor starts as `pending` and has no team yet — invite someone to run
+// The seller starts as `pending` and has no team yet — invite someone to run
// it next.
-const vendor = await client.vendors.create({
+const seller = await client.sellers.create({
name: 'Northwind Books',
contact_email: '[email protected]',
})
// endregion:example
-export { vendor }
+export { seller }
diff --git a/packages/admin-sdk/examples/vendors/delete.ts b/packages/admin-sdk/examples/sellers/delete.ts
similarity index 69%
rename from packages/admin-sdk/examples/vendors/delete.ts
rename to packages/admin-sdk/examples/sellers/delete.ts
index 7d86976ce7..b1a37de5c7 100644
--- a/packages/admin-sdk/examples/vendors/delete.ts
+++ b/packages/admin-sdk/examples/sellers/delete.ts
@@ -6,7 +6,7 @@ const client = createAdminClient({
})
// region:example
-// Soft-deletes the vendor. Their products stay in the catalog without a
+// Soft-deletes the seller. Their products stay in the catalog without a
// seller rather than being deleted with them.
-await client.vendors.delete('ven_UkLWZg9DAJ')
+await client.sellers.delete('sel_UkLWZg9DAJ')
// endregion:example
diff --git a/packages/admin-sdk/examples/vendors/get.ts b/packages/admin-sdk/examples/sellers/get.ts
similarity index 71%
rename from packages/admin-sdk/examples/vendors/get.ts
rename to packages/admin-sdk/examples/sellers/get.ts
index 48ed553795..6da85f47ed 100644
--- a/packages/admin-sdk/examples/vendors/get.ts
+++ b/packages/admin-sdk/examples/sellers/get.ts
@@ -6,8 +6,8 @@ const client = createAdminClient({
})
// region:example
-const vendor = await client.vendors.get('ven_UkLWZg9DAJ')
+const seller = await client.sellers.get('sel_UkLWZg9DAJ')
// endregion:example
-export { vendor }
+export { seller }
diff --git a/packages/admin-sdk/examples/vendors/invite.ts b/packages/admin-sdk/examples/sellers/invite.ts
similarity index 54%
rename from packages/admin-sdk/examples/vendors/invite.ts
rename to packages/admin-sdk/examples/sellers/invite.ts
index dfa6e8922d..f1a4a922d5 100644
--- a/packages/admin-sdk/examples/vendors/invite.ts
+++ b/packages/admin-sdk/examples/sellers/invite.ts
@@ -6,12 +6,12 @@ const client = createAdminClient({
})
// region:example
-// They join the vendor's team when they accept, and can then sign in to the
-// vendor panel. Omit `role_id` for the vendor's own admin role.
-const vendor = await client.vendors.invite('ven_UkLWZg9DAJ', {
+// They join the seller's team when they accept, and can then sign in to the
+// seller panel. Omit `role_id` for the seller's own admin role.
+const seller = await client.sellers.invite('sel_UkLWZg9DAJ', {
})
// endregion:example
-export { vendor }
+export { seller }
diff --git a/packages/admin-sdk/examples/vendors/list.ts b/packages/admin-sdk/examples/sellers/list.ts
similarity index 68%
rename from packages/admin-sdk/examples/vendors/list.ts
rename to packages/admin-sdk/examples/sellers/list.ts
index ee65cf5091..7a3a629dbe 100644
--- a/packages/admin-sdk/examples/vendors/list.ts
+++ b/packages/admin-sdk/examples/sellers/list.ts
@@ -7,9 +7,9 @@ const client = createAdminClient({
// region:example
// `sellable` is the one to read for "can this seller be bought from" — an
-// approved vendor who is away answers false.
-const { data: vendors } = await client.vendors.list({ page: 1, limit: 25 })
+// approved seller who is away answers false.
+const { data: sellers } = await client.sellers.list({ page: 1, limit: 25 })
// endregion:example
-export { vendors }
+export { sellers }
diff --git a/packages/admin-sdk/examples/vendors/reject.ts b/packages/admin-sdk/examples/sellers/reject.ts
similarity index 63%
rename from packages/admin-sdk/examples/vendors/reject.ts
rename to packages/admin-sdk/examples/sellers/reject.ts
index a4b68c3166..051b9ad1ef 100644
--- a/packages/admin-sdk/examples/vendors/reject.ts
+++ b/packages/admin-sdk/examples/sellers/reject.ts
@@ -6,12 +6,12 @@ const client = createAdminClient({
})
// region:example
-// For an applicant who never traded. A vendor already selling is suspended
+// For an applicant who never traded. A seller already selling is suspended
// instead.
-const vendor = await client.vendors.reject('ven_UkLWZg9DAJ', {
+const seller = await client.sellers.reject('sel_UkLWZg9DAJ', {
reason: 'Incomplete paperwork',
})
// endregion:example
-export { vendor }
+export { seller }
diff --git a/packages/admin-sdk/examples/vendors/suspend.ts b/packages/admin-sdk/examples/sellers/suspend.ts
similarity index 64%
rename from packages/admin-sdk/examples/vendors/suspend.ts
rename to packages/admin-sdk/examples/sellers/suspend.ts
index f22203b96c..f7b806a2f0 100644
--- a/packages/admin-sdk/examples/vendors/suspend.ts
+++ b/packages/admin-sdk/examples/sellers/suspend.ts
@@ -6,12 +6,12 @@ const client = createAdminClient({
})
// region:example
-// Stops a trading vendor from selling. Their catalog and history stay, and
+// Stops a trading seller from selling. Their catalog and history stay, and
// approving reinstates them.
-const vendor = await client.vendors.suspend('ven_UkLWZg9DAJ', {
+const seller = await client.sellers.suspend('sel_UkLWZg9DAJ', {
reason: 'Counterfeit goods',
})
// endregion:example
-export { vendor }
+export { seller }
diff --git a/packages/admin-sdk/examples/vendors/update.ts b/packages/admin-sdk/examples/sellers/update.ts
similarity index 84%
rename from packages/admin-sdk/examples/vendors/update.ts
rename to packages/admin-sdk/examples/sellers/update.ts
index 7bbd0de097..d7fd8d3a6d 100644
--- a/packages/admin-sdk/examples/vendors/update.ts
+++ b/packages/admin-sdk/examples/sellers/update.ts
@@ -8,7 +8,7 @@ const client = createAdminClient({
// region:example
// `status` is not writable here: each move through the lifecycle is its own
// action, because each one does more than set a column.
-const vendor = await client.vendors.update('ven_UkLWZg9DAJ', {
+const seller = await client.sellers.update('sel_UkLWZg9DAJ', {
billing_email: '[email protected]',
payouts_schedule_interval: 'weekly',
minimum_payout_amount: '25.0',
@@ -16,4 +16,4 @@ const vendor = await client.vendors.update('ven_UkLWZg9DAJ', {
// endregion:example
-export { vendor }
+export { seller }
diff --git a/packages/admin-sdk/src/admin-client.ts b/packages/admin-sdk/src/admin-client.ts
index 17bd432007..e6539432a3 100644
--- a/packages/admin-sdk/src/admin-client.ts
+++ b/packages/admin-sdk/src/admin-client.ts
@@ -205,6 +205,11 @@ import type {
ReturnUpdateParams,
RoleCreateParams,
RoleUpdateParams,
+ SellerCreateParams,
+ SellerInviteParams,
+ SellerRejectParams,
+ SellerSuspendParams,
+ SellerUpdateParams,
SetupCountries,
SetupParams,
SetupStatus,
@@ -222,11 +227,6 @@ import type {
TrackingCarrierOption,
VariantCreateParams,
VariantUpdateParams,
- VendorCreateParams,
- VendorInviteParams,
- VendorRejectParams,
- VendorSuspendParams,
- VendorUpdateParams,
WebhookEndpointCreateParams,
WebhookEndpointDisableParams,
WebhookEndpointUpdateParams,
@@ -295,6 +295,7 @@ import type {
Return,
ReturnReason,
Role,
+ Seller,
StockItem,
StockLocation,
StockTransfer,
@@ -309,7 +310,6 @@ import type {
TranslatableResource,
TranslationBatchEntry,
Variant,
- Vendor,
WebhookDelivery,
WebhookEndpoint,
} from './types'
@@ -2359,53 +2359,53 @@ export class AdminClient {
// ============================================
/**
- * CRUD for `Spree::Vendor`, plus the lifecycle actions. Status is never
+ * CRUD for `Spree::Seller`, plus the lifecycle actions. Status is never
* writable through `update` — each transition is a workflow that also
- * sends mail and runs extension hooks, so moving a vendor by hand would
+ * sends mail and runs extension hooks, so moving a seller by hand would
* skip all of it.
*/
- readonly vendors = {
+ readonly sellers = {
list: (
params?: ListParams & Record<string, unknown>,
options?: RequestOptions,
- ): Promise<PaginatedResponse<Vendor>> =>
- this.request<PaginatedResponse<Vendor>>('GET', '/vendors', {
+ ): Promise<PaginatedResponse<Seller>> =>
+ this.request<PaginatedResponse<Seller>>('GET', '/sellers', {
...options,
params: params ? transformListParams(params) : undefined,
}),
- get: (id: string, params?: { expand?: string[] }, options?: RequestOptions): Promise<Vendor> =>
- this.request<Vendor>('GET', `/vendors/${id}`, {
+ get: (id: string, params?: { expand?: string[] }, options?: RequestOptions): Promise<Seller> =>
+ this.request<Seller>('GET', `/sellers/${id}`, {
...options,
params: getParams(params),
}),
- create: (params: VendorCreateParams, options?: RequestOptions): Promise<Vendor> =>
- this.request<Vendor>('POST', '/vendors', { ...options, body: params }),
+ create: (params: SellerCreateParams, options?: RequestOptions): Promise<Seller> =>
+ this.request<Seller>('POST', '/sellers', { ...options, body: params }),
- update: (id: string, params: VendorUpdateParams, options?: RequestOptions): Promise<Vendor> =>
- this.request<Vendor>('PATCH', `/vendors/${id}`, { ...options, body: params }),
+ update: (id: string, params: SellerUpdateParams, options?: RequestOptions): Promise<Seller> =>
+ this.request<Seller>('PATCH', `/sellers/${id}`, { ...options, body: params }),
delete: (id: string, options?: RequestOptions): Promise<void> =>
- this.request<void>('DELETE', `/vendors/${id}`, options),
+ this.request<void>('DELETE', `/sellers/${id}`, options),
- /** Opens the vendor's team to someone; they join when they accept. */
- invite: (id: string, params: VendorInviteParams, options?: RequestOptions): Promise<Vendor> =>
- this.request<Vendor>('POST', `/vendors/${id}/invite`, { ...options, body: params }),
+ /** Opens the seller's team to someone; they join when they accept. */
+ invite: (id: string, params: SellerInviteParams, options?: RequestOptions): Promise<Seller> =>
+ this.request<Seller>('POST', `/sellers/${id}/invite`, { ...options, body: params }),
- /** Lets the vendor trade — also the way back from suspended or rejected. */
- approve: (id: string, options?: RequestOptions): Promise<Vendor> =>
- this.request<Vendor>('PATCH', `/vendors/${id}/approve`, options),
+ /** Lets the seller trade — also the way back from suspended or rejected. */
+ approve: (id: string, options?: RequestOptions): Promise<Seller> =>
+ this.request<Seller>('PATCH', `/sellers/${id}/approve`, options),
suspend: (
id: string,
- params?: VendorSuspendParams,
+ params?: SellerSuspendParams,
options?: RequestOptions,
- ): Promise<Vendor> =>
- this.request<Vendor>('PATCH', `/vendors/${id}/suspend`, { ...options, body: params }),
+ ): Promise<Seller> =>
+ this.request<Seller>('PATCH', `/sellers/${id}/suspend`, { ...options, body: params }),
- reject: (id: string, params?: VendorRejectParams, options?: RequestOptions): Promise<Vendor> =>
- this.request<Vendor>('PATCH', `/vendors/${id}/reject`, { ...options, body: params }),
+ reject: (id: string, params?: SellerRejectParams, options?: RequestOptions): Promise<Seller> =>
+ this.request<Seller>('PATCH', `/sellers/${id}/reject`, { ...options, body: params }),
}
// ============================================
@@ -3960,7 +3960,7 @@ export class AdminClient {
/**
* Inventory movement between stock locations, or external → location for
* receives. Pass `source_location_id` for transfers; omit it to record a
- * vendor receive (external stock arriving at the destination).
+ * seller receive (external stock arriving at the destination).
*/
readonly stockTransfers = {
list: (
diff --git a/packages/admin-sdk/src/params.ts b/packages/admin-sdk/src/params.ts
index 947e6a04fa..8bea42eeeb 100644
--- a/packages/admin-sdk/src/params.ts
+++ b/packages/admin-sdk/src/params.ts
@@ -1113,7 +1113,7 @@ export interface StockItemUpdateParams {
}
export interface StockTransferCreateParams {
- /** Omit for a vendor receive (external stock arriving at the destination). */
+ /** Omit for a seller receive (external stock arriving at the destination). */
source_location_id?: string
destination_location_id: string
reference?: string
@@ -1351,17 +1351,17 @@ export interface CustomerGroupUpdateParams {
}
/**
- * A marketplace seller. `status` is absent by design — a vendor moves
+ * A marketplace seller. `status` is absent by design — a seller moves
* through its lifecycle via the invite/approve/suspend/reject actions,
* never through a plain update.
*/
-export interface VendorCreateParams {
+export interface SellerCreateParams {
name: string
/** URL-safe slug; derived from `name` when omitted. */
slug?: string
contact_email?: string | null
billing_email?: string | null
- /** Sanitized HTML — the vendor's public description. */
+ /** Sanitized HTML — the seller's public description. */
about?: string | null
/**
* Branding attachments. Pass an ActiveStorage signed id to set one, `null`
@@ -1370,22 +1370,22 @@ export interface VendorCreateParams {
logo?: string | null
square_logo?: string | null
cover_photo?: string | null
- tax_remittance?: 'vendor' | 'platform'
+ tax_remittance?: 'seller' | 'platform'
payouts_schedule_interval?: 'daily' | 'weekly' | 'biweekly' | 'monthly' | 'manual' | null
minimum_payout_amount?: string | number | null
- /** Set while the vendor is away: the catalog stays but stops selling. */
+ /** Set while the seller is away: the catalog stays but stops selling. */
holiday_mode_until?: string | null
/**
* Written as nested attributes, never by id — an address has no store of
* its own, so an id would reference a row belonging to someone else.
*/
- billing_address?: VendorAddressParams
- returns_address?: VendorAddressParams
+ billing_address?: SellerAddressParams
+ returns_address?: SellerAddressParams
metadata?: Record<string, unknown>
}
-/** The vendor's own billing / returns address. */
-export interface VendorAddressParams {
+/** The seller's own billing / returns address. */
+export interface SellerAddressParams {
first_name?: string
last_name?: string
company?: string
@@ -1401,19 +1401,19 @@ export interface VendorAddressParams {
label?: string
}
-export type VendorUpdateParams = Partial<VendorCreateParams>
+export type SellerUpdateParams = Partial<SellerCreateParams>
-export interface VendorInviteParams {
+export interface SellerInviteParams {
email: string
- /** A role the vendor owns; defaults to the vendor's own admin role. */
+ /** A role the seller owns; defaults to the seller's own admin role. */
role_id?: string
}
-export interface VendorSuspendParams {
+export interface SellerSuspendParams {
reason?: string
}
-export interface VendorRejectParams {
+export interface SellerRejectParams {
reason?: string
}
@@ -1422,7 +1422,7 @@ export interface VendorRejectParams {
*
* Every rule must hold for the rate to apply, and a rule naming several
* records means any of them — so "(Cameras OR Audio) AND that seller" is a
- * category rule holding two ids beside a vendor rule holding one. A rate with
+ * category rule holding two ids beside a seller rule holding one. A rate with
* no rules charges every sale.
*
* Kinds come from `commissionRates.ruleTypes()`; `preferences` are whatever
@@ -1432,7 +1432,7 @@ export interface VendorRejectParams {
export interface CommissionRuleDraft {
/** Present for an existing rule. Omit to create one. */
id?: string | null
- /** Wire shorthand for the kind — e.g. `vendor_rule`, `item_total_rule`. */
+ /** Wire shorthand for the kind — e.g. `seller_rule`, `item_total_rule`. */
type: string
/** Kind-specific configuration, coerced server-side by typed setters. */
preferences?: Record<string, unknown>
diff --git a/packages/admin-sdk/src/types/fulfillment-providers.ts b/packages/admin-sdk/src/types/fulfillment-providers.ts
index d3ca1b6dd8..df33f9a518 100644
--- a/packages/admin-sdk/src/types/fulfillment-providers.ts
+++ b/packages/admin-sdk/src/types/fulfillment-providers.ts
@@ -57,7 +57,7 @@ export interface DeliveryRateProviderOption {
* way, so a method stays configurable.
*/
service_catalog: DeliveryRateProviderCatalogEntry[]
- /** Why the services could not be listed (the vendor's own message), or null when they were. */
+ /** Why the services could not be listed (the seller's own message), or null when they were. */
service_catalog_error: string | null
}
diff --git a/packages/admin-sdk/src/types/generated/CommissionLine.ts b/packages/admin-sdk/src/types/generated/CommissionLine.ts
index 9295803d1f..4dd4f1b28e 100644
--- a/packages/admin-sdk/src/types/generated/CommissionLine.ts
+++ b/packages/admin-sdk/src/types/generated/CommissionLine.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 458c3be2c1f85f6dbee97956a9d5e6fc
+// Typelizer digest b44096b2a4042470c8d93126dc50d550
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
@@ -20,11 +20,11 @@ interface CommissionLine {
display_tax_amount: string;
display_total: string;
order_id: string;
- vendor_id: string;
+ seller_id: string;
line_item_id: string | null;
fulfillment_id: string | null;
commission_rate_id: string | null;
- vendor_name: string | null;
+ seller_name: string | null;
}
export default CommissionLine;
diff --git a/packages/admin-sdk/src/types/generated/LineItem.ts b/packages/admin-sdk/src/types/generated/LineItem.ts
index 9cebbd19f0..b38e6a302c 100644
--- a/packages/admin-sdk/src/types/generated/LineItem.ts
+++ b/packages/admin-sdk/src/types/generated/LineItem.ts
@@ -1,12 +1,12 @@
-// Typelizer digest 94357bcb9703c2facd4341dee36809e7
+// Typelizer digest 837c0a7ae6214a2fb38b5ee175018b7b
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {Vendor, OptionValue, DigitalLink, TaxLine, Variant, TaxCategory} from '@/types'
+import type {Seller, OptionValue, DigitalLink, TaxLine, Variant, TaxCategory} from '@/types'
interface LineItem {
id: string;
variant_id: string;
- vendor_id: string | null;
+ seller_id: string | null;
preorder: boolean;
preorder_ships_at: string | null;
quantity: number;
@@ -33,7 +33,7 @@ interface LineItem {
display_compare_at_amount: string | null;
compare_at_amount: string | null;
thumbnail_url: string | null;
- vendor?: Vendor;
+ seller?: Seller;
option_values: Array<OptionValue>;
digital_links: Array<DigitalLink>;
tax_lines?: Array<TaxLine>;
diff --git a/packages/admin-sdk/src/types/generated/Product.ts b/packages/admin-sdk/src/types/generated/Product.ts
index 6734c093bc..763afa06d1 100644
--- a/packages/admin-sdk/src/types/generated/Product.ts
+++ b/packages/admin-sdk/src/types/generated/Product.ts
@@ -1,7 +1,7 @@
-// Typelizer digest 918ef8a9517dcd21dcb5d6e8508810b3
+// Typelizer digest 29bda5ff7c563bdadd519d8c2aa8fe0c
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {Price, PriceHistory, Vendor, Media, Variant, OptionType, OptionValue, Category, CustomField, Collection, ProductPublication, Channel, ProductType} from '@/types'
+import type {Price, PriceHistory, Seller, Media, Variant, OptionType, OptionValue, Category, CustomField, Collection, ProductPublication, Channel, ProductType} from '@/types'
interface Product {
id: string;
@@ -25,8 +25,8 @@ interface Product {
tags: Array<string>;
price: Price | null;
original_price: Price | null;
- vendor_id: string | null;
- vendor?: Vendor;
+ seller_id: string | null;
+ seller?: Seller;
primary_media?: Media;
media?: Array<Media>;
variants?: Array<Variant>;
@@ -43,7 +43,7 @@ interface Product {
created_at: string;
updated_at: string;
delivery_profile_id: string | null;
- vendor_name: string | null;
+ seller_name: string | null;
product_type_id: string | null;
tax_category_id: string | null;
collections?: Array<Collection>;
diff --git a/packages/admin-sdk/src/types/generated/Vendor.ts b/packages/admin-sdk/src/types/generated/Seller.ts
similarity index 89%
rename from packages/admin-sdk/src/types/generated/Vendor.ts
rename to packages/admin-sdk/src/types/generated/Seller.ts
index 8ffeb65e53..018dbe7b3e 100644
--- a/packages/admin-sdk/src/types/generated/Vendor.ts
+++ b/packages/admin-sdk/src/types/generated/Seller.ts
@@ -1,9 +1,9 @@
-// Typelizer digest d9fe7d0005b809b85498721815a2bc36
+// Typelizer digest 0c251a8daa6abea01005b8f5d58413b5
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {Address} from '@/types'
-interface Vendor {
+interface Seller {
id: string;
name: string;
slug: string;
@@ -32,4 +32,4 @@ interface Vendor {
returns_address?: Address;
}
-export default Vendor;
+export default Seller;
diff --git a/packages/admin-sdk/src/types/generated/index.ts b/packages/admin-sdk/src/types/generated/index.ts
index 2bc08a8a68..2a6d8d1e7b 100644
--- a/packages/admin-sdk/src/types/generated/index.ts
+++ b/packages/admin-sdk/src/types/generated/index.ts
@@ -1,4 +1,4 @@
-// Typelizer digest fce9db0039332defec101f07c2aa4c2f
+// Typelizer digest c8dd0851774341fcf48344cc82e34046
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
export type { default as Address } from './Address'
@@ -79,6 +79,7 @@ export type { default as ReturnLineItem } from './ReturnLineItem'
export type { default as ReturnReason } from './ReturnReason'
export type { default as Return } from './Return'
export type { default as Role } from './Role'
+export type { default as Seller } from './Seller'
export type { default as SetupTask } from './SetupTask'
export type { default as State } from './State'
export type { default as StockItem } from './StockItem'
@@ -94,6 +95,5 @@ export type { default as TaxIdentifier } from './TaxIdentifier'
export type { default as TaxLine } from './TaxLine'
export type { default as TaxRate } from './TaxRate'
export type { default as Variant } from './Variant'
-export type { default as Vendor } from './Vendor'
export type { default as WebhookDelivery } from './WebhookDelivery'
export type { default as WebhookEndpoint } from './WebhookEndpoint'
diff --git a/packages/admin-sdk/src/types/index.ts b/packages/admin-sdk/src/types/index.ts
index 92f043d19f..742fc39006 100644
--- a/packages/admin-sdk/src/types/index.ts
+++ b/packages/admin-sdk/src/types/index.ts
@@ -89,6 +89,7 @@ export type { default as Return } from './generated/Return'
export type { default as ReturnLineItem } from './generated/ReturnLineItem'
export type { default as ReturnReason } from './generated/ReturnReason'
export type { default as Role } from './generated/Role'
+export type { default as Seller } from './generated/Seller'
export type { default as SetupTask } from './generated/SetupTask'
export type { default as State } from './generated/State'
export type { default as StockItem } from './generated/StockItem'
@@ -104,7 +105,6 @@ export type { default as TaxIdentifier } from './generated/TaxIdentifier'
export type { default as TaxLine } from './generated/TaxLine'
export type { default as TaxRate } from './generated/TaxRate'
export type { default as Variant } from './generated/Variant'
-export type { default as Vendor } from './generated/Vendor'
export type { default as WebhookDelivery } from './generated/WebhookDelivery'
export type { default as WebhookEndpoint } from './generated/WebhookEndpoint'
diff --git a/packages/cli/src/generated/admin-spec.json b/packages/cli/src/generated/admin-spec.json
index 961f4227b5..a0a82fdc04 100644
--- a/packages/cli/src/generated/admin-spec.json
+++ b/packages/cli/src/generated/admin-spec.json
@@ -1 +1 @@
-{"info":{"title":"Admin API","contact":{"name":"Spree Commerce","url":"https://spreecommerce.org","email":"[email protected]"},"description":"Spree Admin API v3 - Administrative API for managing products, orders, and store settings.\n\n## Authentication\n\nThe Admin API requires a secret API key passed in the `x-spree-api-key` header.\nSecret API keys can be generated in the Spree admin dashboard.\n\n## Response Format\n\nAll responses are JSON. List endpoints return paginated responses with `data` and `meta` keys.\nSingle resource endpoints return a flat JSON object.\n\n## Resource IDs\n\nEvery resource is identified by an opaque string ID (e.g. `prod_86Rf07xd4z`,\n`variant_k5nR8xLq`, `or_UkLWZg9DAJ`). Use these IDs everywhere — URL paths,\nrequest bodies, and Ransack filters all accept them directly.\n\n## Error Handling\n\nErrors return a consistent format:\n```json\n{\n \"error\": {\n \"code\": \"validation_error\",\n \"message\": \"Validation failed\",\n \"details\": { \"name\": [\"can't be blank\"] }\n }\n}\n```\n","version":"v3"},"paths":{"/api/v3/admin/auth/login":{"post":{"summary":"Login","tags":["Authentication"],"security":[{"api_key":[]}],"description":"Authenticates an admin user and returns a short-lived JWT access token.\nThe rotatable refresh token is set in an HttpOnly cookie — it is not\nincluded in the response body.\n\nThe `provider` field selects the authentication method. When omitted it\ndefaults to `email`, the built-in email/password login.\n\nTo authenticate against a third-party identity provider (Okta, Azure AD,\nGoogle Workspace SSO, a custom JWT issuer, SAML, etc.), send\n`{ \"provider\": \"<your_key>\", ... }` with the fields that provider\nrequires. The endpoint returns the same JWT regardless of which provider\nauthenticated the request. See\n[Custom API Authentication](https://spreecommerce.org/docs/developer/how-to/custom-api-authentication)\nfor the list of configured providers and their required fields.\n","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"login successful","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthResponse"}}}},"401":{"description":"invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"oneOf":[{"title":"EmailPasswordLogin","description":"Built-in email/password authentication (default when `provider` is omitted).","type":"object","properties":{"provider":{"type":"string","enum":["email"],"default":"email"},"email":{"type":"string","format":"email"},"password":{"type":"string"}},"required":["email","password"]},{"title":"ProviderLogin","description":"Provider-dispatched login. The `provider` key selects a configured\nauthentication provider; the remaining fields are forwarded to it.\nRequired fields depend on the provider — see\n[Custom API Authentication](https://spreecommerce.org/docs/developer/how-to/custom-api-authentication).\n","type":"object","properties":{"provider":{"type":"string","description":"Registered provider key (anything other than `email`).","not":{"enum":["email"]}}},"required":["provider"],"additionalProperties":true}]}}}}}},"/api/v3/admin/auth/refresh":{"post":{"summary":"Refresh token","tags":["Authentication"],"security":[{"api_key":[]}],"description":"Exchanges the HttpOnly refresh-token cookie for a new access JWT and a\nrotated refresh token cookie. No request body or Authorization header\nis required — the cookie alone authenticates the call.\n","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"refresh successful","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthResponse"}}}},"401":{"description":"missing or invalid refresh-token cookie","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/auth/logout":{"post":{"summary":"Logout","tags":["Authentication"],"security":[{"api_key":[]}],"description":"Revokes the refresh-token cookie, effectively logging the admin out.","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"logout successful"}}}},"/api/v3/admin/me":{"get":{"summary":"Get current admin user and permissions","tags":["Authentication"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the current admin user profile and a serialized list of permissions (CanCanCan rules). The SPA uses these to drive UI permission checks.","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"current admin user and permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update the current admin profile","tags":["Authentication"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Self-service update of the signed-in admin's own profile, such as their admin UI display language (`selected_locale`).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"profile updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"selected_locale":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"}}}}}}}},"/api/v3/admin/auth/password_resets":{"post":{"summary":"Request password reset","tags":["Authentication"],"security":[{"api_key":[]}],"description":"Requests a password reset email for an admin user. Always returns `202`\nwhether or not the email matches an account, to prevent enumeration.\n\n`redirect_url` is where the emailed link should point (the reset token\nis appended as a `token` query param). It must match one of the store's\nallowed origins — otherwise it is silently ignored and the server-side\ndefault is used. The email is delivered by Spree itself via the\n`admin_user.password_reset_requested` event; this event is never\nforwarded to webhook endpoints.\n","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"202":{"description":"reset requested","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"redirect_url":{"type":"string","description":"Must match an allowed origin of the store; ignored otherwise."}},"required":["email"]}}}}}},"/api/v3/admin/auth/password_resets/{id}":{"patch":{"summary":"Reset password","tags":["Authentication"],"security":[{"api_key":[]}],"description":"Consumes a password reset token (the `token` query param from the\nemailed link), sets the new password, and signs the admin in: the\nresponse carries a JWT access token and the rotatable refresh token is\nset in an HttpOnly cookie. The token is single-use — it invalidates as\nsoon as the password changes.\n","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","description":"The reset token from the emailed link","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"password reset","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthResponse"}}}},"422":{"description":"invalid or expired token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"password":{"type":"string"},"password_confirmation":{"type":"string"}},"required":["password","password_confirmation"]}}}}}},"/api/v3/admin/auth/setup":{"get":{"summary":"Check first-run setup availability","tags":["Authentication"],"description":"Reports whether first-run setup is still available — true only while\nthe installation has no admin user. Unauthenticated; the dashboard\nlogin page uses it to offer the setup screen.\n","responses":{"200":{"description":"setup status","content":{"application/json":{}}}}},"post":{"summary":"Complete first-run setup","tags":["Authentication"],"description":"Creates the first admin account and adopts the seeded store, authorized\nby the one-time setup token printed at install time (rotate it with\n`bin/rails spree:setup:token`). Issues a JWT access token and a\nrefresh-token cookie exactly like login. Returns 404 once any admin\nuser exists — the flow is closed permanently after setup.\n","parameters":[],"responses":{"200":{"description":"setup completed","content":{"application/json":{}}},"404":{"description":"setup not available","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["setup_token","email","password","country_code"],"properties":{"setup_token":{"type":"string","description":"One-time token from the install output."},"email":{"type":"string","format":"email"},"password":{"type":"string"},"password_confirmation":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"store_name":{"type":"string"},"country_code":{"type":"string","description":"ISO 3166-1 alpha-2 country the store sells from. Determines the default market, the warehouse, the delivery zones and the currency."},"locale":{"type":"string","description":"Storefront locale. Defaults to the country's own language."},"currency":{"type":"string","description":"ISO 4217 currency. Defaults to the country's own currency — pass one only when the store prices in something else."}}}}}}}},"/api/v3/admin/auth/setup/countries":{"get":{"summary":"List countries for first-run setup","tags":["Authentication"],"description":"Countries the store can be set up in, each with the currency and\nofficial languages derived from it. Unauthenticated, because the setup\nscreen runs before any credential exists. Returns 404 once any admin\nuser exists.\n","responses":{"200":{"description":"countries","content":{"application/json":{}}}}}},"/api/v3/admin/allowed_origins":{"get":{"summary":"List allowed origins","tags":["Allowed Origins"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the CORS allowlist for the current store. Each entry is a\nbare `scheme://host[:port]` permitted to call the admin API from a\nbrowser. Backs the `Rack::Cors` allowlist and the CSRF boundary of\nthe admin cookie session (see\n`docs/plans/5.5-admin-auth-cookie-refresh.md`).\n\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[origin_cont]","in":"query","required":false,"description":"Filter by origin (contains)","schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"allowed origins found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/AllowedOrigin"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create an allowed origin","tags":["Allowed Origins"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Adds an origin to the admin CORS allowlist. The value must be a bare\n`scheme://host[:port]` (no path, query, or fragment) and use `http` or\n`https`.\n\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"allowed origin created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AllowedOrigin"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"origin":{"type":"string"}},"required":["origin"]}}}}}},"/api/v3/admin/allowed_origins/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"Allowed origin ID","schema":{"type":"string"}}],"get":{"summary":"Get an allowed origin","tags":["Allowed Origins"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single allowed origin by prefixed ID.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"allowed origin found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AllowedOrigin"}}}},"404":{"description":"allowed origin not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update an allowed origin","tags":["Allowed Origins"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates an existing allowed origin.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"allowed origin updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AllowedOrigin"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"origin":{"type":"string"}}}}}}},"delete":{"summary":"Delete an allowed origin","tags":["Allowed Origins"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes an origin from the admin CORS allowlist. After deletion the\nadmin SPA running at that origin will no longer be able to call the\nadmin API from a browser.\n\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"204":{"description":"allowed origin deleted"}}}},"/api/v3/admin/api_keys":{"get":{"summary":"List API keys","tags":["API Keys"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns publishable and secret API keys for the current store. Secret keys are listed by `token_prefix` only — the plaintext token is delivered exactly once on create.\n\n**Required scope:** `read_api_keys` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"API keys found","content":{"application/json":{}}}}},"post":{"summary":"Create an API key","tags":["API Keys"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a publishable or secret API key. The plaintext token is included in the response **once** for secret keys; publishable keys expose their token on every read since they are intended for client-side use.\n\n**Required scope:** `write_api_keys` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"secret key created — plaintext token returned once","content":{"application/json":{}}},"422":{"description":"validation error","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name","key_type"],"properties":{"name":{"type":"string"},"key_type":{"type":"string","enum":["publishable","secret"]},"scopes":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/api_keys/{id}":{"get":{"summary":"Show an API key","tags":["API Keys"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_api_keys` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"API key found","content":{"application/json":{}}}}},"patch":{"summary":"Update an API key","tags":["API Keys"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Renames a key. `key_type` and `scopes` are fixed at creation — to change a key's authority, create a new key and revoke the old one.\n\n**Required scope:** `write_api_keys` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"API key renamed","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"}}}}}}},"delete":{"summary":"Delete an API key","tags":["API Keys"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_api_keys` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"API key deleted"}}}},"/api/v3/admin/api_keys/current":{"get":{"summary":"Describe the current API key","tags":["API Keys"],"security":[{"api_key":[]}],"description":"Returns the secret key that authenticated this request, including its live scopes. Useful to confirm a key's real, current authority. Only secret-key principals have a single key to describe.\n\n**Required scope:** none — any key can describe itself (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"current API key","content":{"application/json":{}}}}}},"/api/v3/admin/api_keys/{id}/revoke":{"patch":{"summary":"Revoke an API key","tags":["API Keys"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Marks the key revoked. Future requests using its token will fail; the row is preserved for audit.\n\n**Required scope:** `write_api_keys` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"API key revoked","content":{"application/json":{}}}}}},"/api/v3/admin/categories":{"get":{"summary":"List categories","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a paginated list of the store's categories (manual hierarchical taxons; rule-based collections are excluded).\n\n**Required scope:** `read_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., children, parent, ancestors).","schema":{"type":"string"}}],"responses":{"200":{"description":"categories found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Category"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Create a category","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a category. Nests under the parent when parent_id is given, otherwise creates a top-level category.\n\n**Required scope:** `write_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"category created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Category"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"parent_id":{"type":"string","description":"Prefixed ID of the parent category"},"description":{"type":"string"},"permalink":{"type":"string"},"meta_title":{"type":"string"},"meta_description":{"type":"string"},"meta_keywords":{"type":"string"}},"required":["name"]}}}}}},"/api/v3/admin/categories/{id}":{"get":{"summary":"Get a category","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single category by ID.\n\n**Required scope:** `read_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Category ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., children, parent, ancestors).","schema":{"type":"string"}}],"responses":{"200":{"description":"category found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Category"}}}},"404":{"description":"category not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a category","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a category.\n\n**Required scope:** `write_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Category ID","schema":{"type":"string"}}],"responses":{"200":{"description":"category updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Category"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"parent_id":{"type":"string","description":"Prefixed ID of the parent category"},"description":{"type":"string"},"permalink":{"type":"string"},"meta_title":{"type":"string"},"meta_description":{"type":"string"},"meta_keywords":{"type":"string"}}}}}}},"delete":{"summary":"Delete a category","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes a category and its descendants.\n\n**Required scope:** `write_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Category ID","schema":{"type":"string"}}],"responses":{"204":{"description":"category deleted"}}}},"/api/v3/admin/categories/{id}/reposition":{"patch":{"summary":"Reposition a category","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Moves a category to a new parent and/or index within the tree.\n\n**Required scope:** `write_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Category ID","schema":{"type":"string"}}],"responses":{"200":{"description":"category repositioned","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Category"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"new_parent_id":{"type":"string","description":"Prefixed ID of the new parent (omit for top level)"},"new_position":{"type":"integer","description":"0-based index among the new parent's children"}},"required":["new_position"]}}}}}},"/api/v3/admin/categories/{category_id}/products":{"get":{"summary":"List category products","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Products classified under the category, ordered by their classification position.\n\n**Required scope:** `read_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"category_id","in":"path","required":true,"description":"Category ID","schema":{"type":"string"}}],"responses":{"200":{"description":"products found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Product"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Add a product to a category","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Classifies a product under the category (appended to the end).\n\n**Required scope:** `write_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"category_id","in":"path","required":true,"description":"Category ID","schema":{"type":"string"}}],"responses":{"201":{"description":"product added","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"product_id":{"type":"string"}},"required":["product_id"]}}}}}},"/api/v3/admin/categories/{category_id}/products/{id}":{"delete":{"summary":"Remove a product from a category","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes a product from the category's manual classification.\n\n**Required scope:** `write_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"category_id","in":"path","required":true,"description":"Category ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}}],"responses":{"204":{"description":"product removed"}}}},"/api/v3/admin/categories/{category_id}/products/{id}/reposition":{"patch":{"summary":"Reposition a category product","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Moves a product to a new index among the category's products.\n\n**Required scope:** `write_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"category_id","in":"path","required":true,"description":"Category ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}}],"responses":{"204":{"description":"product repositioned"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"new_position":{"type":"integer","description":"0-based index among the category's products"}},"required":["new_position"]}}}}}},"/api/v3/admin/channels":{"get":{"summary":"List channels","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the channels configured for the current store.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"channels found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Channel"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Create a channel","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new channel on the current store. `code` is normalized to a\nURL-safe slug (`Point of Sale` → `point-of-sale`); when omitted it's\nderived from `name`.\n\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"channel created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"code":{"type":"string","description":"Slug — auto-derived from `name` when blank."},"active":{"type":"boolean","default":true},"default":{"type":"boolean","default":false},"preferred_order_routing_strategy":{"type":"string","nullable":true,"description":"Routing strategy class name. `null` inherits the store setting."},"preferred_storefront_access":{"type":"string","nullable":true,"enum":["public","prices_hidden","login_required"],"description":"Anonymous-visitor access posture. `null` inherits the store setting."},"preferred_guest_checkout":{"type":"boolean","nullable":true,"description":"Whether guests can check out without an account. `null` inherits the store setting."}}}}}}}},"/api/v3/admin/channels/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get a channel","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"channel found","content":{"application/json":{}}}}},"patch":{"summary":"Update a channel","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"channel updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"code":{"type":"string"},"active":{"type":"boolean"},"default":{"type":"boolean"},"preferred_order_routing_strategy":{"type":"string","nullable":true,"description":"Routing strategy class name. `null` inherits the store setting."},"preferred_storefront_access":{"type":"string","nullable":true,"enum":["public","prices_hidden","login_required"],"description":"Anonymous-visitor access posture. `null` inherits the store setting."},"preferred_guest_checkout":{"type":"boolean","nullable":true,"description":"Whether guests can check out without an account. `null` inherits the store setting."}}}}}}},"delete":{"summary":"Delete a channel","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"channel deleted"}}}},"/api/v3/admin/channels/{id}/add_products":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"post":{"summary":"Publish products on a channel","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Publishes the listed products on this channel. Idempotent — re-publishing\nan already-published product updates its publication window. Products from\nsibling stores are silently dropped.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products published","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["product_ids"],"properties":{"product_ids":{"type":"array","items":{"type":"string"}},"published_at":{"type":"string","format":"date-time","nullable":true,"description":"When the publications go live. `null` means immediately."},"unpublished_at":{"type":"string","format":"date-time","nullable":true,"description":"When the publications come down. `null` means never."}}}}}}}},"/api/v3/admin/channels/{id}/remove_products":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"post":{"summary":"Unpublish products from a channel","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Unpublishes the listed products from this channel.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products unpublished","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["product_ids"],"properties":{"product_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/channels/{channel_id}/order_routing_rules":{"parameters":[{"name":"channel_id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"List order routing rules for a channel","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the channel's routing rules in priority order. The rules engine walks them top-down; see the Order Routing guide.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"rules found","content":{"application/json":{}}}}},"post":{"summary":"Create an order routing rule on a channel","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Adds a rule to the channel's routing list. The `type` is the wire shorthand from `GET /order_routing_rules/types` (e.g. `preferred_location`). Omitting `position` appends the rule at the end of the list. Each rule kind can appear at most once per channel — a duplicate `type` is rejected with a validation error.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"rule created","content":{"application/json":{}}},"422":{"description":"unknown rule type","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"active":{"type":"boolean"},"position":{"type":"integer"},"preferences":{"type":"object","additionalProperties":true}},"required":["type"]}}}}}},"/api/v3/admin/channels/{channel_id}/order_routing_rules/{id}":{"parameters":[{"name":"channel_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"summary":"Update an order routing rule","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a rule's `active` flag, `position` (the list reorders around it), or `preferences`. The rule kind cannot be changed — delete and re-create instead.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"rule updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"active":{"type":"boolean"},"position":{"type":"integer"},"preferences":{"type":"object","additionalProperties":true}}}}}}},"delete":{"summary":"Delete an order routing rule","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"rule deleted"}}}},"/api/v3/admin/order_routing_rules/types":{"get":{"summary":"List available order routing rule types","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Enumerates the registered rule kinds with their labels, descriptions and preference schemas — drives the \"Add rule\" picker in the admin dashboard. Plugins extend the list by registering `Spree::OrderRoutingRule` subclasses via `Spree.order_routing.rules`.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"types found","content":{"application/json":{}}}}}},"/api/v3/admin/custom_field_definitions":{"get":{"summary":"List custom field definitions","tags":["Custom Fields"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns all defined custom fields. Filter by `?q[resource_type_eq]=Spree::Product` to narrow to one parent type.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand. Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., key,label,field_type). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"definitions returned","content":{"application/json":{}}}}},"post":{"summary":"Create a custom field definition","tags":["Custom Fields"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"definition created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["key","field_type","resource_type"],"properties":{"namespace":{"type":"string","description":"Defaults to `custom`"},"key":{"type":"string"},"label":{"type":"string","description":"Human-readable name; defaults to titleized `key`"},"field_type":{"type":"string","description":"Custom field type identifier (one of the registered field-type class names)."},"resource_type":{"type":"string","description":"Owner class, e.g. `Spree::Product`"},"storefront_visible":{"type":"boolean","description":"When false, the definition is admin-only and never exposed in the Store API"},"searchable":{"type":"boolean","description":"When true, values are included in storefront product text search"},"sortable":{"type":"boolean","description":"When true, storefront product listings can sort by this field"}}}}}}}},"/api/v3/admin/custom_field_definitions/{id}":{"get":{"summary":"Show a custom field definition","tags":["Custom Fields"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand. Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., key,label,field_type). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"definition found","content":{"application/json":{}}}}},"patch":{"summary":"Update a custom field definition","tags":["Custom Fields"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"definition updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string"},"storefront_visible":{"type":"boolean"},"searchable":{"type":"boolean"},"sortable":{"type":"boolean"}}}}}}},"delete":{"summary":"Delete a custom field definition","tags":["Custom Fields"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes the definition and cascades to all custom field values referencing it.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"definition deleted"}}}},"/api/v3/admin/customer_groups":{"get":{"summary":"List customer groups","tags":["Customer Groups"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the customer groups configured for the current store. Groups\nsegment customers for targeted promotions (see the `customer_group`\npromotion rule) and reporting. The list endpoint never embeds the\nmember list — fetch a single group with `?expand=customers` if you\nneed them inline, or query `/admin/customers?customer_group_id_in=…`\nfor paginated membership.\n\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"description":"Filter by name (contains)","schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"customer groups found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CustomerGroup"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a customer group","tags":["Customer Groups"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a customer group in the current store. `customer_ids` is\noptional; when present, customers are attached at create time.\nPass prefixed IDs (e.g. `cus_…`) — the server decodes them\nautomatically.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"customer group created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerGroup"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"customer_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/customer_groups/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"Customer group prefixed ID","schema":{"type":"string"}}],"get":{"summary":"Get a customer group","tags":["Customer Groups"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single customer group. Pass `?expand=customers` to embed\nthe full member list inline (recommended only for single-record\nreads — embed cost scales with membership size).\n\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to embed. Supported: `customers`.","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"customer group with embedded customers","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerGroup"}}}},"404":{"description":"customer group not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a customer group","tags":["Customer Groups"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates name, description, or membership. `customer_ids` is a\nfull-set replacement — the server reconciles the membership to\nmatch the array, adding new IDs and removing ones not present.\nSend `customer_ids: []` to clear all members.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"customer group updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerGroup"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"customer_ids":{"type":"array","items":{"type":"string"}}}}}}}},"delete":{"summary":"Delete a customer group","tags":["Customer Groups"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes the group. Member users are not deleted; their `customer_group_users` rows are dropped.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"customer group deleted"}}}},"/api/v3/admin/customers/{customer_id}/addresses":{"get":{"summary":"List customer addresses","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the customer's saved addresses.\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., country, state). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., first_name,last_name,address1,city). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"addresses found","content":{"application/json":{}}}}},"post":{"summary":"Create a customer address","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Adds a new address to the customer's address book. Pass `is_default_billing: true` or `is_default_shipping: true` to set as the default — the previous default loses its flag in the same transaction.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"address created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"address1":{"type":"string"},"address2":{"type":"string"},"city":{"type":"string"},"postal_code":{"type":"string"},"country_code":{"type":"string","description":"ISO-2 country code (e.g. US)"},"state_code":{"type":"string","description":"State/province abbreviation (e.g. NY)"},"phone":{"type":"string"},"company":{"type":"string"},"label":{"type":"string"},"is_default_billing":{"type":"boolean"},"is_default_shipping":{"type":"boolean"}}}}}}}},"/api/v3/admin/customers/{customer_id}/addresses/{id}":{"patch":{"summary":"Update a customer address","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a customer address.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"address updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"city":{"type":"string"},"is_default_billing":{"type":"boolean"},"is_default_shipping":{"type":"boolean"}}}}}}},"delete":{"summary":"Delete a customer address","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes the address. If it was a default, the customer loses that default (no auto-promotion).\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"address deleted"}}}},"/api/v3/admin/customers/{customer_id}/credit_cards":{"get":{"summary":"List customer credit cards","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the customer's saved credit cards. Useful for off-session admin charges via `POST /admin/orders/:id/payments { source_id }`.\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., payment_method). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., brand,last4,month,year). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"credit cards found","content":{"application/json":{}}}}}},"/api/v3/admin/customers/{customer_id}/credit_cards/{id}":{"get":{"summary":"Show a customer credit card","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a saved credit card by ID.\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., payment_method). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., brand,last4,month,year). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"credit card found","content":{"application/json":{}}}}},"delete":{"summary":"Delete a customer credit card","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes a saved credit card.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"credit card deleted"}}}},"/api/v3/admin/customers/{customer_id}/store_credits":{"get":{"summary":"List customer store credits","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns store credits issued to the customer.\n\n**Required scope:** `read_store_credits` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., category, store, created_by). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., amount,amount_used,memo,currency). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"store credits found","content":{"application/json":{}}}}},"post":{"summary":"Issue a store credit to a customer","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"`created_by` is set automatically from the authenticated admin.\n\n**Required scope:** `write_store_credits` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"store credit created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["amount","currency","category_id"],"properties":{"amount":{"type":"string"},"currency":{"type":"string"},"category_id":{"type":"string","description":"StoreCreditCategory ID"},"memo":{"type":"string"}}}}}}}},"/api/v3/admin/customers/{customer_id}/store_credits/{id}":{"patch":{"summary":"Update a store credit","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Update memo / category / amount. The amount can only be changed if `amount_used == 0`.\n\n**Required scope:** `write_store_credits` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"store credit updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"amount":{"type":"string"},"category_id":{"type":"string"},"memo":{"type":"string"}}}}}}},"delete":{"summary":"Delete a store credit","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes an unused store credit (amount_used == 0). Returns 422 otherwise.\n\n**Required scope:** `write_store_credits` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"store credit deleted"}}}},"/api/v3/admin/customers":{"get":{"summary":"List customers","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a paginated list of customers. Supports Ransack search/filters.\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"q[search]","in":"query","required":false,"description":"Email + name full-text-ish search","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., addresses, store_credits). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., email,first_name,last_name). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"customers found","content":{"application/json":{}}}}},"post":{"summary":"Create a customer","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a customer. No welcome email is sent automatically.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"customer created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"phone":{"type":"string"},"accepts_email_marketing":{"type":"boolean"},"internal_note":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"metadata":{"type":"object"}}}}}}}},"/api/v3/admin/customers/{id}":{"get":{"summary":"Show a customer","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns full customer details including computed order stats (orders_count, total_spent, last_order_completed_at).\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Customer ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations: addresses, orders, store_credits, default_billing_address, default_shipping_address","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., email,first_name,last_name). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"customer found","content":{"application/json":{}}}}},"patch":{"summary":"Update a customer","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates customer attributes. `tags` replaces the full set.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"customer updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"phone":{"type":"string"},"accepts_email_marketing":{"type":"boolean"},"internal_note":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"metadata":{"type":"object"}}}}}}},"delete":{"summary":"Delete a customer","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes a customer. Returns 422 if the customer has any orders.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"customer deleted"}}}},"/api/v3/admin/customers/bulk_add_to_groups":{"post":{"summary":"Bulk-add customers to groups","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Attaches each customer in `ids` to every group in `customer_group_ids`.\nIdempotent — customers already in a group are skipped server-side.\nGroups from sibling stores are silently ignored. Returns counts of\ncustomers and groups that were processed (post store-scoping).\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"customers added to groups","content":{"application/json":{"schema":{"type":"object","properties":{"customer_count":{"type":"integer"},"customer_group_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","customer_group_ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"customer_group_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/customers/bulk_remove_from_groups":{"post":{"summary":"Bulk-remove customers from groups","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Detaches each customer in `ids` from every group in `customer_group_ids`.\nNo-op for non-members. Groups from sibling stores are silently ignored.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"customers removed from groups","content":{"application/json":{"schema":{"type":"object","properties":{"customer_count":{"type":"integer"},"customer_group_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","customer_group_ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"customer_group_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/customers/bulk_add_tags":{"post":{"summary":"Bulk-add tags to customers","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Adds each tag name in `tags` to every customer in `ids`. Tags are\nupserted by name; re-adding an existing tag is a no-op.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"tags added","content":{"application/json":{"schema":{"type":"object","properties":{"customer_count":{"type":"integer"},"tag_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","tags"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/customers/bulk_remove_tags":{"post":{"summary":"Bulk-remove tags from customers","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes each tag name in `tags` from every customer in `ids`. No-op\nfor customers that don't carry the tag.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"tags removed","content":{"application/json":{"schema":{"type":"object","properties":{"customer_count":{"type":"integer"},"tag_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","tags"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/exports":{"get":{"summary":"List exports","tags":["Exports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns CSV exports queued or completed for the current store. Polled by the admin SPA to detect when an export finishes (`done: true`).\n\n**Required scope:** the read scope of the exported resource — `read_products` for product exports, `read_customers` for customer exports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"exports found","content":{"application/json":{}}}}},"post":{"summary":"Create an export","tags":["Exports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Queues a CSV export. The `type` selects the dataset; `search_params` is an\noptional Ransack query (same shape used by the `q[...]` params on list endpoints)\nthat filters which records are exported. Pass `record_selection: \"all\"` to\nclear the filter server-side and export everything in scope.\n\nGeneration is asynchronous. Poll `GET /admin/exports/{id}` until `done` is `true`,\nthen redirect the browser to `download_url` to fetch the file.\n\n\n**Required scope:** the read scope of the exported resource — `read_products` for product exports, `read_customers` for customer exports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"export queued","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["products","orders","customers","product_translations","gift_cards","coupon_codes","newsletter_subscribers"]},"record_selection":{"type":"string","enum":["filtered","all"],"description":"Set to \"all\" to ignore search_params and export everything in scope."},"search_params":{"type":"object","description":"Ransack query hash. Same predicates accepted by the list endpoint.","additionalProperties":true},"results_url":{"type":"string","description":"Absolute URL of your admin exports view; the export-done email uses it as the download button target. Only honored when it matches one of the store's configured allowed origins."}}}}}}}},"/api/v3/admin/exports/{id}":{"get":{"summary":"Show an export","tags":["Exports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns export status. While `done` is `false`, the SPA continues polling.\n\n**Required scope:** the read scope of the exported resource — `read_products` for product exports, `read_customers` for customer exports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"export found","content":{"application/json":{}}}}},"delete":{"summary":"Delete an export","tags":["Exports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes the export and purges its attachment.\n\n**Required scope:** the read scope of the exported resource — `read_products` for product exports, `read_customers` for customer exports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"export deleted"}}}},"/api/v3/admin/exports/{id}/download":{"get":{"summary":"Download an export","tags":["Exports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Streams the exported CSV with `Content-Disposition: attachment`. Returns 422 with `code: export_not_ready` while `done` is still `false`. The endpoint is JWT/API-key protected, so SPA clients must fetch it (with `Authorization` header) and trigger the browser download via a Blob URL — a top-level navigation cannot carry the JWT.\n\n**Required scope:** the read scope of the exported resource — `read_products` for product exports, `read_customers` for customer exports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"CSV file","content":{"application/json":{},"text/csv":{"schema":{"type":"string","format":"binary"}}}}}}},"/api/v3/admin/orders/{order_id}/fulfillments":{"get":{"summary":"List fulfillments","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns all shipments for an order.\n\n**Required scope:** `read_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., inventory_units, stock_location, shipping_rates). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., number,status,tracking,cost). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"fulfillments found","content":{"application/json":{}}}}},"post":{"summary":"Create a fulfillment","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Manually creates a fulfillment on a completed order, bypassing order routing — for example to mirror a shipment handled by an external carrier or 3PL. Moves the requested line item quantities out of their current fulfillments; when `items` is omitted, every not-yet-shipped unit is moved. Pass `status: 'shipped'` to register an already-shipped fulfillment (fires shipped webhooks and freezes cost/carrier). When `delivery_method_id` is omitted, the fulfillment inherits the delivery method and cost of the source fulfillment(s) it fully drains — keeping the order total unchanged; partially drained splits get no carrier when shipped, and pending fulfillments are otherwise (re)priced by the standard rate engine, which selects the lowest-cost available rate. Pass `cost` to set an explicit shipping cost instead (e.g. the 3PL price) — note this changes the order total and payment state, and is guaranteed to persist only with `status: 'shipped'` (pending fulfillments are re-priced by the rate engine).\n\n**Required scope:** `write_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"201":{"description":"fulfillment created","content":{"application/json":{}}},"422":{"description":"order not completed","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["stock_location_id"],"properties":{"stock_location_id":{"type":"string","description":"Stock location the fulfillment ships from"},"tracking":{"type":"string","description":"Carrier tracking number, or a full https:// tracking link — a full URL is served back as tracking_url unchanged instead of being templated into the delivery method tracking URL"},"delivery_method_id":{"type":"string","description":"Delivery method (carrier) to attach as the selected rate. Defaults to the delivery method of the fully drained source fulfillment(s)"},"cost":{"type":"string","description":"Explicit shipping cost. Defaults to the summed cost of the fully drained source fulfillment(s), which keeps the order total unchanged; an explicit cost changes the order total and payment state. Guaranteed to persist only with status: 'shipped' — pending fulfillments are re-priced by the rate engine"},"status":{"type":"string","enum":["shipped"],"description":"Pass 'shipped' to register the fulfillment as already shipped"},"items":{"type":"array","description":"Line item quantities to fulfill. Omit to fulfill every not-yet-shipped unit.","items":{"type":"object","required":["item_id","quantity"],"properties":{"item_id":{"type":"string","description":"Line item ID"},"quantity":{"type":"integer"}}}},"metadata":{"type":"object","additionalProperties":true}}}}}}}},"/api/v3/admin/orders/{order_id}/fulfillments/{id}":{"get":{"summary":"Show a shipment","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns details of a specific shipment.\n\n**Required scope:** `read_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Fulfillment ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., inventory_units, stock_location, shipping_rates). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., number,status,tracking,cost). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"shipment found","content":{"application/json":{}}}}},"patch":{"summary":"Update a shipment","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a fulfillment (tracking, delivery rate).\n\n**Required scope:** `write_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Fulfillment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"shipment updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"tracking":{"type":"string","description":"Carrier tracking number, or a full https:// tracking link served back as tracking_url unchanged"},"selected_delivery_rate_id":{"type":"string","description":"Delivery rate ID (dr_...) to select"}}}}}}}},"/api/v3/admin/orders/{order_id}/fulfillments/{id}/fulfill":{"patch":{"summary":"Fulfill a fulfillment","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Marks a fulfillment as fulfilled.\n\n**Required scope:** `write_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Fulfillment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"fulfillment fulfilled","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{order_id}/fulfillments/{id}/purchase_label":{"patch":{"summary":"Buy the shipping label","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Buys the shipping label for a parcel that has not shipped yet — print it, pack the box, then mark the fulfillment fulfilled. Only delivery methods whose provider produces labels accept this.\n\n**Required scope:** `write_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Fulfillment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"label purchased","content":{"application/json":{}}},"422":{"description":"provider does not produce labels","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{order_id}/fulfillments/{id}/mark_delivered":{"patch":{"summary":"Mark a fulfillment delivered","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Records that the customer received the goods. Only a fulfilled shipment can be marked delivered.\n\n**Required scope:** `write_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Fulfillment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"fulfillment delivered","content":{"application/json":{}}},"422":{"description":"fulfillment has not shipped","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"delivered_at":{"type":"string","format":"date-time","description":"When the goods arrived. Defaults to now."},"notify_customer":{"type":"boolean","description":"Whether the customer gets a delivery notification. Defaults to true."}}}}}}}},"/api/v3/admin/orders/{order_id}/fulfillments/{id}/cancel":{"patch":{"summary":"Cancel a fulfillment","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Cancels a fulfillment.\n\n**Required scope:** `write_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Fulfillment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"fulfillment canceled","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{order_id}/fulfillments/{id}/resume":{"patch":{"summary":"Resume a fulfillment","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Resumes a canceled fulfillment.\n\n**Required scope:** `write_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Fulfillment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"fulfillment resumed","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{order_id}/fulfillments/{id}/split":{"patch":{"summary":"Split a fulfillment","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Transfers items from this shipment to a new shipment at a different stock location.\n\n**Required scope:** `write_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Fulfillment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"fulfillment split","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["variant_id","quantity"],"properties":{"variant_id":{"type":"string","description":"Variant ID"},"quantity":{"type":"integer"},"stock_location_id":{"type":"string","description":"Target stock location ID"}}}}}}}},"/api/v3/admin/gift_card_batches":{"get":{"summary":"List gift card batches","tags":["Gift Cards"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the gift card batches issued by the current store. Each batch\ngroups the cards generated together for a campaign or bulk-issuance\n— the cards themselves live under `/admin/gift_cards` and reference\nthe batch via `gift_card_batch_id`.\n\n\n**Required scope:** `read_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Records per page","schema":{"type":"integer"}},{"name":"q[prefix_cont]","in":"query","required":false,"description":"Filter by prefix (contains)","schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending.","schema":{"type":"string"}}],"responses":{"200":{"description":"gift card batches found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/GiftCardBatch"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Create a gift card batch","tags":["Gift Cards"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Issues a batch of gift cards in a single call. The server generates\n`codes_count` cards inline for small batches (configurable via\n`Spree.config.gift_card_batch_web_limit`, default 500) or enqueues\na background job for larger ones. Each card's code is the batch\n`prefix` followed by random hex.\n\n\n**Required scope:** `write_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"gift card batch created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GiftCardBatch"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["prefix","amount","codes_count"],"properties":{"prefix":{"type":"string","description":"Lowercased and prepended to every generated code."},"amount":{"type":"string","description":"Decimal amount per card, greater than zero."},"currency":{"type":"string","description":"ISO 4217 currency code. Defaults to the store currency."},"codes_count":{"type":"integer","description":"Number of cards to generate. Capped at `gift_card_batch_limit`."},"expires_at":{"type":"string","nullable":true}}}}}}}},"/api/v3/admin/gift_card_batches/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"Gift card batch prefixed ID","schema":{"type":"string"}}],"get":{"summary":"Get a gift card batch","tags":["Gift Cards"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single batch.\n\n**Required scope:** `read_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"gift card batch found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GiftCardBatch"}}}},"404":{"description":"gift card batch not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/gift_cards":{"get":{"summary":"List gift cards","tags":["Gift Cards"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the gift cards issued by the current store. Filter by\n`q[code_cont]` for code search, `q[user_id_eq]` for cards issued\nto a specific customer, or `q[state_eq]` for status filtering.\n\n\n**Required scope:** `read_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[code_cont]","in":"query","required":false,"description":"Filter by gift card code (contains)","schema":{"type":"string"}},{"name":"q[state_eq]","in":"query","required":false,"description":"Filter by status (active, redeemed, partially_redeemed, canceled)","schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"gift cards found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/GiftCard"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a gift card","tags":["Gift Cards"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Issues a gift card scoped to the current store. The code is\nauto-generated when omitted. `currency` defaults to the store's\nconfigured currency. Pass `user_id` (prefixed ID) to attach the\ncard to a specific customer.\n\n\n**Required scope:** `write_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"gift card created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GiftCard"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["amount"],"properties":{"amount":{"type":"string","description":"Decimal amount, greater than zero."},"currency":{"type":"string","description":"ISO 4217 currency code. Defaults to the store currency."},"code":{"type":"string","description":"Optional caller-supplied code. Auto-generated when omitted."},"expires_at":{"type":"string","description":"ISO 8601 date.","nullable":true},"user_id":{"type":"string","description":"Optional customer prefixed ID.","nullable":true}}}}}}}},"/api/v3/admin/gift_cards/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"Gift card prefixed ID","schema":{"type":"string"}}],"get":{"summary":"Get a gift card","tags":["Gift Cards"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single gift card.\n\n**Required scope:** `read_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"gift card found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GiftCard"}}}},"404":{"description":"gift card not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a gift card","tags":["Gift Cards"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates an active gift card's editable attributes. Redeemed or\npartially-redeemed cards cannot be edited.\n\n\n**Required scope:** `write_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"gift card updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GiftCard"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"amount":{"type":"string"},"expires_at":{"type":"string","nullable":true},"user_id":{"type":"string","nullable":true}}}}}}},"delete":{"summary":"Delete a gift card","tags":["Gift Cards"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes an unused gift card. Cards that have been redeemed or\npartially redeemed cannot be deleted and return 422.\n\n\n**Required scope:** `write_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"gift card deleted"},"422":{"description":"redeemed gift card cannot be deleted","content":{"application/json":{}}}}}},"/api/v3/admin/imports":{"get":{"summary":"List imports","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns CSV imports queued or completed for the current store.\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"imports found","content":{"application/json":{}}}}},"post":{"summary":"Create an import","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Queues a CSV import. Upload the file first via `POST /api/v3/admin/direct_uploads`\nand pass the returned `signed_id` as `attachment`. On success the import is in the\n`mapping` state and the response carries the mapping payload: `schema_fields`\n(the canonical columns for the type), `csv_headers`, a `sample_row`, and the\nauto-assigned `mappings`.\n\nAdjust mappings if needed, then call `PATCH /admin/imports/{id}/complete_mapping`\nto start processing. Poll `GET /admin/imports/{id}` while `status` is\n`completed_mapping`/`processing`; terminal statuses are `completed` and `failed`.\n\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"import created in mapping state","content":{"application/json":{}}},"422":{"description":"unknown import type","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["type","attachment"],"properties":{"type":{"type":"string","enum":["products","customers","product_translations"]},"attachment":{"type":"string","description":"ActiveStorage signed blob id from POST /api/v3/admin/direct_uploads."},"preferred_delimiter":{"type":"string","enum":[",",";","|","\t"],"description":"CSV column separator. Defaults to a comma."},"results_url":{"type":"string","description":"Absolute URL of your admin imports view; the import-done email links back to it with `?import=<id>` appended. Only honored when it matches one of the store's configured allowed origins."}}}}}}}},"/api/v3/admin/imports/template":{"get":{"summary":"Download an import template","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a CSV header row for the given import type, including the custom field columns available for the model.\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"type","in":"query","required":true,"description":"Registered import type, e.g. products.","schema":{"type":"string"}}],"responses":{"200":{"description":"CSV template","content":{"application/json":{},"text/csv":{"schema":{"type":"string","format":"binary"}}}}}}},"/api/v3/admin/imports/example":{"get":{"summary":"Download an example import file","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Redirects to a populated example CSV for the given import type — the same sample data `rake spree:load_sample_data` uses, pinned to the installed Spree version. Returns 404 for a type that ships no example file.\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"type","in":"query","required":true,"description":"Registered import type, e.g. products.","schema":{"type":"string"}}],"responses":{"302":{"description":"Redirect to the example CSV"}}}},"/api/v3/admin/imports/{id}":{"get":{"summary":"Show an import","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns import status and row counters. The admin dashboard polls this endpoint while `status` is `completed_mapping` or `processing`; `rows_count`, `completed_rows_count` and `failed_rows_count` drive the progress bar. The mapping payload (`csv_headers`, `sample_row`) is only present while `status` is `mapping`.\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"import found","content":{"application/json":{}}}}},"delete":{"summary":"Delete an import","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes the import, its rows and the uploaded file. Returns 422 while the import is being processed.\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"import deleted"}}}},"/api/v3/admin/imports/{id}/download":{"get":{"summary":"Download the originally uploaded file","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Streams the CSV exactly as it was uploaded — the audit trail for what was imported. JWT/API-key protected; SPA clients fetch it with the Authorization header and trigger the browser download via a Blob URL.\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"CSV file","content":{"application/json":{},"text/csv":{"schema":{"type":"string","format":"binary"}}}}}}},"/api/v3/admin/imports/{id}/complete_mapping":{"patch":{"summary":"Complete mapping and start processing","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Applies the submitted column mappings, then starts row processing. Omit `mappings`\nto accept the auto-assigned ones from the create response. Returns 422 when a\nrequired schema field is left unmapped (`details.missing_required_fields`) or a\nfile column is assigned twice.\n\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"mapping completed, processing queued","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"mappings":{"type":"array","description":"Column assignments to apply before starting. `file_column: null` unmaps a field.","items":{"type":"object","required":["schema_field"],"properties":{"schema_field":{"type":"string"},"file_column":{"type":"string","nullable":true}}}}}}}}}}},"/api/v3/admin/imports/{id}/retry_failed_rows":{"patch":{"summary":"Retry failed rows","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Re-processes the rows that failed. The import re-enters `processing`; poll `GET /admin/imports/{id}` until it completes again. Returns 422 when the import is not `completed` or has no failed rows.\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"retry queued","content":{"application/json":{}}}}}},"/api/v3/admin/imports/{import_id}/rows":{"get":{"summary":"List import rows","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Paginated rows of an import — the failure report. Filter with `q[status_eq]=failed` to list only rows that could not be imported; each row carries the raw CSV `data` and its `validation_errors`.\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"import_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"q[status_eq]","in":"query","required":false,"description":"Filter rows by status: pending, processing, completed, failed.","schema":{"type":"string"}}],"responses":{"200":{"description":"rows found","content":{"application/json":{}}}}}},"/api/v3/admin/markets":{"get":{"summary":"List markets","tags":["Markets"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the markets configured for the current store. Markets are\nstore-scoped and ordered by `position` (an `acts_as_list` column —\nupdate the order via `PATCH /markets/{id}` with `position`).\n\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to embed. Supported: `countries`.","schema":{"type":"string"}}],"responses":{"200":{"description":"markets found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Market"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Create a market","tags":["Markets"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new market for the current store.\n\n- `country_codes` accepts 2-letter ISO country codes (e.g. `[\"DE\", \"FR\"]`);\n the market must contain at least one country. Unknown codes are\n silently dropped.\n- `supported_locales` accepts an array of locale codes; the\n `default_locale` is always implicitly included.\n- Setting `default: true` automatically demotes the previous default\n market in the store.\n\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"market created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Market"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"currency":{"type":"string","description":"ISO 4217 currency code."},"default_locale":{"type":"string","description":"IETF locale tag used as the market default."},"supported_locales":{"type":"array","items":{"type":"string"},"description":"Locale codes available in this market. The default is always implicitly included."},"tax_inclusive":{"type":"boolean","default":false,"description":"Display prices with tax included."},"default":{"type":"boolean","default":false,"description":"Setting to true demotes the previous default."},"position":{"type":"integer","description":"Sort order within the store; lower = first."},"country_codes":{"type":"array","items":{"type":"string"},"description":"2-letter ISO country codes assigned to this market. At least one is required."}},"required":["name","currency","default_locale","country_codes"]}}}}}},"/api/v3/admin/markets/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get a market","tags":["Markets"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"market found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Market"}}}},"404":{"description":"market not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a market","tags":["Markets"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates an existing market. Pass `country_codes` to replace the\nmarket's country list (full-set update), `supported_locales` to\nreplace the supported locales, or `position` to reorder the market\nwithin the store.\n\nSetting `default: true` automatically demotes the previous default.\n\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"market updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Market"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"currency":{"type":"string"},"default_locale":{"type":"string"},"supported_locales":{"type":"array","items":{"type":"string"}},"tax_inclusive":{"type":"boolean"},"default":{"type":"boolean"},"position":{"type":"integer"},"country_codes":{"type":"array","items":{"type":"string"}}}}}}}},"delete":{"summary":"Delete a market","tags":["Markets"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes the market (sets `deleted_at`). The default market and\nthe last remaining market in a store cannot be deleted — both return\n422 with a `validation_error`.\n\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"market deleted"},"422":{"description":"cannot delete default or last market","content":{"application/json":{}}}}}},"/api/v3/admin/option_types":{"get":{"summary":"List option types","tags":["Option Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a paginated list of option types.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"description":"Filter by name (contains)","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., option_values). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., name,label,position). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"option types found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/OptionType"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create an option type","tags":["Option Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new option type. Supports nested option values.\n\nOption values can be provided inline and will be created or updated by name.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"option type created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OptionType"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"label":{"type":"string"},"position":{"type":"integer"},"filterable":{"type":"boolean"},"option_values":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"label":{"type":"string"},"position":{"type":"integer"}}}}},"required":["name","label"]}}}}}},"/api/v3/admin/option_types/{id}":{"get":{"summary":"Get an option type","tags":["Option Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single option type by ID, including its option values.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Option type ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., option_values). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., name,label,position). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"option type found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OptionType"}}}},"404":{"description":"option type not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update an option type","tags":["Option Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates an option type. Supports updating nested option values.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Option type ID","schema":{"type":"string"}}],"responses":{"200":{"description":"option type updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OptionType"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"label":{"type":"string"},"position":{"type":"integer"},"filterable":{"type":"boolean"},"option_values":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Existing option value ID to update"},"name":{"type":"string"},"label":{"type":"string"},"position":{"type":"integer"}}}}}}}}}},"delete":{"summary":"Delete an option type","tags":["Option Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes an option type.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Option type ID","schema":{"type":"string"}}],"responses":{"204":{"description":"option type deleted"}}}},"/api/v3/admin/orders/{order_id}/tax_lines":{"get":{"summary":"List tax lines","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Typed tax rows on the order. Read-only — written exclusively by the tax provider.\n\n**Required scope:** `read_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order prefixed ID","schema":{"type":"string"}}],"responses":{"200":{"description":"tax lines found","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{order_id}/discounts":{"get":{"summary":"List discounts","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Typed discount rows (promotion-sourced and manual) on the order.\n\n**Required scope:** `read_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order prefixed ID","schema":{"type":"string"}}],"responses":{"200":{"description":"discounts found","content":{"application/json":{}}}}},"post":{"summary":"Create manual discount","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a manual discount. With line_item_id a single row is created; without it the amount is distributed across line items (largest remainder). This is the sanctioned post-placement discount path and works on completed orders.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order prefixed ID","schema":{"type":"string"}}],"responses":{"201":{"description":"discount created","content":{"application/json":{}}},"422":{"description":"invalid discount","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string"},"value":{"type":"number"},"value_type":{"type":"string","enum":["flat","percent"]},"line_item_id":{"type":"string","nullable":true,"description":"Target line item; omit to distribute order-level"}},"required":["label","value"]}}}}}},"/api/v3/admin/orders/{order_id}/fees":{"post":{"summary":"Create fee","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a fee (surcharge, handling, gift wrap, COD, payment fee). Order-level when no target is given. Works on completed orders.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order prefixed ID","schema":{"type":"string"}}],"responses":{"201":{"description":"fee created","content":{"application/json":{}}},"422":{"description":"invalid fee","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string"},"amount":{"type":"number"},"kind":{"type":"string","enum":["surcharge","handling","gift_wrap","cod","payment","duty"],"description":"Defaults to 'surcharge'"},"line_item_id":{"type":"string","nullable":true},"fulfillment_id":{"type":"string","nullable":true}},"required":["label","amount"]}}}}}},"/api/v3/admin/orders/{order_id}/gift_cards":{"post":{"summary":"Apply a gift card to an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Applies a gift card by code to the order. Returns the gift card.\n\n**Required scope:** `write_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"201":{"description":"gift card applied","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["code"],"properties":{"code":{"type":"string","description":"Gift card code"}}}}}}}},"/api/v3/admin/orders/{order_id}/gift_cards/{id}":{"delete":{"summary":"Remove a gift card from an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes the gift card from the order.\n\n**Required scope:** `write_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Gift card ID","schema":{"type":"string"}}],"responses":{"204":{"description":"gift card removed"}}}},"/api/v3/admin/orders/{order_id}/items":{"get":{"summary":"List order items","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns all line items for an order.\n\n**Required scope:** `read_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., variant, variant.product). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., quantity,price,total). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"items found","content":{"application/json":{}}}}},"post":{"summary":"Add an item","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Adds a new line item to the order.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"201":{"description":"item added","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["variant_id"],"properties":{"variant_id":{"type":"string","description":"Prefixed variant ID"},"quantity":{"type":"integer","default":1}}}}}}}},"/api/v3/admin/orders/{order_id}/items/{id}":{"get":{"summary":"Show an item","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns details of a specific line item.\n\n**Required scope:** `read_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Item ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., variant, variant.product). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., quantity,price,total). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"item found","content":{"application/json":{}}}}},"patch":{"summary":"Update an item","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates an order item quantity or metadata.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Item ID","schema":{"type":"string"}}],"responses":{"200":{"description":"item updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"quantity":{"type":"integer"}}}}}}},"delete":{"summary":"Remove an item","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes an item from the order.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Item ID","schema":{"type":"string"}}],"responses":{"204":{"description":"line item removed"}}}},"/api/v3/admin/orders/{order_id}/store_credits":{"post":{"summary":"Apply customer's store credit to an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Applies the order customer's available store credit. When `amount` is omitted, applies up to the order outstanding balance.\n\n**Required scope:** `write_store_credits` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"201":{"description":"store credit applied","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"amount":{"type":"string","description":"Optional explicit amount; defaults to order outstanding balance"}}}}}}},"delete":{"summary":"Remove store credit from an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes any applied store credit from the order.\n\n**Required scope:** `write_store_credits` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"204":{"description":"store credit removed"}}}},"/api/v3/admin/orders":{"get":{"summary":"List orders","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a paginated list of orders for the current store.\n\n**Required scope:** `read_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"sort","in":"query","required":false,"description":"Sort field (e.g., created_at, -created_at, completed_at)","schema":{"type":"string"}},{"name":"q[state_eq]","in":"query","required":false,"description":"Filter by state (cart, address, delivery, payment, confirm, complete, canceled)","schema":{"type":"string"}},{"name":"q[email_cont]","in":"query","required":false,"description":"Filter by email (contains)","schema":{"type":"string"}},{"name":"q[number_eq]","in":"query","required":false,"description":"Filter by order number","schema":{"type":"string"}},{"name":"q[completed_at_gt]","in":"query","required":false,"description":"Filter by completed after date","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., items, fulfillments, payments, customer, discounts, billing_address, shipping_address). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., number,total,status,completed_at). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"orders found","content":{"application/json":{}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a draft order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new draft order in one shot. Customer, items, addresses, currency,\nmarket, channel, locale, notes, metadata, and a coupon code can all be\nprovided inline.\n\nSetting `preferred_stock_location_id` pins the order's preferred fulfillment\nlocation — Order Routing's built-in `PreferredLocation` rule consumes it\nwhen picking which stock location ships each shipment.\n\nInvalid coupon codes are non-fatal — the order is created and the failure\nis reported on the service result (not in the API response body for now).\n\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"order created with preferred_stock_location_id","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string"},"customer_id":{"type":"string","description":"Customer ID. Alias: user_id (legacy)."},"use_customer_default_address":{"type":"boolean","description":"When true with customer_id, copies the customer's saved billing/shipping addresses onto the order."},"currency":{"type":"string"},"market_id":{"type":"string","description":"Market ID"},"channel_id":{"type":"string","description":"Channel ID. Defaults to the store primary channel when omitted."},"preferred_stock_location_id":{"type":"string","description":"Stock Location ID to prefer for fulfillment. Order Routing's built-in PreferredLocation rule reads this and ranks the location first; routing falls back to the next rule when the preferred location can't cover the cart."},"locale":{"type":"string"},"customer_note":{"type":"string","description":"Public, customer-visible note"},"internal_note":{"type":"string","description":"Staff-only note"},"metadata":{"type":"object","description":"Arbitrary key/value metadata"},"shipping_address":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"address1":{"type":"string"},"city":{"type":"string"},"postal_code":{"type":"string"},"country_code":{"type":"string"},"state_code":{"type":"string"},"phone":{"type":"string"}}},"shipping_address_id":{"type":"string","description":"Existing customer address ID"},"billing_address":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"address1":{"type":"string"},"city":{"type":"string"},"postal_code":{"type":"string"},"country_code":{"type":"string"},"state_code":{"type":"string"},"phone":{"type":"string"}}},"billing_address_id":{"type":"string","description":"Existing customer address ID"},"items":{"type":"array","items":{"type":"object","required":["variant_id","quantity"],"properties":{"variant_id":{"type":"string","description":"Variant ID"},"quantity":{"type":"integer"},"metadata":{"type":"object"}}}},"coupon_code":{"type":"string","description":"Optional. Applied non-fatally; invalid codes do not block creation."}}}}}}}},"/api/v3/admin/orders/{id}":{"get":{"summary":"Show an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns full order details including admin-only fields.\n\n**Required scope:** `read_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Order ID (e.g., or_xxx)","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., items, fulfillments, payments, customer, discounts, billing_address, shipping_address). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., number,total,status,completed_at). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"order found","content":{"application/json":{}}},"404":{"description":"order not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates an order. Supports updating email, addresses, special instructions, and line items.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"200":{"description":"order updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string"},"customer_note":{"type":"string"},"internal_note":{"type":"string"},"channel_id":{"type":"string","description":"Channel ID"},"preferred_stock_location_id":{"type":"string","description":"Stock Location ID to prefer for fulfillment. Re-runs Order Routing's PreferredLocation rule on subsequent shipment rebuilds."},"ship_address":{"type":"object","properties":{"firstname":{"type":"string"},"lastname":{"type":"string"},"address1":{"type":"string"},"city":{"type":"string"},"zipcode":{"type":"string"},"country_code":{"type":"string"},"state_code":{"type":"string"},"phone":{"type":"string"}}},"bill_address":{"type":"object","properties":{"firstname":{"type":"string"},"lastname":{"type":"string"},"address1":{"type":"string"},"city":{"type":"string"},"zipcode":{"type":"string"},"country_code":{"type":"string"},"state_code":{"type":"string"},"phone":{"type":"string"}}},"items":{"type":"array","items":{"type":"object","required":["variant_id"],"properties":{"variant_id":{"type":"string","description":"Variant ID"},"quantity":{"type":"integer"},"metadata":{"type":"object"}}}}}}}}}},"delete":{"summary":"Delete a draft order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes a draft order. Completed orders cannot be deleted.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"204":{"description":"order deleted"}}}},"/api/v3/admin/orders/{id}/complete":{"patch":{"summary":"Complete an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Completes an order in the `confirm` state, marking it as placed.\n\nSet `notify_customer: true` to send the order confirmation email.\n\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"200":{"description":"order completed","content":{"application/json":{}}},"422":{"description":"order cannot be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"notify_customer":{"type":"boolean","description":"Send the order confirmation email after completion."}}}}}}}},"/api/v3/admin/orders/{id}/cancel":{"patch":{"summary":"Cancel an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Cancels a completed order.\n\nSet `notify_customer: true` to send the order cancellation email.\n\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"200":{"description":"order canceled","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"notify_customer":{"type":"boolean","description":"Send the order cancellation email after canceling."}}}}}}}},"/api/v3/admin/orders/{id}/approve":{"patch":{"summary":"Approve an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Approves an order (e.g., for fraud review).\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"200":{"description":"order approved","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{id}/resume":{"patch":{"summary":"Resume a canceled order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Resumes a previously canceled order.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"200":{"description":"order resumed","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{id}/resend_confirmation":{"post":{"summary":"Resend confirmation email","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Publishes the order.completed event to trigger confirmation email delivery.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"200":{"description":"confirmation resent","content":{"application/json":{}}}}}},"/api/v3/admin/payment_methods":{"get":{"summary":"List payment methods","tags":["Payment Methods"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the store's configured payment methods. Use `source_required: true` to know which methods need a saved source.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand. Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., name,type,active). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"payment methods found","content":{"application/json":{}}}}}},"/api/v3/admin/payment_methods/types":{"get":{"summary":"List available payment provider types","tags":["Payment Methods"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the registered Spree::PaymentMethod subclasses that can be used to create new payment methods. Useful for populating a \"Provider\" dropdown in admin UIs.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"provider types found","content":{"application/json":{}}}}}},"/api/v3/admin/payment_methods/{id}":{"get":{"summary":"Show a payment method","tags":["Payment Methods"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a payment method by ID.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand. Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., name,type,active). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"payment method found","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{order_id}/payments":{"get":{"summary":"List payments","tags":["Payments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns all payments for an order.\n\n**Required scope:** `read_payments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., payment_method, source). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., amount,status,number,response_code). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"payments found","content":{"application/json":{}}}}},"post":{"summary":"Create a payment","tags":["Payments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new payment for the order.\n\n**Required scope:** `write_payments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"201":{"description":"payment created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["payment_method_id"],"properties":{"payment_method_id":{"type":"string","description":"Payment method ID"},"amount":{"type":"string"},"source_id":{"type":"string","description":"Payment source ID"}}}}}}}},"/api/v3/admin/orders/{order_id}/payments/{id}":{"get":{"summary":"Show a payment","tags":["Payments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns details of a specific payment.\n\n**Required scope:** `read_payments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Payment ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., payment_method, source). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., amount,status,number,response_code). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"payment found","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{order_id}/payments/{id}/capture":{"patch":{"summary":"Capture a payment","tags":["Payments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Captures a pending payment.\n\n**Required scope:** `write_payments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Payment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"payment captured","content":{"application/json":{}}},"422":{"description":"capture failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/orders/{order_id}/payments/{id}/void":{"patch":{"summary":"Void a payment","tags":["Payments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Voids a payment.\n\n**Required scope:** `write_payments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Payment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"payment voided","content":{"application/json":{}}}}}},"/api/v3/admin/price_lists":{"get":{"summary":"List price lists","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the price lists configured for the current store.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"schema":{"type":"string"}},{"name":"q[status_eq]","in":"query","required":false,"schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to embed. Supported: `price_rules`.","schema":{"type":"string"}}],"responses":{"200":{"description":"price lists found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PriceList"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Create a price list","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new draft price list.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"price list created (server-to-server — rules + prices, no product_ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceList"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"starts_at":{"type":"string","nullable":true},"ends_at":{"type":"string","nullable":true},"match_policy":{"type":"string","enum":["all","any"]},"position":{"type":"integer"},"product_ids":{"type":"array","items":{"type":"string"},"description":"Prefixed product ids to seed the list with."},"rules":{"type":"array","description":"STI-typed price rules to attach on create. Existing rules on the same payload via PATCH reconcile by id.","items":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true}}}},"prices":{"type":"array","description":"Server-to-server alternative to `product_ids`: ship the exact per-variant prices the list should contain. Each row upserts on the unique key `(variant_id, currency, price_list_id)`. Mix-and-match with `product_ids` is supported but typically unnecessary — `prices` alone tells the server which variants belong to the list and what the override amount is.","items":{"type":"object","required":["variant_id","currency"],"properties":{"variant_id":{"type":"string"},"currency":{"type":"string"},"amount":{"type":"string","nullable":true},"compare_at_amount":{"type":"string","nullable":true}}}}}}}}}}},"/api/v3/admin/price_lists/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get a price list","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"price list found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceList"}}}},"404":{"description":"price list not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a price list","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a price list. The optional `rules:` array reconciles nested\nSTI-typed price rules in a single round-trip — existing rules update\nby `id`, new rules build, missing rules destroy. Mirrors the\npromotion editor's \"save the whole thing on Save\" pattern.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"price list updated with nested rules","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceList"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"starts_at":{"type":"string","nullable":true},"ends_at":{"type":"string","nullable":true},"match_policy":{"type":"string","enum":["all","any"]},"position":{"type":"integer"},"product_ids":{"type":"array","items":{"type":"string"},"description":"Prefixed product ids — reconciles list membership (adds + removes)."},"rules":{"type":"array","items":{"type":"object","required":["type"],"properties":{"id":{"type":"string","nullable":true},"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true}}}},"prices":{"type":"array","description":"Individual price overrides (the spreadsheet payload). Each row updates by `id` if shipped, otherwise upserts on the unique key `(variant_id, currency, price_list_id)`.","items":{"type":"object","oneOf":[{"required":["id"]},{"required":["variant_id","currency"]}],"properties":{"id":{"type":"string"},"variant_id":{"type":"string"},"currency":{"type":"string"},"amount":{"type":"string","nullable":true},"compare_at_amount":{"type":"string","nullable":true}}}}}}}}}},"delete":{"summary":"Delete a price list","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes the price list. Associated prices are removed asynchronously.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"price list deleted"}}}},"/api/v3/admin/price_lists/{id}/activate":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"summary":"Activate a price list","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Transitions a draft / inactive list to `active`. If `starts_at` is\nin the future the list is marked `scheduled` instead, matching the\nlegacy admin behaviour.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"price list activated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceList"}}}}}}},"/api/v3/admin/price_lists/{id}/deactivate":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"summary":"Deactivate a price list","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"price list deactivated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceList"}}}}}}},"/api/v3/admin/prices":{"get":{"summary":"List prices","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Generic prices endpoint covering both base prices and price-list\noverrides. Filter with Ransack: `q[price_list_id_eq]=…`,\n`q[currency_eq]=USD`, `q[price_list_id_null]=true` (base prices only).\n\nThe admin spreadsheet uses this with server-side pagination so it\nscales past the metadata-PATCH path on `/price_lists/:id`.\n\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"q[price_list_id_eq]","in":"query","required":false,"schema":{"type":"string"}},{"name":"q[price_list_id_null]","in":"query","required":false,"schema":{"type":"boolean"}},{"name":"q[currency_eq]","in":"query","required":false,"schema":{"type":"string"}},{"name":"q[variant_id_eq]","in":"query","required":false,"schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"Comma-separated sort keys. Supports e.g. `variant_product_name,variant_id`.","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to embed. Supported: `variant`.","schema":{"type":"string"}}],"responses":{"200":{"description":"prices found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Price"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Create a price","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a single price. Omit `price_list_id` to create a base price.\nFor more than a handful of rows, prefer `POST /admin/prices/bulk_upsert`.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"price created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Price"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["variant_id","currency"],"properties":{"variant_id":{"type":"string"},"currency":{"type":"string"},"amount":{"type":"string","nullable":true},"compare_at_amount":{"type":"string","nullable":true},"price_list_id":{"type":"string","nullable":true}}}}}}}},"/api/v3/admin/prices/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get a price","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"price found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Price"}}}},"404":{"description":"price not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a price","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"price updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Price"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"amount":{"type":"string","nullable":true},"compare_at_amount":{"type":"string","nullable":true}}}}}}},"delete":{"summary":"Delete a price","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes the price (acts_as_paranoid).\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"price deleted"}}}},"/api/v3/admin/prices/bulk_upsert":{"post":{"summary":"Bulk-upsert prices","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Upserts a batch of prices in a single SQL round trip.\n\nEach row either:\n* targets an existing price by `id`, OR\n* matches on the unique key `(variant_id, currency, price_list_id)` —\n updating the existing row if one exists, creating one otherwise.\n\nModel callbacks (e.g. PriceHistory) are bypassed; this is a\nbulk-write fast path for the admin spreadsheet. The response\ncarries `price_count` — the number of rows touched.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"prices upserted","content":{"application/json":{"schema":{"type":"object","properties":{"price_count":{"type":"integer"}}}}}},"422":{"description":"missing prices key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["prices"],"properties":{"prices":{"type":"array","items":{"type":"object","required":["variant_id","currency"],"properties":{"id":{"type":"string","nullable":true},"variant_id":{"type":"string"},"currency":{"type":"string"},"price_list_id":{"type":"string","nullable":true},"amount":{"type":"string","nullable":true},"compare_at_amount":{"type":"string","nullable":true}}}}}}}}}}},"/api/v3/admin/prices/bulk_destroy":{"delete":{"summary":"Bulk-delete prices","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes each price in `ids`. Returns the count actually destroyed.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"prices deleted","content":{"application/json":{"schema":{"type":"object","properties":{"price_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/{product_id}/custom_fields":{"get":{"summary":"List product custom fields","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the product's custom field values.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., custom_field_definition). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., key,value,namespace). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"custom fields found","content":{"application/json":{}}}}},"post":{"summary":"Create a product custom field","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Sets a custom field value on the product. Requires an existing CustomFieldDefinition; pass its prefixed `cfdef_…` id.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"custom field created","content":{"application/json":{}}},"422":{"description":"duplicate definition for the same product","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["custom_field_definition_id","value"],"properties":{"custom_field_definition_id":{"type":"string","description":"Prefixed `cfdef_…` id"},"value":{"description":"Value matching the definition's `field_type`"}}}}}}}},"/api/v3/admin/products/{product_id}/custom_fields/{id}":{"get":{"summary":"Show a product custom field","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., custom_field_definition). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., key,value,namespace). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"custom field found","content":{"application/json":{}}}}},"patch":{"summary":"Update a product custom field","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates the custom field's `value`. The linked definition cannot be changed — delete and recreate to switch.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"custom field updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["value"],"properties":{"value":{"description":"New value"}}}}}}},"delete":{"summary":"Delete a product custom field","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"custom field deleted"}}}},"/api/v3/admin/products/{product_id}/translations":{"get":{"summary":"List product translations","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the full translation matrix for the product: the source value and content type per translatable field, plus the translated value for every supported locale.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"translations found","content":{"application/json":{}}}}}},"/api/v3/admin/products":{"get":{"summary":"List products","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a paginated list of products for the current store.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"sort","in":"query","required":false,"description":"Sort field (e.g., name, -name, price, -price, best_selling)","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., variants, media, option_types, categories). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., name,slug,price,status). id is always included.","schema":{"type":"string"}},{"name":"q[name_cont]","in":"query","required":false,"description":"Filter by name (contains)","schema":{"type":"string"}},{"name":"q[status_eq]","in":"query","required":false,"description":"Filter by status","schema":{"type":"string"}}],"responses":{"200":{"description":"products found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Product"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a product","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new product. Supports nested variants with prices and option types.\n\nOption types and values are auto-created if they don't exist.\nPrices are upserted by currency. Stock items are upserted by stock location.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"product created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"slug":{"type":"string"},"status":{"type":"string","enum":["draft","active","archived"]},"tax_category_id":{"type":"string","description":"Tax category ID"},"category_ids":{"type":"array","items":{"type":"string"},"description":"Array of category IDs"},"tags":{"type":"array","items":{"type":"string"}},"prices":{"type":"array","description":"Shorthand for a simple (no-options) product: per-currency prices that forward to the product's sole variant. For products with options, set prices per variant under `variants:` instead.","items":{"type":"object","required":["currency","amount"],"properties":{"currency":{"type":"string"},"amount":{"type":"string"},"compare_at_amount":{"type":"string","nullable":true}}}},"variants":{"type":"array","description":"Array of variant payloads. Variants can declare multiple option pairs via `options:` and per-currency prices via `prices:`. Stock counts go in `stock_items:` (per stock location).","items":{"type":"object","properties":{"sku":{"type":"string"},"options":{"type":"array","description":"One pair per option type the variant participates in (e.g. size + color). Option types and values are auto-created if missing.","items":{"type":"object","required":["name","value"],"properties":{"name":{"type":"string"},"value":{"type":"string"}}}},"prices":{"type":"array","description":"Per-currency prices. Upserted by currency.","items":{"type":"object","required":["currency","amount"],"properties":{"currency":{"type":"string"},"amount":{"type":"string"},"compare_at_amount":{"type":"string","nullable":true}}}},"stock_items":{"type":"array","description":"Per-stock-location inventory. Upserted by stock_location_id.","items":{"type":"object","required":["stock_location_id","count_on_hand"],"properties":{"stock_location_id":{"type":"string","description":"Stock location ID (e.g. sloc_xxx)"},"count_on_hand":{"type":"integer"},"backorderable":{"type":"boolean"}}}}}}}},"required":["name"]}}}}}},"/api/v3/admin/products/{id}":{"get":{"summary":"Get a product","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single product by ID.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Product ID (e.g., prod_xxx)","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., variants, media, option_types, categories). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., name,slug,price,status). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"product found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}},"404":{"description":"product not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a product","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a product. Only provided fields are updated.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}}],"responses":{"200":{"description":"product updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"slug":{"type":"string"},"status":{"type":"string","enum":["draft","active","archived"]},"tax_category_id":{"type":"string","description":"Tax category ID"},"category_ids":{"type":"array","items":{"type":"string"},"description":"Array of category IDs"},"tags":{"type":"array","items":{"type":"string"}},"prices":{"type":"array","description":"Shorthand for a simple (no-options) product: per-currency prices that forward to the product's sole variant. For products with options, set prices per variant under `variants:` instead.","items":{"type":"object","required":["currency","amount"],"properties":{"currency":{"type":"string"},"amount":{"type":"string"},"compare_at_amount":{"type":"string","nullable":true}}}},"variants":{"type":"array","description":"Array of variant payloads. Variants can declare multiple option pairs via `options:` and per-currency prices via `prices:`. Stock counts go in `stock_items:` (per stock location).","items":{"type":"object","properties":{"sku":{"type":"string"},"options":{"type":"array","description":"One pair per option type the variant participates in (e.g. size + color). Option types and values are auto-created if missing.","items":{"type":"object","required":["name","value"],"properties":{"name":{"type":"string"},"value":{"type":"string"}}}},"prices":{"type":"array","description":"Per-currency prices. Upserted by currency.","items":{"type":"object","required":["currency","amount"],"properties":{"currency":{"type":"string"},"amount":{"type":"string"},"compare_at_amount":{"type":"string","nullable":true}}}},"stock_items":{"type":"array","description":"Per-stock-location inventory. Upserted by stock_location_id.","items":{"type":"object","required":["stock_location_id","count_on_hand"],"properties":{"stock_location_id":{"type":"string","description":"Stock location ID (e.g. sloc_xxx)"},"count_on_hand":{"type":"integer"},"backorderable":{"type":"boolean"}}}}}}}}}}}}},"delete":{"summary":"Delete a product","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes a product.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}}],"responses":{"204":{"description":"product deleted"},"422":{"description":"deletion refused by a store rule","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/products/bulk_status_update":{"post":{"summary":"Bulk-update product status","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Sets `status` on each product in `ids`. Reindexes the affected products\nfor search. Cross-store IDs are silently dropped. Returns counts.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"cross-store products silently dropped","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"},"status":{"type":"string"}}}}}},"422":{"description":"invalid status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","status"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["draft","active","archived"]}}}}}}}},"/api/v3/admin/products/bulk_add_to_categories":{"post":{"summary":"Bulk-add products to categories","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Attaches each product in `ids` to every category (category) in `category_ids`.\nCategories from sibling stores are silently ignored.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products added to categories","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"},"category_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","category_ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"category_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/bulk_remove_from_categories":{"post":{"summary":"Bulk-remove products from categories","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Detaches each product in `ids` from every category in `category_ids`.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products removed from categories","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","category_ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"category_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/bulk_add_to_collections":{"post":{"summary":"Bulk-add products to collections","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Attaches each product in `ids` to every manual collection in `collection_ids`.\nAutomatic (rule-based) and sibling-store collections are silently ignored.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products added to collections","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"},"collection_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","collection_ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"collection_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/bulk_remove_from_collections":{"post":{"summary":"Bulk-remove products from collections","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Detaches each product in `ids` from every collection in `collection_ids`.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products removed from collections","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","collection_ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"collection_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/bulk_add_to_channels":{"post":{"summary":"Bulk-add products to channels","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Publishes each product in `ids` on every channel in `channel_ids`. Idempotent —\nre-publishing on an existing channel is a no-op. Channels from sibling stores\nare silently ignored.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products published on channels","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"},"channel_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","channel_ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"channel_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/bulk_remove_from_channels":{"post":{"summary":"Bulk-remove products from channels","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Unpublishes each product in `ids` from every channel in `channel_ids`.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products unpublished from channels","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"},"channel_count":{"type":"integer"},"removed":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","channel_ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"channel_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/bulk_add_tags":{"post":{"summary":"Bulk-add tags to products","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Adds each tag name in `tags` to every product in `ids`. Tags are upserted by name.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"tags added","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"},"tag_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","tags"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/bulk_remove_tags":{"post":{"summary":"Bulk-remove tags from products","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes each tag in `tags` from every product in `ids`.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"tags removed","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","tags"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/bulk_destroy":{"delete":{"summary":"Bulk-delete products","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes each product in `ids`. Returns the count actually destroyed.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products deleted","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/promotions/{promotion_id}/coupon_codes":{"parameters":[{"name":"promotion_id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"List coupon codes for a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the auto-generated coupon codes for a multi-code promotion. Single-code promotions store the code on the promotion itself; this endpoint returns an empty list for them.\n\n**Required scope:** `read_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"coupon codes found","content":{"application/json":{}}}}}},"/api/v3/admin/promotions/{promotion_id}/promotion_actions":{"parameters":[{"name":"promotion_id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"List actions for a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"actions found","content":{"application/json":{}}}}},"post":{"summary":"Create an action on a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Adds a new action to a promotion. The `type` is the wire shorthand from `GET /promotion_actions/types` (e.g. `free_shipping`, `create_item_adjustments`). Fully-qualified Ruby class names are also accepted for backward compatibility.\n\n**Required scope:** `write_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"action created","content":{"application/json":{}}},"422":{"description":"unknown action type","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true}},"required":["type"]}}}}}},"/api/v3/admin/promotions/{promotion_id}/promotion_actions/{id}":{"parameters":[{"name":"promotion_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"delete":{"summary":"Delete an action from a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"action deleted"}}}},"/api/v3/admin/promotions/{promotion_id}/promotion_rules":{"parameters":[{"name":"promotion_id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"List rules for a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"rules found","content":{"application/json":{}}}}},"post":{"summary":"Create a rule on a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Adds a new rule to a promotion. The `type` is the wire shorthand from `GET /promotion_rules/types` (e.g. `currency`, `item_total`, `product`). Fully-qualified Ruby class names are also accepted for backward compatibility.\n\n**Required scope:** `write_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"rule created with preferences","content":{"application/json":{}}},"422":{"description":"unknown rule type","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true}},"required":["type"]}}}}}},"/api/v3/admin/promotions/{promotion_id}/promotion_rules/{id}":{"parameters":[{"name":"promotion_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"summary":"Update a rule's preferences","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"rule updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"preferences":{"type":"object","additionalProperties":true}}}}}}},"delete":{"summary":"Delete a rule from a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"rule deleted"}}}},"/api/v3/admin/promotions":{"get":{"summary":"List promotions","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the store's promotions, including manual coupon and automatic promotions.\n\n**Required scope:** `read_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"promotions found","content":{"application/json":{}}}}},"post":{"summary":"Create a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new promotion. `code` is required for single-code coupon promotions;\npass `multi_codes: true` with `number_of_codes` to auto-generate a batch.\n\nRules and actions can be created in the same request by passing arrays of\n`{ type, preferences, ... }` rows. The server reconciles to the desired set:\nnew rows are built, existing rows (by `id`) are updated, omitted rows are removed.\n\n\n**Required scope:** `write_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"promotion created with rules and actions","content":{"application/json":{}}},"422":{"description":"invalid params","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"code":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"starts_at":{"type":"string","format":"date-time","nullable":true},"expires_at":{"type":"string","format":"date-time","nullable":true},"usage_limit":{"type":"integer","nullable":true},"match_policy":{"type":"string","enum":["all","any"]},"kind":{"type":"string","enum":["coupon_code","automatic"]},"multi_codes":{"type":"boolean"},"number_of_codes":{"type":"integer","nullable":true},"code_prefix":{"type":"string","nullable":true},"promotion_category_id":{"type":"string","nullable":true},"rules":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true},"product_ids":{"type":"array","items":{"type":"string"}},"category_ids":{"type":"array","items":{"type":"string"}},"customer_ids":{"type":"array","items":{"type":"string"}}},"required":["type"]}},"actions":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true},"calculator":{"type":"object","properties":{"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true}}}},"required":["type"]}}},"required":["name"]}}}}}},"/api/v3/admin/promotions/{id}":{"get":{"summary":"Show a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"promotion found","content":{"application/json":{}}}}},"patch":{"summary":"Update a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a promotion. The `rules` and `actions` arrays are treated as\na *desired set* — rows with `id` update in place, rows without `id` are\nbuilt fresh, and any existing row not present in the array is destroyed.\nPass `rules: []` or `actions: []` to clear them.\n\n\n**Required scope:** `write_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"rules and actions cleared with empty arrays","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"code":{"type":"string","nullable":true},"starts_at":{"type":"string","format":"date-time","nullable":true},"expires_at":{"type":"string","format":"date-time","nullable":true},"usage_limit":{"type":"integer","nullable":true},"match_policy":{"type":"string","enum":["all","any"]},"kind":{"type":"string","enum":["coupon_code","automatic"]},"promotion_category_id":{"type":"string","nullable":true},"rules":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","nullable":true,"description":"Pass to update an existing rule; omit to build a new one"},"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true},"product_ids":{"type":"array","items":{"type":"string"}},"category_ids":{"type":"array","items":{"type":"string"}},"customer_ids":{"type":"array","items":{"type":"string"}}},"required":["type"]}},"actions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","nullable":true},"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true},"calculator":{"type":"object","properties":{"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true}}}},"required":["type"]}}}}}}}},"delete":{"summary":"Delete a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"promotion deleted"}}}},"/api/v3/admin/promotion_actions/types":{"get":{"summary":"List available promotion action types","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the registered Spree::PromotionAction subclasses with their preference schemas. Used by admin UIs to populate the \"Add action\" picker and render generic preference forms.\n\n**Required scope:** `read_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"action types found","content":{"application/json":{}}}}}},"/api/v3/admin/promotion_rules/types":{"get":{"summary":"List available promotion rule types","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the registered Spree::PromotionRule subclasses with their preference schemas.\n\n**Required scope:** `read_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"rule types found","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{order_id}/refunds":{"get":{"summary":"List refunds","tags":["Refunds"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns all refunds for an order.\n\n**Required scope:** `read_refunds` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., payment, refund_reason). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., amount,reason,transaction_id). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"refunds found","content":{"application/json":{}}}}},"post":{"summary":"Create a refund","tags":["Refunds"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a refund for a payment on the order. The refund is automatically processed via the payment gateway.\n\n**Required scope:** `write_refunds` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"201":{"description":"refund created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["payment_id","amount"],"properties":{"payment_id":{"type":"string","description":"Payment ID"},"amount":{"type":"string"},"refund_reason_id":{"type":"string","description":"Refund reason ID"}}}}}}}},"/api/v3/admin/locales":{"get":{"summary":"List supported locales","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the locales a merchant can translate content into for the current store, with the default and right-to-left flags.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"locales found","content":{"application/json":{}}}}}},"/api/v3/admin/store_credit_categories":{"get":{"summary":"List store credit categories","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the configured store credit categories. Categories classify\nstore credits (e.g., \"Goodwill\", \"Gift Card\", \"Refund\") and surface\nin the admin UI as a dropdown when issuing or editing a store\ncredit. Category names matching `Spree::Config[:non_expiring_credit_types]`\nare flagged via `non_expiring: true`.\n\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"description":"Filter by name (contains)","schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"store credit categories found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/StoreCreditCategory"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/store_credit_categories/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"Store credit category ID","schema":{"type":"string"}}],"get":{"summary":"Get a store credit category","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single store credit category by prefixed ID.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"store credit category found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StoreCreditCategory"}}}},"404":{"description":"store credit category not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/store":{"get":{"summary":"Get the current store","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the current store configuration. The store is resolved from the request context (host or admin selection); there is no `id` parameter.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"current store","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Store"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update the current store","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates the current store configuration.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"store updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Store"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"preferred_admin_locale":{"type":"string"},"preferred_timezone":{"type":"string"},"preferred_weight_unit":{"type":"string"},"preferred_unit_system":{"type":"string"}}}}}}}},"/api/v3/admin/tags":{"get":{"summary":"List tags","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns tag names for a given taggable type. Used for autocomplete in tag inputs on products, orders, and customers.","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"taggable_type","in":"query","required":true,"description":"Taggable type (`Spree::Product`, `Spree::Order`, or `Spree::User`)","schema":{"type":"string"}},{"name":"q","in":"query","required":false,"description":"Optional case-insensitive substring filter","schema":{"type":"string"}}],"responses":{"200":{"description":"tags found","content":{"application/json":{}}},"422":{"description":"invalid taggable type","content":{"application/json":{}}}}}},"/api/v3/admin/tax_rates":{"get":{"summary":"List tax rates","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the store's tax rates. Rates are the entire configuration of\nthe built-in tax provider: each pairs a tax category with a jurisdiction\n(a country, optionally narrowed to one state) and a percentage, and\ndecides whether the tax is already included in the product price\n(VAT-style) or added on top (US-style).\n\nMarkets using an external tax provider ignore these rows — that\nprovider carries its own jurisdiction data.\n\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"description":"Filter by name (contains)","schema":{"type":"string"}},{"name":"q[included_in_price_true]","in":"query","required":false,"description":"Only rates included in the product price","schema":{"type":"boolean"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).","schema":{"type":"string"}}],"responses":{"200":{"description":"tax rates found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/TaxRate"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a tax rate","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a tax rate for the current store. Give either `amount` as a\ndecimal (`0.19`) or `amount_percentage` as a percentage (`19`).\n\nName the jurisdiction with `country_code` (and `state_code` for a\nstate-level rate). Omitting the country makes the rate apply everywhere.\n\nSet `included_in_price` for VAT-style pricing, where the rate is backed\nout of the displayed price rather than added to it.\n\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"tax rate created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaxRate"}}}},"422":{"description":"validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"Customer-facing rate name, e.g. \"VAT\""},"amount":{"type":"string","description":"Rate as a decimal, e.g. \"0.19\""},"amount_percentage":{"type":"number","description":"Rate as a percentage, e.g. 19"},"included_in_price":{"type":"boolean"},"show_rate_in_label":{"type":"boolean"},"tax_category_id":{"type":"string"},"country_code":{"type":"string","description":"ISO code, e.g. \"DE\". Omit for every country."},"state_code":{"type":"string","description":"State abbreviation within that country, e.g. \"CA\"."}},"required":["name","tax_category_id"]}}},"required":true}}},"/api/v3/admin/tax_rates/{id}":{"parameters":[{"name":"id","in":"path","description":"Tax rate ID","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get a tax rate","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"tax rate found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaxRate"}}}}}},"patch":{"summary":"Update a tax rate","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"tax rate updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaxRate"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"amount":{"type":"string"},"amount_percentage":{"type":"number"},"included_in_price":{"type":"boolean"},"show_rate_in_label":{"type":"boolean"},"tax_category_id":{"type":"string"},"country_code":{"type":"string"},"state_code":{"type":"string"}}}}},"required":true}},"delete":{"summary":"Delete a tax rate","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes the rate. Tax lines it already produced keep their own rate snapshot.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"204":{"description":"tax rate deleted"}}}},"/api/v3/admin/translatable_resources":{"get":{"summary":"List translatable resources","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns every translatable resource type and its translatable fields (key + content type), so clients can render translation editors generically.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"translatable resources found","content":{"application/json":{}}}}}},"/api/v3/admin/translations/batch":{"post":{"summary":"Batch upsert translations","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Atomically upserts translations across many records of (possibly) different translatable resource types in one request — e.g. an option type and all its option values in one save. A flat list of independent registry writes; all entries succeed or none do.\n\n**Required scope:** `write_<resource>` for every resource type in the batch (for API-key authentication) (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"translations upserted","content":{"application/json":{}}},"422":{"description":"unsupported locale rolls back the whole batch","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["translations"],"properties":{"translations":{"type":"array","items":{"type":"object","required":["resource_type","resource_id","values"],"properties":{"resource_type":{"type":"string","description":"Translatable resource type token, e.g. `option_type`"},"resource_id":{"type":"string","description":"Prefixed id of the record"},"values":{"type":"object","description":"Map of locale code to { field: value }","additionalProperties":{"type":"object","additionalProperties":true}}}}}}}}}}}},"/api/v3/admin/admin_users":{"get":{"summary":"List staff","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns admin users with at least one role assignment on the current store.\n\n**Required scope:** `read_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"staff found","content":{"application/json":{}}}}}},"/api/v3/admin/admin_users/{id}":{"get":{"summary":"Show a staff member","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"staff member found","content":{"application/json":{}}}}},"patch":{"summary":"Update a staff member","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates name fields and reassigns roles for the current store. `role_ids` is a complete replacement — roles not in the array are removed for this store.\n\n**Required scope:** `write_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"staff member updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"role_ids":{"type":"array","items":{"type":"string"}}}}}}}},"delete":{"summary":"Remove a staff member from this store","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes the user's role assignments on the current store. The account is preserved — the user keeps access to any other stores.\n\n**Required scope:** `write_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"staff removed from store"}}}},"/api/v3/admin/invitations":{"get":{"summary":"List invitations","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns invitations for the current store, including pending and accepted.\n\n**Required scope:** `read_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"invitations found","content":{"application/json":{}}}}},"post":{"summary":"Create an invitation","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Invites a teammate by email. The invitation is scoped to the current store and carries the chosen role; on accept, a `RoleUser` is created via the invitation's `after_accept` callback.\n\n**Required scope:** `write_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"invitation created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["email","role_id"],"properties":{"email":{"type":"string"},"role_id":{"type":"string"}}}}}}}},"/api/v3/admin/invitations/{id}":{"delete":{"summary":"Revoke an invitation","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"invitation revoked"}}}},"/api/v3/admin/invitations/{id}/resend":{"patch":{"summary":"Resend an invitation","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Issues a fresh token and dispatches the invitation email again.\n\n**Required scope:** `write_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"invitation resent","content":{"application/json":{}}}}}},"/api/v3/admin/permissions":{"get":{"summary":"List the permission catalog","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the permission catalog — the grant vocabulary shared by staff role permissions and secret API key scopes. Entries are grouped for permission pickers; labels and descriptions are localized. Readable by any authenticated admin credential.","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"catalog returned","content":{"application/json":{}}}}}},"/api/v3/admin/roles":{"get":{"summary":"List roles","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns staff roles with their catalog permissions. Roles are global, not per-store; `mutable: false` marks the protected admin role and host-locked rows.\n\n**Required scope:** `read_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"roles found","content":{"application/json":{}}}}},"post":{"summary":"Create a role","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a staff role. `permissions` holds catalog keys (see GET /admin/permissions); a caller may only grant keys they effectively hold.\n\n**Required scope:** `write_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"role created","content":{"application/json":{}}},"422":{"description":"invalid request","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"permissions":{"type":"array","items":{"type":"string"}}},"required":["name"]}}}}}},"/api/v3/admin/roles/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"summary":"Update a role","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a role name, description or permissions. The admin role and host-locked roles (`mutable: false`) reject changes.\n\n**Required scope:** `write_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"role updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"permissions":{"type":"array","items":{"type":"string"}}}}}}}},"delete":{"summary":"Delete a role","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes a role. Fails with 422 while the role is protected or still referenced by staff members or pending invitations.\n\n**Required scope:** `write_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"role deleted"},"422":{"description":"role cannot be deleted","content":{"application/json":{}}}}}},"/api/v3/admin/stock_locations":{"get":{"summary":"List stock locations","tags":["Stock Locations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the configured stock locations. Stock locations are global\n(shared across stores). Filter with Ransack predicates such as\n`q[active_eq]`, `q[kind_eq]`, `q[pickup_enabled_eq]`, or\n`q[name_cont]`.\n\nPickup-related attributes (`kind`, `pickup_enabled`,\n`pickup_stock_policy`, `pickup_ready_in_minutes`,\n`pickup_instructions`) drive merchant pickup support at checkout —\ncustomers can collect orders from any active location with\n`pickup_enabled: true`.\n\n\n**Required scope:** `read_stock` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"description":"Filter by name (contains)","schema":{"type":"string"}},{"name":"q[active_eq]","in":"query","required":false,"description":"Filter by active status","schema":{"type":"boolean"}},{"name":"q[kind_eq]","in":"query","required":false,"description":"Filter by kind (built-in: 'warehouse', 'store', 'fulfillment_center')","schema":{"type":"string"}},{"name":"q[pickup_enabled_eq]","in":"query","required":false,"description":"Filter by pickup-enabled flag","schema":{"type":"boolean"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"stock locations found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/StockLocation"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a stock location","tags":["Stock Locations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new stock location.\n\nSetting `default: true` automatically demotes the previous default\nlocation.\n\n\n**Required scope:** `write_stock` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"stock location created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockLocation"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"admin_name":{"type":"string","nullable":true,"description":"Internal name shown only in the admin"},"active":{"type":"boolean"},"default":{"type":"boolean","description":"Setting to true demotes the previous default."},"kind":{"type":"string","enum":["warehouse","store","fulfillment_center"],"description":"Categorizes the location."},"propagate_all_variants":{"type":"boolean"},"backorderable_default":{"type":"boolean"},"address1":{"type":"string","nullable":true},"address2":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"zipcode":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"country_code":{"type":"string","nullable":true,"description":"ISO-3166 alpha-2 country code (e.g. \"US\")."},"state_code":{"type":"string","nullable":true,"description":"State / province abbreviation (e.g. \"NY\"). Resolved against the selected country."},"state_name":{"type":"string","nullable":true,"description":"Free-text state for countries without a states list."},"pickup_enabled":{"type":"boolean"},"pickup_stock_policy":{"type":"string","enum":["local","any"],"description":"'local' = items at this location only; 'any' = transfer-eligible (ship-to-store)."},"pickup_ready_in_minutes":{"type":"number","nullable":true,"minimum":0},"pickup_instructions":{"type":"string","nullable":true}},"required":["name"]}}}}}},"/api/v3/admin/stock_locations/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"Stock location ID","schema":{"type":"string"}}],"get":{"summary":"Get a stock location","tags":["Stock Locations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single stock location by prefixed ID.\n\n**Required scope:** `read_stock` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"stock location found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockLocation"}}}},"404":{"description":"stock location not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a stock location","tags":["Stock Locations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates an existing stock location. Same address-field conventions as\nthe create endpoint.\n\nSetting `default: true` automatically demotes the previous default.\n\n\n**Required scope:** `write_stock` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"stock location updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockLocation"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"admin_name":{"type":"string","nullable":true},"active":{"type":"boolean"},"default":{"type":"boolean"},"kind":{"type":"string","enum":["warehouse","store","fulfillment_center"]},"propagate_all_variants":{"type":"boolean"},"backorderable_default":{"type":"boolean"},"address1":{"type":"string","nullable":true},"address2":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"zipcode":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"country_code":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true},"state_name":{"type":"string","nullable":true},"pickup_enabled":{"type":"boolean"},"pickup_stock_policy":{"type":"string","enum":["local","any"]},"pickup_ready_in_minutes":{"type":"number","nullable":true,"minimum":0},"pickup_instructions":{"type":"string","nullable":true}}}}}}},"delete":{"summary":"Delete a stock location","tags":["Stock Locations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes the stock location (sets `deleted_at`). Existing\nfulfillments that referenced it keep the historical record via\n`Spree::StockLocation.with_deleted`.\n\n\n**Required scope:** `write_stock` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"204":{"description":"stock location deleted"}}}},"/api/v3/admin/products/{product_id}/variants":{"get":{"summary":"List product variants","tags":["Variants"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a paginated list of variants for a product, including the default variant.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., images, prices, stock_items, option_values). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., sku,price,stock). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"variants found","content":{"application/json":{}}}}},"post":{"summary":"Create a variant","tags":["Variants"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new variant for a product. Supports nested prices and stock items.\n\nOption types and values are auto-created if they don't exist.\nPrices are upserted by currency. Stock items are upserted by stock location.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}}],"responses":{"201":{"description":"variant created","content":{"application/json":{}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"sku":{"type":"string"},"cost_price":{"type":"string"},"cost_currency":{"type":"string"},"weight":{"type":"number"},"height":{"type":"number"},"width":{"type":"number"},"depth":{"type":"number"},"weight_unit":{"type":"string"},"dimensions_unit":{"type":"string"},"track_inventory":{"type":"boolean"},"tax_category_id":{"type":"string"},"options":{"type":"array","description":"A variant on a product with option types should declare its option pairs (e.g. size + color) — one per option type it participates in. Option types and values are auto-created if missing.","items":{"type":"object","required":["name","value"],"properties":{"name":{"type":"string"},"value":{"type":"string"}}}},"position":{"type":"integer"},"barcode":{"type":"string"},"prices":{"type":"array","description":"Per-currency prices. Upserted by currency.","items":{"type":"object","required":["currency","amount"],"properties":{"currency":{"type":"string"},"amount":{"type":"string"},"compare_at_amount":{"type":"string","nullable":true}}}},"stock_items":{"type":"array","description":"Per-stock-location inventory. Upserted by stock_location_id.","items":{"type":"object","required":["stock_location_id","count_on_hand"],"properties":{"stock_location_id":{"type":"string","description":"Stock location ID (e.g. sloc_xxx)"},"count_on_hand":{"type":"integer"},"backorderable":{"type":"boolean"}}}}}}}}}}},"/api/v3/admin/products/{product_id}/variants/{id}":{"get":{"summary":"Get a variant","tags":["Variants"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single variant by ID.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Variant ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., images, prices, stock_items, option_values). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., sku,price,stock). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"variant found","content":{"application/json":{}}},"404":{"description":"variant not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a variant","tags":["Variants"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a variant. Only provided fields are updated.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Variant ID","schema":{"type":"string"}}],"responses":{"200":{"description":"variant updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"sku":{"type":"string"},"cost_price":{"type":"string"},"cost_currency":{"type":"string"},"weight":{"type":"number"},"height":{"type":"number"},"width":{"type":"number"},"depth":{"type":"number"},"weight_unit":{"type":"string"},"dimensions_unit":{"type":"string"},"track_inventory":{"type":"boolean"},"tax_category_id":{"type":"string"},"options":{"type":"array","description":"One pair per option type the variant participates in (e.g. size + color). Option types and values are auto-created if missing.","items":{"type":"object","required":["name","value"],"properties":{"name":{"type":"string"},"value":{"type":"string"}}}},"position":{"type":"integer"},"barcode":{"type":"string"},"prices":{"type":"array","description":"Per-currency prices. Upserted by currency.","items":{"type":"object","required":["currency","amount"],"properties":{"currency":{"type":"string"},"amount":{"type":"string"},"compare_at_amount":{"type":"string","nullable":true}}}},"stock_items":{"type":"array","description":"Per-stock-location inventory. Upserted by stock_location_id.","items":{"type":"object","required":["stock_location_id","count_on_hand"],"properties":{"stock_location_id":{"type":"string","description":"Stock location ID (e.g. sloc_xxx)"},"count_on_hand":{"type":"integer"},"backorderable":{"type":"boolean"}}}}}}}}}},"delete":{"summary":"Delete a variant","tags":["Variants"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes a variant.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Variant ID","schema":{"type":"string"}}],"responses":{"204":{"description":"variant deleted"}}}},"/api/v3/admin/webhook_endpoints/{webhook_endpoint_id}/deliveries":{"parameters":[{"name":"webhook_endpoint_id","in":"path","required":true,"description":"Parent webhook endpoint ID","schema":{"type":"string"}}],"get":{"summary":"List webhook deliveries","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns delivery attempts for the given endpoint, most recent first.\nEach row carries the original request payload, the response code\n(when the receiver replied), the execution time, and any transport\nerror — everything needed to audit failures and decide whether to\nredeliver.\n\n\n**Required scope:** `read_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[event_name_eq]","in":"query","required":false,"description":"Filter by event name (exact)","schema":{"type":"string"}},{"name":"q[success_eq]","in":"query","required":false,"description":"Filter by success flag","schema":{"type":"boolean"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-delivered_at`).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"deliveries found","content":{"application/json":{}}},"404":{"description":"parent webhook endpoint not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/webhook_endpoints/{webhook_endpoint_id}/deliveries/{id}":{"parameters":[{"name":"webhook_endpoint_id","in":"path","required":true,"description":"Parent webhook endpoint ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Webhook delivery ID","schema":{"type":"string"}}],"get":{"summary":"Get a webhook delivery","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single delivery attempt with the full request payload and\nthe response body the receiver returned. Use this for ad-hoc debug\nof failed deliveries.\n\n\n**Required scope:** `read_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"delivery found","content":{"application/json":{}}},"404":{"description":"delivery not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/webhook_endpoints/{webhook_endpoint_id}/deliveries/{id}/redeliver":{"parameters":[{"name":"webhook_endpoint_id","in":"path","required":true,"description":"Parent webhook endpoint ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Webhook delivery ID to redeliver","schema":{"type":"string"}}],"post":{"summary":"Redeliver a webhook delivery","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new delivery row with the same payload + event_name and\nqueues it. The original row is preserved for audit history.\n\n\n**Required scope:** `write_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"redelivery queued","content":{"application/json":{}}}}}},"/api/v3/admin/webhook_endpoints":{"get":{"summary":"List webhook endpoints","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns outbound webhook subscriptions for the current store. Each\nendpoint receives a signed POST when any subscribed event fires.\n`secret_key` is `null` on list reads — the plaintext is delivered\nexactly once on create.\n\n\n**Required scope:** `read_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"description":"Filter by name (contains)","schema":{"type":"string"}},{"name":"q[url_cont]","in":"query","required":false,"description":"Filter by URL (contains)","schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"webhook endpoints found","content":{"application/json":{}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a webhook endpoint","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new outbound webhook subscription. The plaintext\n`secret_key` is returned **once** in this response — persist it\nimmediately to verify incoming webhook signatures. Subsequent reads\nreturn `null` for the secret. Pass an empty `subscriptions` array or\nomit it to receive every event.\n\n\n**Required scope:** `write_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"webhook endpoint created — secret_key returned once","content":{"application/json":{}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["url"],"properties":{"name":{"type":"string"},"url":{"type":"string"},"active":{"type":"boolean"},"subscriptions":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/webhook_endpoints/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"Webhook endpoint ID","schema":{"type":"string"}}],"get":{"summary":"Get a webhook endpoint","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single webhook endpoint by prefixed ID.\n\n**Required scope:** `read_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"webhook endpoint found","content":{"application/json":{}}},"404":{"description":"webhook endpoint not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a webhook endpoint","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates name, URL, active flag, or the event subscription list.\nToggling `active` here is equivalent to calling `disable`/`enable`\nwithout an audit reason.\n\n\n**Required scope:** `write_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"webhook endpoint updated","content":{"application/json":{}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"url":{"type":"string"},"active":{"type":"boolean"},"subscriptions":{"type":"array","items":{"type":"string"}}}}}}}},"delete":{"summary":"Delete a webhook endpoint","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes the endpoint and stops future deliveries.\n\n**Required scope:** `write_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"204":{"description":"webhook endpoint deleted"}}}},"/api/v3/admin/webhook_endpoints/{id}/send_test":{"parameters":[{"name":"id","in":"path","required":true,"description":"Webhook endpoint ID","schema":{"type":"string"}}],"post":{"summary":"Send a test delivery","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a `webhook.test` delivery record and queues it. Use this to\nverify the endpoint is reachable and your signature verification\naccepts Spree's payloads.\n\n\n**Required scope:** `write_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"test delivery queued","content":{"application/json":{}}}}}},"/api/v3/admin/webhook_endpoints/{id}/enable":{"parameters":[{"name":"id","in":"path","required":true,"description":"Webhook endpoint ID","schema":{"type":"string"}}],"patch":{"summary":"Re-enable a webhook endpoint","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Re-enables an endpoint that was manually or automatically disabled.\n\n**Required scope:** `write_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"webhook endpoint enabled","content":{"application/json":{}}}}}},"/api/v3/admin/webhook_endpoints/{id}/disable":{"parameters":[{"name":"id","in":"path","required":true,"description":"Webhook endpoint ID","schema":{"type":"string"}}],"patch":{"summary":"Disable a webhook endpoint","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Manually pauses an endpoint. Unlike auto-disable (triggered after\nrepeated delivery failures), no notification email is sent.\n\n\n**Required scope:** `write_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"webhook endpoint disabled","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string"}}}}}}}},"/api/v3/admin/collections":{"get":{"summary":"List collections","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a paginated list of the store's collections.\n\n**Required scope:** `read_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., rules, custom_fields, translations).","schema":{"type":"string"}}],"responses":{"200":{"description":"collections found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Collection"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Create a collection","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a manual or automatic (rule-based) collection. For automatic collections, send the full desired rule set under `rules`.\n\n**Required scope:** `write_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"collection created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"automatic":{"type":"boolean"},"rules_match_policy":{"type":"string","enum":["all","any"]},"sort_order":{"type":"string"},"permalink":{"type":"string"},"description":{"type":"string"},"meta_title":{"type":"string"},"meta_description":{"type":"string"},"meta_keywords":{"type":"string"},"rules":{"type":"array","description":"Full desired rule set. Entries with an id update, id-less entries create, omitted rules are removed.","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"value":{"type":"string"},"match_policy":{"type":"string"}}}}},"required":["name"]}}}}}},"/api/v3/admin/collections/{id}":{"get":{"summary":"Get a collection","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single collection by ID, including its rules.\n\n**Required scope:** `read_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Collection ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., rules, custom_fields, translations).","schema":{"type":"string"}}],"responses":{"200":{"description":"collection found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}},"404":{"description":"collection not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a collection","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a collection. Send `position` to reorder it within the flat list; send the full `rules` set to sync automatic rules.\n\n**Required scope:** `write_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Collection ID","schema":{"type":"string"}}],"responses":{"200":{"description":"collection updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"permalink":{"type":"string"},"description":{"type":"string"},"meta_title":{"type":"string"},"meta_description":{"type":"string"},"meta_keywords":{"type":"string"},"sort_order":{"type":"string"},"automatic":{"type":"boolean"},"rules_match_policy":{"type":"string","enum":["all","any"]},"position":{"type":"integer","description":"Reorders the collection within the flat list (acts_as_list)"},"rules":{"type":"array","description":"Full desired rule set (see create).","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"value":{"type":"string"},"match_policy":{"type":"string"}}}}}}}}}},"delete":{"summary":"Delete a collection","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes a collection.\n\n**Required scope:** `write_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Collection ID","schema":{"type":"string"}}],"responses":{"204":{"description":"collection deleted"}}}},"/api/v3/admin/collections/{collection_id}/products":{"get":{"summary":"List collection products","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Products curated in the collection, ordered by their membership position.\n\n**Required scope:** `read_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"collection_id","in":"path","required":true,"description":"Collection ID","schema":{"type":"string"}}],"responses":{"200":{"description":"products found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Product"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Add a product to a collection","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Curates a product into the collection (appended to the end).\n\n**Required scope:** `write_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"collection_id","in":"path","required":true,"description":"Collection ID","schema":{"type":"string"}}],"responses":{"201":{"description":"product added","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"product_id":{"type":"string"}},"required":["product_id"]}}}}}},"/api/v3/admin/collections/{collection_id}/products/{id}":{"delete":{"summary":"Remove a product from a collection","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes a product from the collection's manual curation.\n\n**Required scope:** `write_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"collection_id","in":"path","required":true,"description":"Collection ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}}],"responses":{"204":{"description":"product removed"}}}},"/api/v3/admin/collections/{collection_id}/products/{id}/reposition":{"patch":{"summary":"Reposition a collection product","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Moves a product to a new index among the collection's products.\n\n**Required scope:** `write_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"collection_id","in":"path","required":true,"description":"Collection ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}}],"responses":{"204":{"description":"product repositioned"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"new_position":{"type":"integer","description":"0-based index among the collection's products"}},"required":["new_position"]}}}}}},"/api/v3/admin/collection_rules/types":{"get":{"summary":"List available collection rule types","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Enumerates the registered rule kinds with their labels and descriptions — drives the rule picker on an automatic collection. Plugins extend the list by registering `Spree::CollectionRule` subclasses via `config.spree.collection_rules`. The `type` returned here is the wire shorthand accepted when writing a collection's `rules`.\n\n**Required scope:** `read_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"types found","content":{"application/json":{}}}}}},"/api/v3/admin/commission_lines":{"get":{"summary":"List commission lines","tags":["Commission Lines"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"What each sale actually earned the marketplace, frozen when the order\nwas placed. A later change to a commission rate never reaches these.\n\n`amount` is the fee charged to the seller and `tax_amount` is the VAT on\nthat fee — the marketplace's own service to the seller, a supply\nseparate from the sale itself, which is why the two are not folded\ntogether. `total` is their sum.\n\nOne line per commissioned item, plus one per delivery when the rate that\napplied charges shipping too — read `line_item_id` and `fulfillment_id`\nto tell them apart.\n\nRead-only: correcting a charge is a reversal, not an edit.\n\n\n**Required scope:** `read_commissions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[vendor_id_eq]","in":"query","required":false,"description":"Filter to one seller","schema":{"type":"string"}},{"name":"q[order_id_eq]","in":"query","required":false,"description":"Filter to one order","schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).","schema":{"type":"string"}}],"responses":{"200":{"description":"commission lines found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CommissionLine"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/commission_lines/{id}":{"parameters":[{"name":"id","in":"path","description":"Commission line ID","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get a commission line","tags":["Commission Lines"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_commissions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"commission line found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommissionLine"}}}},"404":{"description":"commission line not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/commission_rates":{"get":{"summary":"List commission rates","tags":["Commission Rates"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"What the marketplace charges its sellers.\n\nRates are returned in resolution order: the list is walked top-down and\nthe first rate whose targeting matches the sale wins, so the order you\nsee is the precedence. Move a rate with `position` on update.\n\nA rate carrying no rules matches every sale — `global` says so — which\nis how a marketplace expresses a single default. Because resolution\nstops at the first match, a global rate makes everything below it\nunreachable, so it belongs at the bottom.\n\n\n**Required scope:** `read_commissions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"description":"Filter by name (contains)","schema":{"type":"string"}},{"name":"q[enabled_eq]","in":"query","required":false,"description":"Filter by whether the rate is in use","schema":{"type":"boolean"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-position`).","schema":{"type":"string"}}],"responses":{"200":{"description":"commission rates found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CommissionRate"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a commission rate","tags":["Commission Rates"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Sets what the marketplace charges, and which sales it applies to.\n\n`rules` is the rate's whole targeting, sent inline. Every rule has to\nhold, and a rule naming several records means any of them — so\n\"(Cameras OR Audio) AND that seller\" is a category rule holding two ids\nbeside a vendor rule holding one. Send no rules to charge every sale.\n\nRule kinds come from `GET /commission_rates/rule_types`, which also\ndescribes the configuration each one takes. A marketplace that adds its\nown kind sees it there without this endpoint changing.\n\n`commission_tax_rate` is VAT on the commission itself — the\nmarketplace's own service to the seller, a separate supply from the\nsale. Leave it null to let the store's tax engine answer for wherever\nthe seller's business sits.\n\n\n**Required scope:** `write_commissions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"commission rate created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommissionRate"}}}},"422":{"description":"validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name","kind","value"],"properties":{"name":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Your own identifier for this rate; unique per store."},"enabled":{"type":"boolean"},"position":{"type":"integer","description":"Place in the list. Rates resolve top-down, so 1 is tried first. New rates are created at the top; send this to move one."},"kind":{"type":"string","enum":["percentage","fixed"]},"value":{"type":"string","description":"A percentage (10 = 10%) or a flat amount, per `kind`."},"amounts":{"type":"object","additionalProperties":{"type":"string"},"description":"What a flat fee charges, keyed by currency. A currency with no amount is one this rate does not charge — those sales fall to the next rate. Ignored for a percentage."},"tax_inclusive":{"type":"boolean","description":"Charge on the price including the customer's VAT. Left off, commission is charged on the seller's net revenue, which is the usual basis where the fee is taxed as its own supply."},"include_shipping":{"type":"boolean","description":"Also charge commission on the seller's delivery revenue."},"bounds":{"type":"object","additionalProperties":{"type":"object","properties":{"min_amount":{"type":"string","nullable":true},"max_amount":{"type":"string","nullable":true}}},"description":"The floor and cap a percentage charges within, keyed by currency. Each holds only in its own currency; a sale in a currency with no bounds is charged unbounded."},"commission_tax_rate":{"type":"string","nullable":true,"description":"A fraction, not a percentage. Null asks the tax engine."},"rules":{"type":"array","description":"The full targeting; what you send replaces what the rate holds.","items":{"type":"object","properties":{"id":{"type":"string","description":"Present for an existing rule; omit to create one."},"type":{"type":"string","description":"A kind from /commission_rates/rule_types."},"preferences":{"type":"object","description":"Configuration for the kind, per its preference_schema."},"product_ids":{"type":"array","items":{"type":"string"},"description":"For kinds that name products, which are kept outside preferences."}}}}}}}}}}},"/api/v3/admin/commission_rates/rule_types":{"get":{"summary":"List the commission rule kinds","tags":["Commission Rates"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Every rule kind a rate can be narrowed by, with the schema describing\nthe configuration it takes — so a client builds its editor from what\nthis marketplace has rather than a list hardcoded to match core's.\n\n`association_fields` names any catalog-scale reference a kind keeps\noutside its preferences, so an editor knows to render a picker for it.\n\n\n**Required scope:** `read_commissions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"subject types found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"preference_schema":{"type":"array","items":{"type":"object"}},"association_fields":{"type":"array","items":{"type":"string"}}}}}}}}}}}}},"/api/v3/admin/commission_rates/{id}":{"parameters":[{"name":"id","in":"path","description":"Commission rate ID","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get a commission rate","tags":["Commission Rates"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_commissions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"commission rate found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommissionRate"}}}},"404":{"description":"commission rate not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a commission rate","tags":["Commission Rates"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Editing a rate changes what the next sale is charged, never what a past\none was: commission lines keep their own snapshot of the rate that\napplied.\n\n\n**Required scope:** `write_commissions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"commission rate updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommissionRate"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"enabled":{"type":"boolean"},"position":{"type":"integer"},"value":{"type":"string"},"rules":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"preferences":{"type":"object"},"product_ids":{"type":"array","items":{"type":"string"}}}}}}}}}}},"delete":{"summary":"Delete a commission rate","tags":["Commission Rates"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_commissions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"commission rate deleted"}}}},"/api/v3/admin/companies/{company_id}/locations":{"get":{"summary":"List company locations","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the branches of a business customer. Each branch owns its own addresses and the buyers authorised to purchase for it.\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"locations found","content":{"application/json":{}}}}},"post":{"summary":"Create a company location","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a branch. Addresses are supplied inline and belong to the branch, so editing one later changes the branch's own record rather than an address the buyer also uses.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"location created","content":{"application/json":{}}},"422":{"description":"invalid request","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"external_id":{"type":"string","nullable":true},"billing_address":{"type":"object","description":"Created inline and owned by the branch.","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"address1":{"type":"string"},"city":{"type":"string"},"postal_code":{"type":"string"},"country_code":{"type":"string"}}}},"required":["name"]}}}}}},"/api/v3/admin/company_locations/{id}":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get a company location","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Branches are addressed by their own id once you hold one — the company id is not needed.\n\n**Required scope:** `read_customers` (for API-key authentication).","responses":{"200":{"description":"location found","content":{"application/json":{}}}}},"patch":{"summary":"Update a company location","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Address fields sent here edit the branch's existing address in place; send only what changes.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[],"responses":{"200":{"description":"location updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"billing_address":{"type":"object","properties":{"city":{"type":"string"}}}}}}}}},"delete":{"summary":"Delete a company location","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes the branch, its buyers and the addresses it owned.\n\n**Required scope:** `write_customers` (for API-key authentication).","responses":{"204":{"description":"location deleted"}}}},"/api/v3/admin/companies/{company_id}/tax_exemption_certificates":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"List tax exemption certificates","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a business's exemption evidence. `active` is the field that decides whether a certificate\nexempts a sale: a verified certificate stops counting once its expiry date passes, so the status\nalone does not answer it.\n\n\n**Required scope:** `read_customers` (for API-key authentication).","responses":{"200":{"description":"certificates found","content":{"application/json":{}}}}},"post":{"summary":"Create a tax exemption certificate","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Records exemption evidence against a business. Certificates start `pending` and exempt nothing\nuntil verified.\n\n`country_code` and `state_code` say where the certificate holds — omit both for one valid\neverywhere, give only the country for one valid throughout it. `document` takes an ActiveStorage\nsigned blob id obtained from `POST /api/v3/admin/direct_uploads`.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[],"responses":{"201":{"description":"certificate created","content":{"application/json":{}}},"422":{"description":"invalid request","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"certificate_number":{"type":"string"},"reason_code":{"type":"string","description":"Becomes the tax provider's entity use code."},"country_code":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true},"expires_at":{"type":"string","format":"date-time","nullable":true},"issuing_authority":{"type":"string","nullable":true},"document":{"type":"string","description":"ActiveStorage signed blob id from POST /api/v3/admin/direct_uploads."}},"required":["certificate_number","reason_code"]}}}}}},"/api/v3/admin/companies/{company_id}/tax_exemption_certificates/{id}/verify":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"summary":"Verify a tax exemption certificate","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Accepts the certificate as evidence, which is what makes it exempt sales. Only a pending\ncertificate can be accepted — re-accepting a revoked one would restore evidence that was\ndeliberately withdrawn. An installation that checks numbers against a registry, or requires a\nsecond approval, can refuse here, and the refusal is returned as a validation error.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","responses":{"200":{"description":"certificate verified","content":{"application/json":{}}}}}},"/api/v3/admin/companies/{company_id}/tax_exemption_certificates/{id}/revoke":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"summary":"Revoke a tax exemption certificate","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Withdraws accepted evidence. A verified certificate cannot be deleted — how a sale was taxed has to remain explainable — so revoking is the way out.\n\n**Required scope:** `write_customers` (for API-key authentication).","responses":{"200":{"description":"certificate revoked","content":{"application/json":{}}}}}},"/api/v3/admin/companies/{company_id}/tax_exemption_certificates/{id}/download":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"Download a certificate document","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Streams the uploaded document. Deliberately not a storage link: the bytes come through the API so\nthe same credentials apply to every read of a confidential document. Requires only read access.\n\n\n**Required scope:** `read_customers` (for API-key authentication).","responses":{"200":{"description":"document streamed","content":{"application/json":{}}},"422":{"description":"no document attached","content":{"application/json":{}}}}}},"/api/v3/admin/companies/{company_id}/tax_identifiers":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"List company tax registrations","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the business's tax registrations, one per kind. A business registration takes precedence\nover the buyer's own when a sale is for that business, because the invoice is addressed to the\nentity rather than the person who placed the order.\n\n\n**Required scope:** `read_customers` (for API-key authentication).","responses":{"200":{"description":"registrations found","content":{"application/json":{}}}}},"post":{"summary":"Create a company tax registration","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Registers a tax number against the business. Verification against the relevant registry runs in\nthe background where a validator is installed for the kind; a stock installation registers none,\nleaving the status unattempted.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[],"responses":{"201":{"description":"registration created","content":{"application/json":{}}},"422":{"description":"invalid request","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","description":"The regime the number belongs to."},"value":{"type":"string"}},"required":["kind","value"]}}}}}},"/api/v3/admin/companies/{company_id}/tax_identifiers/{id}/validate":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"post":{"summary":"Re-check a company tax registration","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Asks the registry again. Manual because a registry answers only \"valid now\" — a number verified\nlast year may have been deregistered since — and because a check that came back unavailable\ncannot otherwise be retried without editing the number.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","responses":{"422":{"description":"no validator installed for this kind","content":{"application/json":{}}}}}},"/api/v3/admin/companies":{"get":{"summary":"List companies","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the business customers of the current store.\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"companies found","content":{"application/json":{}}}}},"post":{"summary":"Create a company","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a business customer. Exemption certificates and tax registrations hang off it.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"company created","content":{"application/json":{}}},"422":{"description":"invalid request","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"external_id":{"type":"string","nullable":true,"description":"Your own reference for this business, unique within the store."}},"required":["name"]}}}}}},"/api/v3/admin/company_locations/{company_location_id}/contacts":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_location_id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"List company contacts","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the customers authorised to purchase for a branch. A customer may act for more than one branch.\n\n**Required scope:** `read_customers` (for API-key authentication).","responses":{"200":{"description":"contacts found","content":{"application/json":{}}}}},"post":{"summary":"Create a company contact","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Authorises a customer to purchase for a branch. A customer who acts for exactly one branch has\ntheir orders attributed to it automatically; one who acts for several needs the branch set on\nthe order, because guessing would invoice the wrong business.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[],"responses":{"201":{"description":"contact created","content":{"application/json":{}}},"422":{"description":"invalid request","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"customer_id":{"type":"string"},"role":{"type":"string","description":"Free-form label; carries no permissions in 6.0."}},"required":["customer_id"]}}}}}},"/api/v3/admin/company_contacts/{id}":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get a company contact","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_customers` (for API-key authentication).","responses":{"200":{"description":"contact found","content":{"application/json":{}}}}},"delete":{"summary":"Delete a company contact","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Withdraws the customer's authority to purchase for the branch. The customer account itself is untouched.\n\n**Required scope:** `write_customers` (for API-key authentication).","responses":{"204":{"description":"contact deleted"}}}},"/api/v3/admin/delivery_profiles":{"get":{"summary":"List delivery profiles","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Fulfillment profiles group products with the stock locations, delivery zones and delivery methods that fulfill them. Every store has exactly one default profile.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"delivery profiles found","content":{"application/json":{}}}}},"post":{"summary":"Create a delivery profile","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a delivery profile. `kind` selects the registered profile kind (shipping, digital, extension kinds); `stock_location_ids` limits fulfillment to those locations — empty means every store location.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"delivery profile created","content":{"application/json":{}}},"422":{"description":"validation error","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"kind":{"type":"string","description":"Registered profile kind; defaults to shipping."},"default":{"type":"boolean"},"stock_location_ids":{"type":"array","items":{"type":"string"},"description":"Empty means every store location."}},"required":["name"]}}}}}},"/api/v3/admin/delivery_profiles/{delivery_profile_id}/origin_groups":{"parameters":[{"name":"delivery_profile_id","in":"path","required":true,"schema":{"type":"string"}}],"post":{"summary":"Create an origin group","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Origin groups partition a profile's fulfillment origins: zones and methods belong to a group, so the same products can quote different rate tables per warehouse. `stock_location_ids` replaces the full membership; empty means every store location.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"origin group created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","nullable":true},"position":{"type":"integer","nullable":true},"stock_location_ids":{"type":"array","items":{"type":"string"},"description":"Empty means every store location."}}}}}}}},"/api/v3/admin/delivery_profiles/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"summary":"Update a delivery profile","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"delivery profile updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"default":{"type":"boolean"},"stock_location_ids":{"type":"array","items":{"type":"string"}}}}}}}},"delete":{"summary":"Delete a delivery profile","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"The default profile and profiles still referenced by products cannot be deleted.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"delivery profile deleted"}}}},"/api/v3/admin/delivery_methods":{"get":{"summary":"List delivery methods","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns all delivery methods with calculator and zone configuration.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"delivery methods found","content":{"application/json":{}}}}},"post":{"summary":"Create delivery method","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a delivery method inside a delivery profile (defaults to the store default profile). Delivery behavior comes from the fulfillment provider.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"delivery method created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"admin_name":{"type":"string","nullable":true},"code":{"type":"string","nullable":true},"fulfillment_provider":{"type":"string","nullable":true},"delivery_profile_id":{"type":"string","nullable":true},"storefront_visible":{"type":"boolean"},"tracking_url":{"type":"string","nullable":true},"estimated_transit_business_days_min":{"type":"integer","nullable":true},"estimated_transit_business_days_max":{"type":"integer","nullable":true},"tax_category_id":{"type":"string","nullable":true},"calculator_type":{"type":"string"},"calculator_preferences":{"type":"object"},"delivery_zone_id":{"type":"string","nullable":true}},"required":["name"]}}}}}},"/api/v3/admin/delivery_methods/calculators":{"get":{"summary":"List delivery calculators","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Registered delivery calculator classes with preference schemas for building configuration forms.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"calculators found","content":{"application/json":{}}}}}},"/api/v3/admin/delivery_zones":{"post":{"summary":"Create delivery zone","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a delivery zone with typed members: country, state, or postal_code (prefix or from/to range).\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to embed, e.g. `members`","schema":{"type":"string"}}],"responses":{"201":{"description":"delivery zone created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"members":{"type":"array","items":{"type":"object","properties":{"member_type":{"type":"string","enum":["country","state","postal_code"]},"country_code":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true},"postal_code_prefix":{"type":"string","nullable":true},"postal_code_from":{"type":"string","nullable":true},"postal_code_to":{"type":"string","nullable":true}},"required":["member_type"]}}},"required":["name"]}}}}}},"/api/v3/admin/integrations":{"get":{"summary":"List integrations","tags":["Integrations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the integrations connected to the current store. Secret preference values are masked.\n\n**Required scope:** `read_integrations` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"integrations found","content":{"application/json":{}}}}},"post":{"summary":"Connect integration","tags":["Integrations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Connects an integration type to the current store. Setting active: true verifies the connection and fails with 422 when it cannot connect. Submitting a masked secret value back keeps the stored secret.\n\n**Required scope:** `write_integrations` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"integration connected","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"Wire shorthand from GET /integrations/types"},"active":{"type":"boolean"},"preferences":{"type":"object"}},"required":["type"]}}}}}},"/api/v3/admin/integrations/types":{"get":{"summary":"List integration types","tags":["Integrations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Every registered integration type with its gallery metadata and configuration schema. Pure registry discovery — read live connection state from GET /integrations.\n\n**Required scope:** `read_integrations` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"integration types found","content":{"application/json":{}}}}}},"/api/v3/admin/integrations/{id}/test":{"post":{"summary":"Test integration connection","tags":["Integrations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Runs a live connection check against the provider. Nothing is persisted; a failed check reports the vendor error message.\n\n**Required scope:** `write_integrations` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"connection checked","content":{"application/json":{}}}}}},"/api/v3/admin/product_types":{"get":{"summary":"List product types","tags":["Product Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a paginated list of product types.\n\nA product type is a back-office template: it seeds option types and\ncategories onto products created with it, and defines which custom\nfields those products' forms show. It is not exposed on the Store API.\n\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}}],"responses":{"200":{"description":"product types found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ProductType"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a product type","tags":["Product Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a product type.\n\n`option_type_ids` and `category_ids` seed products created with this\ntype. `custom_field_definitions` is a replace-set of the definitions the\nproduct form renders, in `sort_order`. `required` is advisory — the\ndashboard marks the field, but a blank value is never rejected.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"product type created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductType"}}}},"422":{"description":"unprocessable entity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"delivery_profile_id":{"type":"string","nullable":true,"description":"Fulfillment profile stamped onto products created with this type. Null leaves new products on the store default profile."},"option_type_ids":{"type":"array","items":{"type":"string"},"description":"Option types seeded onto products created with this type."},"category_ids":{"type":"array","items":{"type":"string"},"description":"Categories seeded onto products created with this type."},"custom_field_definitions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Prefixed custom field definition id."},"required":{"type":"boolean"},"sort_order":{"type":"integer"}}}}},"required":["name"]}}}}}},"/api/v3/admin/product_types/{id}":{"parameters":[{"name":"id","in":"path","description":"Product type ID","required":true,"schema":{"type":"string"}}],"get":{"summary":"Retrieve a product type","tags":["Product Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single product type with its option types, categories and custom fields.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"product type found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductType"}}}},"404":{"description":"product type not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a product type","tags":["Product Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a product type.\n\nChanges never modify products that already carry the type — use\n`apply_to_products` to backfill those.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"product type updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductType"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"delivery_profile_id":{"type":"string","nullable":true},"option_type_ids":{"type":"array","items":{"type":"string"}},"category_ids":{"type":"array","items":{"type":"string"}},"custom_field_definitions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"required":{"type":"boolean"},"sort_order":{"type":"integer"}}}}}}}}}},"delete":{"summary":"Delete a product type","tags":["Product Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes a product type. Types still used by products cannot be deleted.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"204":{"description":"product type deleted"}}}},"/api/v3/admin/product_types/{id}/apply_to_products":{"parameters":[{"name":"id","in":"path","description":"Product type ID","required":true,"schema":{"type":"string"}}],"post":{"summary":"Apply a product type to its existing products","tags":["Product Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Backfills the type's option types and categories onto the products that\nalready carry it. Additive and idempotent — nothing is removed, and\nre-running is safe.\n\nRuns in the background; the response reports how many products the type\ncurrently has.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"202":{"description":"backfill accepted","content":{"application/json":{"schema":{"type":"object","properties":{"products_count":{"type":"integer"}}}}}}}}},"/api/v3/admin/vendors":{"get":{"summary":"List vendors","tags":["Vendors"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the sellers on this marketplace. `status` says where each one\nis in its life on the marketplace, and `sellable` answers the question\nthe status alone cannot: an approved vendor who is away cannot be\nbought from either.\n\n\n**Required scope:** `read_vendors` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"description":"Filter by name (contains)","schema":{"type":"string"}},{"name":"q[status_eq]","in":"query","required":false,"description":"Filter by status","schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).","schema":{"type":"string"}}],"responses":{"200":{"description":"vendors found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Vendor"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a vendor","tags":["Vendors"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Opens a seller record. The vendor starts as `pending` and has no team\nyet — invite someone to run it with the `invite` action below.\n\n`status` is deliberately not writable here or on update: every move\nthrough the lifecycle is its own action, because each one does more\nthan set a column.\n\n\n**Required scope:** `write_vendors` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"vendor created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Vendor"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"slug":{"type":"string","description":"Derived from the name when omitted."},"contact_email":{"type":"string","nullable":true},"billing_email":{"type":"string","nullable":true},"about":{"type":"string","nullable":true},"tax_remittance":{"type":"string","enum":["vendor","platform"]},"payouts_schedule_interval":{"type":"string","enum":["daily","weekly","biweekly","monthly","manual"],"nullable":true},"minimum_payout_amount":{"type":"string","nullable":true}}}}}}}},"/api/v3/admin/vendors/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"Vendor prefixed ID","schema":{"type":"string"}}],"get":{"summary":"Get a vendor","tags":["Vendors"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single vendor, including its settlement and tax configuration.\n\n**Required scope:** `read_vendors` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"vendor found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Vendor"}}}},"404":{"description":"vendor not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a vendor","tags":["Vendors"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates the vendor's profile and the settlement configuration the\noperator owns. A `status` sent here is ignored — use the lifecycle\nactions.\n\n\n**Required scope:** `write_vendors` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"vendor address written inline","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Vendor"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"billing_email":{"type":"string","nullable":true},"payouts_schedule_interval":{"type":"string","enum":["daily","weekly","biweekly","monthly","manual"],"nullable":true},"minimum_payout_amount":{"type":"string","nullable":true},"holiday_mode_until":{"type":"string","format":"date-time","nullable":true},"logo":{"type":"string","nullable":true,"description":"ActiveStorage signed id of a direct-uploaded file. Send `null` to remove the attachment, or omit the key to leave it alone. Same for `square_logo` and `cover_photo`."},"square_logo":{"type":"string","nullable":true},"cover_photo":{"type":"string","nullable":true},"billing_address":{"type":"object","description":"The vendor's own address, written inline. There is no `billing_address_id` — an address belongs to whoever it was created for, so it is never referenced by id here.","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"company":{"type":"string"},"address1":{"type":"string"},"address2":{"type":"string"},"city":{"type":"string"},"postal_code":{"type":"string"},"phone":{"type":"string"},"country_code":{"type":"string"},"state_code":{"type":"string"},"state_name":{"type":"string"},"label":{"type":"string"}}},"returns_address":{"type":"object","description":"The vendor's own address, written inline. There is no `billing_address_id` — an address belongs to whoever it was created for, so it is never referenced by id here.","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"company":{"type":"string"},"address1":{"type":"string"},"address2":{"type":"string"},"city":{"type":"string"},"postal_code":{"type":"string"},"phone":{"type":"string"},"country_code":{"type":"string"},"state_code":{"type":"string"},"state_name":{"type":"string"},"label":{"type":"string"}}}}}}}}},"delete":{"summary":"Delete a vendor","tags":["Vendors"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes the vendor. Their products are kept and left without a\nseller rather than deleted — what happens to a departed seller's\ncatalog is the operator's decision.\n\n\n**Required scope:** `write_vendors` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"vendor deleted"}}}},"/api/v3/admin/vendors/{id}/invite":{"parameters":[{"name":"id","in":"path","required":true,"description":"Vendor prefixed ID","schema":{"type":"string"}}],"post":{"summary":"Invite someone to run a vendor","tags":["Vendors"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Sends an invitation to the vendor's own team and moves the vendor to\n`invited`. The person becomes a member when they accept, and can then\nsign in to the vendor panel.\n\n`role_id` must name a role this vendor owns; omit it for the vendor's\nown admin role. Re-inviting is allowed — an invitation expires, or the\nfirst one goes to the wrong address.\n\n\n**Required scope:** `write_vendors` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"invitation sent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Vendor"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string"},"role_id":{"type":"string","nullable":true}}}}}}}},"/api/v3/admin/vendors/{id}/approve":{"parameters":[{"name":"id","in":"path","required":true,"description":"Vendor prefixed ID","schema":{"type":"string"}}],"patch":{"summary":"Approve a vendor","tags":["Vendors"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Lets the vendor sell. This is also the way back for one that was\nsuspended or turned down, and it clears any holiday along with the\nsuspension.\n\n\n**Required scope:** `write_vendors` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"vendor approved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Vendor"}}}},"422":{"description":"vendor cannot be approved from its current status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/vendors/{id}/suspend":{"parameters":[{"name":"id","in":"path","required":true,"description":"Vendor prefixed ID","schema":{"type":"string"}}],"patch":{"summary":"Suspend a vendor","tags":["Vendors"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Stops a trading vendor from selling. Their catalog and history stay,\nand approving reinstates them. Use this rather than `reject` for a\nvendor already on the marketplace — it says something different, and\nit can be undone.\n\n\n**Required scope:** `write_vendors` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"vendor suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Vendor"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string"}}}}}}}},"/api/v3/admin/vendors/{id}/reject":{"parameters":[{"name":"id","in":"path","required":true,"description":"Vendor prefixed ID","schema":{"type":"string"}}],"patch":{"summary":"Reject a vendor","tags":["Vendors"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Turns down an applicant who never traded. A vendor already selling is\nsuspended instead; rejecting one is refused.\n\n\n**Required scope:** `write_vendors` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"vendor rejected","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Vendor"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string"}}}}}}}}},"components":{"schemas":{"PaginationMeta":{"type":"object","properties":{"page":{"type":"integer"},"limit":{"type":"integer"},"count":{"type":"integer","description":"Total number of records"},"pages":{"type":"integer","description":"Total number of pages"},"from":{"type":"integer","description":"Index of first record on this page"},"to":{"type":"integer","description":"Index of last record on this page"},"in":{"type":"integer","description":"Number of records on this page"},"previous":{"type":"integer","nullable":true,"description":"Previous page number"},"next":{"type":"integer","nullable":true,"description":"Next page number"}},"required":["page","limit","count","pages","from","to","in"]},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","description":"Field-specific validation errors","nullable":true}},"required":["code","message"]}},"required":["error"]},"AuthResponse":{"type":"object","properties":{"token":{"type":"string","description":"JWT access token"},"user":{"$ref":"#/components/schemas/AdminUser"}},"required":["token","user"]},"PermissionRule":{"type":"object","description":"A single permission rule (CanCanCan rule). Rules are applied in order, last-matching-wins.","properties":{"allow":{"type":"boolean","description":"true for `can`, false for `cannot`"},"actions":{"type":"array","items":{"type":"string"},"description":"Action names, e.g. [\"read\", \"update\"] or [\"manage\"]"},"subjects":{"type":"array","items":{"type":"string"},"description":"Subject class names, e.g. [\"Spree::Product\"] or [\"all\"]"},"has_conditions":{"type":"boolean","description":"True if the server-side rule has per-record conditions. The SPA shows the action optimistically and handles 403 from the API."}},"required":["allow","actions","subjects","has_conditions"]},"MeResponse":{"type":"object","description":"Current admin user profile and serialized permissions","properties":{"user":{"$ref":"#/components/schemas/AdminUser"},"permissions":{"type":"array","items":{"$ref":"#/components/schemas/PermissionRule"}}},"required":["user","permissions"]},"ImportSchemaField":{"type":"object","description":"A canonical column of an import type, including per-store custom field columns","properties":{"name":{"type":"string","description":"Canonical field name used in mappings"},"label":{"type":"string","description":"Human-readable label"},"required":{"type":"boolean","description":"Whether the field must be mapped before processing"}},"required":["name","label","required"]},"CheckoutRequirement":{"type":"object","properties":{"step":{"type":"string","description":"Checkout step this requirement belongs to"},"field":{"type":"string","description":"Field that needs to be satisfied"},"message":{"type":"string","description":"Human-readable requirement message"}},"required":["step","field","message"]},"CartWarning":{"type":"object","description":"A warning about a cart issue (e.g., item removed due to stock change)","properties":{"code":{"type":"string","description":"Machine-readable warning code"},"message":{"type":"string","description":"Human-readable warning message"},"line_item_id":{"type":"string","nullable":true,"description":"Prefixed line item ID (when applicable)"},"variant_id":{"type":"string","nullable":true,"description":"Prefixed variant ID (when applicable)"},"item_index":{"type":"integer","nullable":true,"description":"Position in the submitted items array, for warnings raised while applying a batch of item changes"}},"required":["code","message"]},"FulfillmentManifestItem":{"type":"object","description":"An item within a fulfillment — which line item and how many units are in this fulfillment","properties":{"item_id":{"type":"string","description":"Line item ID"},"variant_id":{"type":"string","description":"Variant ID"},"quantity":{"type":"integer","description":"Quantity in this fulfillment"}},"required":["item_id","variant_id","quantity"]},"AdminUserRoleAssignment":{"type":"object","description":"A role assignment for the current store on a staff member","properties":{"id":{"type":"string","description":"Prefixed role ID"},"name":{"type":"string","description":"Role name"}},"required":["id","name"]},"AdminUserStore":{"type":"object","description":"A store the staff member can access through a role assignment","properties":{"id":{"type":"string","description":"Prefixed store ID"},"name":{"type":"string","description":"Store name"},"code":{"type":"string","description":"Store code"}},"required":["id","name","code"]},"PreferenceField":{"type":"object","description":"A single configurable preference on a payment method, promotion rule/action, or calculator. The frontend uses `type` + `default` to render a sensible input.","properties":{"key":{"type":"string"},"type":{"type":"string","description":"string | text | password | integer | decimal | boolean | array | hash"},"default":{"description":"Default value (any JSON type), null when there is no default","nullable":true}},"required":["key","type"]},"PromotionActionCalculator":{"type":"object","description":"The action's nested calculator (when the action carries one — null for actions like `free_shipping`)","properties":{"type":{"type":"string","description":"Wire shorthand for the calculator subclass"},"label":{"type":"string"},"preferences":{"type":"object","additionalProperties":true},"preference_schema":{"type":"array","items":{"$ref":"#/components/schemas/PreferenceField"}}},"required":["type","label","preferences","preference_schema"]},"PromotionActionLineItem":{"type":"object","description":"One row in a `create_line_items` action — the variant added to the order and how many","properties":{"variant_id":{"type":"string"},"quantity":{"type":"integer"}},"required":["variant_id","quantity"]},"Address":{"type":"object","properties":{"id":{"type":"string"},"first_name":{"type":"string","nullable":true},"last_name":{"type":"string","nullable":true},"full_name":{"type":"string"},"address1":{"type":"string","nullable":true},"address2":{"type":"string","nullable":true},"postal_code":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"country_name":{"type":"string"},"country_code":{"type":"string"},"state_text":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true},"quick_checkout":{"type":"boolean"},"is_default_billing":{"type":"boolean"},"is_default_shipping":{"type":"boolean"},"state_abbr":{"type":"string","nullable":true},"country_iso":{"type":"string"},"state_name":{"type":"string","nullable":true},"label":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"customer_id":{"type":"string","nullable":true}},"required":["id","first_name","last_name","full_name","address1","address2","postal_code","city","phone","company","country_name","country_code","state_text","state_code","quick_checkout","is_default_billing","is_default_shipping","state_abbr","country_iso","state_name","label","metadata","created_at","updated_at","customer_id"],"x-typelizer":true},"AdminUser":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"first_name":{"type":"string","nullable":true},"last_name":{"type":"string","nullable":true},"full_name":{"type":"string","nullable":true},"selected_locale":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"avatar_url":{"type":"string","nullable":true},"roles":{"type":"array","items":{"$ref":"#/components/schemas/AdminUserRoleAssignment"}},"stores":{"type":"array","items":{"$ref":"#/components/schemas/AdminUserStore"}}},"required":["id","email","first_name","last_name","full_name","selected_locale","created_at","updated_at","avatar_url","roles","stores"],"x-typelizer":true},"AllowedOrigin":{"type":"object","properties":{"id":{"type":"string"},"origin":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","origin","created_at","updated_at"],"x-typelizer":true},"ApiKey":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"key_type":{"type":"string"},"token_prefix":{"type":"string","nullable":true},"scopes":{"type":"array","items":{"type":"string"}},"created_at":{"type":"string"},"updated_at":{"type":"string"},"revoked_at":{"type":"string","nullable":true},"last_used_at":{"type":"string","nullable":true},"channel_id":{"type":"string","nullable":true},"plaintext_token":{"type":"string","nullable":true},"created_by_email":{"type":"string","nullable":true}},"required":["id","name","key_type","token_prefix","scopes","created_at","updated_at","revoked_at","last_used_at","channel_id","plaintext_token","created_by_email"],"x-typelizer":true},"AppliedPromotion":{"type":"object","properties":{"id":{"type":"string"},"promotion_id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"code":{"type":"string","nullable":true},"amount":{"type":"string"},"display_amount":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","promotion_id","name","description","code","amount","display_amount","created_at","updated_at"],"x-typelizer":true},"Cart":{"type":"object","properties":{"id":{"type":"string"},"market_id":{"type":"string","nullable":true},"channel_id":{"type":"string","nullable":true},"preferred_stock_location_id":{"type":"string","nullable":true},"number":{"type":"string"},"token":{"type":"string"},"email":{"type":"string","nullable":true},"customer_note":{"type":"string","nullable":true},"currency":{"type":"string"},"locale":{"type":"string","nullable":true},"total_quantity":{"type":"number"},"warnings":{"type":"array","items":{"$ref":"#/components/schemas/CartWarning"}},"coupon_code":{"type":"string","nullable":true},"item_total":{"type":"string","nullable":true},"display_item_total":{"type":"string","nullable":true},"adjustment_total":{"type":"string","nullable":true},"display_adjustment_total":{"type":"string","nullable":true},"discount_total":{"type":"string","nullable":true},"display_discount_total":{"type":"string","nullable":true},"tax_total":{"type":"string","nullable":true},"display_tax_total":{"type":"string","nullable":true},"included_tax_total":{"type":"string","nullable":true},"display_included_tax_total":{"type":"string","nullable":true},"additional_tax_total":{"type":"string","nullable":true},"display_additional_tax_total":{"type":"string","nullable":true},"total":{"type":"string","nullable":true},"display_total":{"type":"string","nullable":true},"gift_card_total":{"type":"string","nullable":true},"display_gift_card_total":{"type":"string","nullable":true},"amount_due":{"type":"string","nullable":true},"display_amount_due":{"type":"string","nullable":true},"delivery_total":{"type":"string","nullable":true},"display_delivery_total":{"type":"string","nullable":true},"fee_total":{"type":"string","nullable":true},"display_fee_total":{"type":"string","nullable":true},"store_credit_total":{"type":"string","nullable":true},"display_store_credit_total":{"type":"string","nullable":true},"covered_by_store_credit":{"type":"boolean"},"current_step":{"type":"string"},"completed_steps":{"type":"array","items":{"type":"string"}},"requirements":{"type":"array","items":{"$ref":"#/components/schemas/CheckoutRequirement"}},"shipping_eq_billing_address":{"type":"boolean"},"items":{"type":"array","items":{"$ref":"#/components/schemas/LineItem"}},"billing_address":{"allOf":[{"$ref":"#/components/schemas/Address"}],"nullable":true},"shipping_address":{"allOf":[{"$ref":"#/components/schemas/Address"}],"nullable":true},"market":{"allOf":[{"$ref":"#/components/schemas/Market"}],"nullable":true},"completed_at":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"applied_promotions":{"type":"array","items":{"$ref":"#/components/schemas/AppliedPromotion"}}},"required":["id","market_id","channel_id","preferred_stock_location_id","number","token","email","customer_note","currency","locale","total_quantity","warnings","coupon_code","item_total","display_item_total","adjustment_total","display_adjustment_total","discount_total","display_discount_total","tax_total","display_tax_total","included_tax_total","display_included_tax_total","additional_tax_total","display_additional_tax_total","total","display_total","gift_card_total","display_gift_card_total","amount_due","display_amount_due","delivery_total","display_delivery_total","fee_total","display_fee_total","store_credit_total","display_store_credit_total","covered_by_store_credit","current_step","completed_steps","requirements","shipping_eq_billing_address","items","billing_address","shipping_address","market","completed_at","created_at","updated_at","applied_promotions"],"x-typelizer":true},"Category":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"permalink":{"type":"string"},"position":{"type":"number"},"depth":{"type":"number"},"meta_title":{"type":"string","nullable":true},"meta_description":{"type":"string","nullable":true},"meta_keywords":{"type":"string","nullable":true},"children_count":{"type":"number"},"parent_id":{"type":"string","nullable":true},"description":{"type":"string"},"description_html":{"type":"string"},"image_url":{"type":"string","nullable":true},"square_image_url":{"type":"string","nullable":true},"is_root":{"type":"boolean"},"is_child":{"type":"boolean"},"is_leaf":{"type":"boolean"},"parent":{"$ref":"#/components/schemas/Category"},"children":{"type":"array","items":{"$ref":"#/components/schemas/Category"}},"ancestors":{"type":"array","items":{"$ref":"#/components/schemas/Category"}},"custom_fields":{"type":"array","items":{"$ref":"#/components/schemas/CustomField"}},"translations":{"type":"object"},"metadata":{"type":"object"},"pretty_name":{"type":"string"},"lft":{"type":"number"},"rgt":{"type":"number"},"products_count":{"type":"number"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","name","permalink","position","depth","meta_title","meta_description","meta_keywords","children_count","parent_id","description","description_html","image_url","square_image_url","is_root","is_child","is_leaf","metadata","pretty_name","lft","rgt","products_count","created_at","updated_at"],"x-typelizer":true},"Channel":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"code":{"type":"string"},"active":{"type":"boolean"},"default":{"type":"boolean"},"storefront_access":{"type":"string"},"guest_checkout":{"type":"boolean"},"preferred_order_routing_strategy":{"type":"string","nullable":true},"preferred_storefront_access":{"type":"string","nullable":true},"preferred_guest_checkout":{"type":"boolean","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"stock_location_ids":{"type":"array","items":{"type":"string"}}},"required":["id","name","code","active","default","storefront_access","guest_checkout","preferred_order_routing_strategy","preferred_storefront_access","preferred_guest_checkout","created_at","updated_at","stock_location_ids"],"x-typelizer":true},"ClaimLineItem":{"type":"object","properties":{"id":{"type":"string"},"quantity":{"type":"number"},"send_replacement":{"type":"boolean"},"description":{"type":"string","nullable":true},"refund_amount":{"type":"string"},"paid_amount":{"type":"string"},"display_refund_amount":{"type":"string"},"variant_id":{"type":"string","nullable":true},"replacement_variant_id":{"type":"string","nullable":true},"line_item_id":{"type":"string","nullable":true},"variant":{"$ref":"#/components/schemas/Variant"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"replacement_variant":{"$ref":"#/components/schemas/Variant"}},"required":["id","quantity","send_replacement","description","refund_amount","paid_amount","display_refund_amount","variant_id","replacement_variant_id","line_item_id","created_at","updated_at"],"x-typelizer":true},"ClaimReason":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"active":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"can_be_deleted":{"type":"boolean"}},"required":["id","name","active","created_at","updated_at","can_be_deleted"],"x-typelizer":true},"Claim":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"status":{"type":"string"},"resolution":{"type":"string","nullable":true},"order_id":{"type":"string","nullable":true},"reason_id":{"type":"string","nullable":true},"refund_total":{"type":"string"},"display_refund_total":{"type":"string"},"approved_at":{"type":"string","nullable":true},"resolved_at":{"type":"string","nullable":true},"denied_at":{"type":"string","nullable":true},"canceled_at":{"type":"string","nullable":true},"reason":{"$ref":"#/components/schemas/ClaimReason"},"claim_line_items":{"type":"array","items":{"$ref":"#/components/schemas/ClaimLineItem"}},"memo":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"created_by_id":{"type":"string","nullable":true},"order":{"$ref":"#/components/schemas/Order"},"refunds":{"type":"array","items":{"$ref":"#/components/schemas/Refund"}}},"required":["id","number","status","resolution","order_id","reason_id","refund_total","display_refund_total","approved_at","resolved_at","denied_at","canceled_at","memo","metadata","created_at","updated_at","created_by_id"],"x-typelizer":true},"CollectionRule":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"value":{"type":"string","nullable":true},"match_policy":{"type":"string"}},"required":["id","type","value","match_policy"],"x-typelizer":true},"Collection":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"permalink":{"type":"string"},"position":{"type":"number"},"sort_order":{"type":"string"},"meta_title":{"type":"string","nullable":true},"meta_description":{"type":"string","nullable":true},"meta_keywords":{"type":"string","nullable":true},"products_count":{"type":"number"},"description":{"type":"string"},"description_html":{"type":"string"},"image_url":{"type":"string","nullable":true},"square_image_url":{"type":"string","nullable":true},"custom_fields":{"type":"array","items":{"$ref":"#/components/schemas/CustomField"}},"translations":{"type":"object"},"automatic":{"type":"boolean"},"rules_match_policy":{"type":"string"},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"rules":{"type":"array","items":{"$ref":"#/components/schemas/CollectionRule"}}},"required":["id","name","permalink","position","sort_order","meta_title","meta_description","meta_keywords","products_count","description","description_html","image_url","square_image_url","automatic","rules_match_policy","metadata","created_at","updated_at"],"x-typelizer":true},"CommissionLine":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string"},"currency":{"type":"string"},"taxability_reason":{"type":"string","nullable":true},"country_code":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"rate":{"type":"string"},"tax_rate":{"type":"string"},"amount":{"type":"string"},"tax_amount":{"type":"string"},"total":{"type":"string"},"display_amount":{"type":"string"},"display_tax_amount":{"type":"string"},"display_total":{"type":"string"},"order_id":{"type":"string"},"vendor_id":{"type":"string"},"line_item_id":{"type":"string","nullable":true},"fulfillment_id":{"type":"string","nullable":true},"commission_rate_id":{"type":"string","nullable":true},"vendor_name":{"type":"string","nullable":true}},"required":["id","kind","currency","taxability_reason","country_code","state_code","created_at","updated_at","rate","tax_rate","amount","tax_amount","total","display_amount","display_tax_amount","display_total","order_id","vendor_id","line_item_id","fulfillment_id","commission_rate_id","vendor_name"],"x-typelizer":true},"CommissionRate":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"code":{"type":"string","nullable":true},"enabled":{"type":"boolean"},"position":{"type":"number"},"kind":{"type":"string"},"tax_inclusive":{"type":"boolean"},"include_shipping":{"type":"boolean"},"metadata":{"type":"object","nullable":true},"deleted_at":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"value":{"type":"string"},"commission_tax_rate":{"type":"string","nullable":true},"amounts":{"type":"object"},"bounds":{"type":"object"},"global":{"type":"boolean"},"rules":{"type":"array","items":{"$ref":"#/components/schemas/CommissionRule"}}},"required":["id","name","code","enabled","position","kind","tax_inclusive","include_shipping","metadata","deleted_at","created_at","updated_at","value","commission_tax_rate","amounts","bounds","global","rules"],"x-typelizer":true},"CommissionRule":{"type":"object","properties":{"id":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string"},"commission_rate_id":{"type":"string"},"preferences":{"type":"object"},"preference_schema":{"type":"object"},"label":{"type":"string"},"description":{"type":"string","nullable":true},"product_ids":{"type":"array","items":{"type":"string"}}},"required":["id","created_at","updated_at","type","commission_rate_id","preferences","preference_schema","label","description"],"x-typelizer":true},"CompanyContact":{"type":"object","properties":{"id":{"type":"string"},"role":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"company_location_id":{"type":"string"},"customer_id":{"type":"string"},"email":{"type":"string","nullable":true}},"required":["id","role","created_at","updated_at","company_location_id","customer_id","email"],"x-typelizer":true},"CompanyLocation":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"external_id":{"type":"string","nullable":true},"metadata":{"type":"object","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"company_id":{"type":"string"},"contacts_count":{"type":"number"},"billing_address":{"$ref":"#/components/schemas/Address"},"shipping_address":{"$ref":"#/components/schemas/Address"},"company_contacts":{"type":"array","items":{"$ref":"#/components/schemas/CompanyContact"}}},"required":["id","name","external_id","metadata","created_at","updated_at","company_id","contacts_count","billing_address","shipping_address"],"x-typelizer":true},"Company":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"external_id":{"type":"string","nullable":true},"metadata":{"type":"object","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"locations_count":{"type":"number"},"company_locations":{"type":"array","items":{"$ref":"#/components/schemas/CompanyLocation"}}},"required":["id","name","external_id","metadata","created_at","updated_at","locations_count"],"x-typelizer":true},"Country":{"type":"object","properties":{"iso":{"type":"string"},"iso3":{"type":"string"},"name":{"type":"string"},"states_required":{"type":"boolean"},"zipcode_required":{"type":"boolean"},"states":{"type":"array","items":{"$ref":"#/components/schemas/State"}},"market":{"allOf":[{"$ref":"#/components/schemas/Market"}],"nullable":true}},"required":["iso","iso3","name","states_required","zipcode_required"],"x-typelizer":true},"CouponCode":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"state":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"promotion_id":{"type":"string"},"order_id":{"type":"string","nullable":true}},"required":["id","code","state","created_at","updated_at","promotion_id","order_id"],"x-typelizer":true},"CreditCard":{"type":"object","properties":{"id":{"type":"string"},"brand":{"type":"string"},"last4":{"type":"string"},"month":{"type":"number"},"year":{"type":"number"},"name":{"type":"string","nullable":true},"default":{"type":"boolean"},"gateway_payment_profile_id":{"type":"string","nullable":true},"customer_id":{"type":"string","nullable":true},"payment_method_id":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","brand","last4","month","year","name","default","gateway_payment_profile_id","customer_id","payment_method_id","metadata","created_at","updated_at"],"x-typelizer":true},"CustomFieldDefinition":{"type":"object","properties":{"id":{"type":"string"},"namespace":{"type":"string"},"key":{"type":"string"},"label":{"type":"string"},"field_type":{"type":"string","enum":["short_text","long_text","rich_text","number","boolean","json"]},"resource_type":{"type":"string"},"storefront_visible":{"type":"boolean"},"searchable":{"type":"boolean"},"sortable":{"type":"boolean"},"filter_key":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","namespace","key","label","field_type","resource_type","storefront_visible","searchable","sortable","filter_key","created_at","updated_at"],"x-typelizer":true},"CustomField":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"type":{"type":"string","deprecated":true},"field_type":{"type":"string","enum":["short_text","long_text","rich_text","number","boolean","json"]},"key":{"type":"string"},"value":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"storefront_visible":{"type":"boolean"},"custom_field_definition_id":{"type":"string"}},"required":["id","label","type","field_type","key","value","created_at","updated_at","storefront_visible","custom_field_definition_id"],"x-typelizer":true},"CustomerGroup":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"customers_count":{"type":"number"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"customers":{"type":"array","items":{"$ref":"#/components/schemas/Customer"}}},"required":["id","name","description","customers_count","created_at","updated_at"],"x-typelizer":true},"Customer":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"first_name":{"type":"string","nullable":true},"last_name":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"accepts_email_marketing":{"type":"boolean"},"full_name":{"type":"string"},"available_store_credit_total":{"type":"string"},"display_available_store_credit_total":{"type":"string"},"addresses":{"type":"array","items":{"$ref":"#/components/schemas/Address"}},"default_billing_address":{"allOf":[{"$ref":"#/components/schemas/Address"}],"nullable":true},"default_shipping_address":{"allOf":[{"$ref":"#/components/schemas/Address"}],"nullable":true},"newsletter_subscriber":{"allOf":[{"$ref":"#/components/schemas/NewsletterSubscriber"}],"nullable":true},"customer_groups":{"type":"array","items":{"$ref":"#/components/schemas/CustomerGroup"}},"failed_attempts":{"type":"number"},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"internal_note":{"type":"string","nullable":true},"internal_note_html":{"type":"string","nullable":true},"default_billing_address_id":{"type":"string","nullable":true},"default_shipping_address_id":{"type":"string","nullable":true},"orders_count":{"type":"number"},"total_spent":{"type":"string"},"display_total_spent":{"type":"string"},"last_order_completed_at":{"type":"string","nullable":true},"orders":{"type":"array","items":{"$ref":"#/components/schemas/Order"}},"store_credits":{"type":"array","items":{"$ref":"#/components/schemas/StoreCredit"}},"customer_group_ids":{"type":"array","items":{"type":"string"}}},"required":["id","email","first_name","last_name","phone","accepts_email_marketing","full_name","available_store_credit_total","display_available_store_credit_total","failed_attempts","metadata","created_at","updated_at","tags","internal_note","internal_note_html","default_billing_address_id","default_shipping_address_id","orders_count","total_spent","display_total_spent","last_order_completed_at","customer_group_ids"],"x-typelizer":true},"DeliveryMethodRule":{"type":"object","properties":{"id":{"type":"string"},"active":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"preferences":{"type":"object"},"preference_schema":{"type":"object"},"product_ids":{"type":"array","items":{"type":"string"}}},"required":["id","active","created_at","updated_at","type","name","description","preferences","preference_schema","product_ids"],"x-typelizer":true},"DeliveryMethod":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"code":{"type":"string","nullable":true},"estimated_transit_business_days_min":{"type":"number","nullable":true},"estimated_transit_business_days_max":{"type":"number","nullable":true},"digital":{"type":"boolean"},"pickup":{"type":"boolean"},"pickup_point":{"type":"boolean"},"admin_name":{"type":"string","nullable":true},"fulfillment_provider":{"type":"string"},"pickup_point_provider":{"type":"string","nullable":true},"rate_provider":{"type":"string","nullable":true},"storefront_visible":{"type":"boolean"},"tracking_url":{"type":"string","nullable":true},"markup_flat":{"type":"string","nullable":true},"markup_percent":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"deleted_at":{"type":"string"},"services":{"type":"array","items":{"$ref":"#/components/schemas/DeliveryMethodService"}},"rules":{"type":"array","items":{"$ref":"#/components/schemas/DeliveryMethodRule"}},"tax_category_id":{"type":"string","nullable":true},"delivery_profile_id":{"type":"string"},"delivery_origin_group_id":{"type":"string","nullable":true},"delivery_zone_id":{"type":"string","nullable":true},"stock_location_ids":{"type":"array","items":{"type":"string"}},"calculator_type":{"type":"string","nullable":true},"calculator_preferences":{"type":"object","nullable":true}},"required":["id","name","code","estimated_transit_business_days_min","estimated_transit_business_days_max","digital","pickup","pickup_point","admin_name","fulfillment_provider","pickup_point_provider","rate_provider","storefront_visible","tracking_url","markup_flat","markup_percent","created_at","updated_at","deleted_at","services","rules","tax_category_id","delivery_profile_id","delivery_origin_group_id","delivery_zone_id","stock_location_ids","calculator_type","calculator_preferences"],"x-typelizer":true},"DeliveryMethodService":{"type":"object","properties":{"id":{"type":"string"},"carrier":{"type":"string"},"service":{"type":"string"},"label":{"type":"string","nullable":true},"markup_flat":{"type":"string","nullable":true},"markup_percent":{"type":"string","nullable":true},"position":{"type":"number"}},"required":["id","carrier","service","label","markup_flat","markup_percent","position"],"x-typelizer":true},"DeliveryOriginGroup":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string","nullable":true},"position":{"type":"number","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"delivery_profile_id":{"type":"string"},"stock_location_ids":{"type":"array","items":{"type":"string"}},"delivery_zones_count":{"type":"number"},"delivery_methods_count":{"type":"number"}},"required":["id","name","position","created_at","updated_at","delivery_profile_id","stock_location_ids","delivery_zones_count","delivery_methods_count"],"x-typelizer":true},"DeliveryProfile":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"default":{"type":"boolean"},"position":{"type":"number","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"kind":{"type":"string"},"digital":{"type":"boolean"},"offers_pickup":{"type":"boolean"},"offers_shipping":{"type":"boolean"},"stock_location_ids":{"type":"array","items":{"type":"string"}},"origin_groups":{"type":"object"},"products_count":{"type":"number"},"delivery_methods_count":{"type":"number"},"delivery_zones_count":{"type":"number"}},"required":["id","name","default","position","created_at","updated_at","kind","digital","offers_pickup","offers_shipping","stock_location_ids","origin_groups","products_count","delivery_methods_count","delivery_zones_count"],"x-typelizer":true},"DeliveryRate":{"type":"object","properties":{"id":{"type":"string"},"delivery_method_id":{"type":"string"},"name":{"type":"string"},"selected":{"type":"boolean"},"cost":{"type":"string"},"total":{"type":"string"},"additional_tax_total":{"type":"string"},"included_tax_total":{"type":"string"},"tax_total":{"type":"string"},"carrier":{"type":"string","nullable":true},"service_level":{"type":"string","nullable":true},"estimated_delivery_date":{"type":"string","nullable":true},"display_cost":{"type":"string"},"display_total":{"type":"string"},"display_additional_tax_total":{"type":"string"},"display_included_tax_total":{"type":"string"},"display_tax_total":{"type":"string"},"delivery_method":{"$ref":"#/components/schemas/DeliveryMethod"},"metadata":{"type":"object","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","delivery_method_id","name","selected","cost","total","additional_tax_total","included_tax_total","tax_total","carrier","service_level","estimated_delivery_date","display_cost","display_total","display_additional_tax_total","display_included_tax_total","display_tax_total","metadata","created_at","updated_at"],"x-typelizer":true},"DeliveryZoneMember":{"type":"object","properties":{"id":{"type":"string"},"member_type":{"type":"string"},"country_code":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true},"postal_code_prefix":{"type":"string","nullable":true},"postal_code_from":{"type":"string","nullable":true},"postal_code_to":{"type":"string","nullable":true},"country_name":{"type":"string","nullable":true},"state_name":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","member_type","country_code","state_code","postal_code_prefix","postal_code_from","postal_code_to","country_name","state_name","created_at","updated_at"],"x-typelizer":true},"DeliveryZone":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"members":{"type":"array","items":{"$ref":"#/components/schemas/DeliveryZoneMember"}},"created_at":{"type":"string"},"updated_at":{"type":"string"},"delivery_profile_id":{"type":"string"},"delivery_origin_group_id":{"type":"string","nullable":true},"delivery_method_ids":{"type":"array","items":{"type":"string"}}},"required":["id","name","description","created_at","updated_at","delivery_profile_id","delivery_origin_group_id","delivery_method_ids"],"x-typelizer":true},"DigitalLink":{"type":"object","properties":{"id":{"type":"string"},"access_counter":{"type":"number"},"filename":{"type":"string"},"content_type":{"type":"string"},"download_url":{"type":"string"},"authorizable":{"type":"boolean"},"expired":{"type":"boolean"},"access_limit_exceeded":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","access_counter","filename","content_type","download_url","authorizable","expired","access_limit_exceeded","created_at","updated_at"],"x-typelizer":true},"Discount":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"kind":{"type":"string"},"code":{"type":"string","nullable":true},"value_type":{"type":"string","nullable":true},"value":{"type":"string","nullable":true},"promotion_id":{"type":"string","nullable":true},"line_item_id":{"type":"string","nullable":true},"fulfillment_id":{"type":"string","nullable":true},"amount":{"type":"string"},"display_amount":{"type":"string"},"metadata":{"type":"object","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","label","kind","code","value_type","value","promotion_id","line_item_id","fulfillment_id","amount","display_amount","metadata","created_at","updated_at"],"x-typelizer":true},"ExchangeLineItem":{"type":"object","properties":{"id":{"type":"string"},"quantity":{"type":"number"},"received_quantity":{"type":"number"},"resellable":{"type":"boolean"},"original_price":{"type":"string"},"new_variant_price":{"type":"string"},"price_difference":{"type":"string"},"original_variant_id":{"type":"string","nullable":true},"new_variant_id":{"type":"string","nullable":true},"line_item_id":{"type":"string","nullable":true},"fulfillment_item_id":{"type":"string","nullable":true},"original_variant":{"$ref":"#/components/schemas/Variant"},"new_variant":{"$ref":"#/components/schemas/Variant"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","quantity","received_quantity","resellable","original_price","new_variant_price","price_difference","original_variant_id","new_variant_id","line_item_id","fulfillment_item_id","created_at","updated_at"],"x-typelizer":true},"Exchange":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"status":{"type":"string"},"order_id":{"type":"string","nullable":true},"reason_id":{"type":"string","nullable":true},"price_difference":{"type":"string"},"display_price_difference":{"type":"string"},"approved_at":{"type":"string","nullable":true},"received_at":{"type":"string","nullable":true},"fulfilled_at":{"type":"string","nullable":true},"canceled_at":{"type":"string","nullable":true},"reason":{"$ref":"#/components/schemas/ReturnReason"},"exchange_line_items":{"type":"array","items":{"$ref":"#/components/schemas/ExchangeLineItem"}},"memo":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"stock_location_id":{"type":"string","nullable":true},"created_by_id":{"type":"string","nullable":true},"order":{"$ref":"#/components/schemas/Order"},"stock_location":{"$ref":"#/components/schemas/StockLocation"},"refunds":{"type":"array","items":{"$ref":"#/components/schemas/Refund"}}},"required":["id","number","status","order_id","reason_id","price_difference","display_price_difference","approved_at","received_at","fulfilled_at","canceled_at","memo","metadata","created_at","updated_at","stock_location_id","created_by_id"],"x-typelizer":true},"Export":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"format":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string","nullable":true},"user_id":{"type":"string","nullable":true},"done":{"type":"boolean"},"filename":{"type":"string","nullable":true},"byte_size":{"type":"number","nullable":true},"download_url":{"type":"string","nullable":true}},"required":["id","number","format","created_at","updated_at","type","user_id","done","filename","byte_size","download_url"],"x-typelizer":true},"Fee":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"kind":{"type":"string"},"line_item_id":{"type":"string","nullable":true},"fulfillment_id":{"type":"string","nullable":true},"amount":{"type":"string"},"display_amount":{"type":"string"},"metadata":{"type":"object","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","label","kind","line_item_id","fulfillment_id","amount","display_amount","metadata","created_at","updated_at"],"x-typelizer":true},"FulfillmentItem":{"type":"object","properties":{"id":{"type":"string"},"quantity":{"type":"number"},"status":{"type":"string"},"variant_id":{"type":"string","nullable":true},"line_item_id":{"type":"string","nullable":true},"name":{"type":"string","nullable":true},"options_text":{"type":"string","nullable":true}},"required":["id","quantity","status","variant_id","line_item_id","name","options_text"],"x-typelizer":true},"Fulfillment":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"tracking":{"type":"string","nullable":true},"tracking_url":{"type":"string","nullable":true},"tracking_carrier":{"type":"string","nullable":true},"tracking_carrier_name":{"type":"string","nullable":true},"pickup_point_data":{"type":"object","nullable":true},"selected_delivery_rate_id":{"type":"string","nullable":true},"cost":{"type":"string"},"display_cost":{"type":"string"},"total":{"type":"string"},"display_total":{"type":"string"},"discount_total":{"type":"string"},"display_discount_total":{"type":"string"},"additional_tax_total":{"type":"string"},"display_additional_tax_total":{"type":"string"},"included_tax_total":{"type":"string"},"display_included_tax_total":{"type":"string"},"tax_total":{"type":"string"},"display_tax_total":{"type":"string"},"status":{"type":"string"},"fulfillment_type":{"type":"string"},"fulfilled_at":{"type":"string","nullable":true},"tracking_status":{"type":"string","nullable":true},"estimated_delivery_at":{"type":"string","nullable":true},"delivered_at":{"type":"string","nullable":true},"items":{"type":"array","items":{"$ref":"#/components/schemas/FulfillmentManifestItem"}},"delivery_method":{"$ref":"#/components/schemas/DeliveryMethod"},"stock_location":{"$ref":"#/components/schemas/StockLocation"},"delivery_rates":{"type":"array","items":{"$ref":"#/components/schemas/DeliveryRate"}},"tax_lines":{"type":"array","items":{"$ref":"#/components/schemas/TaxLine"}},"metadata":{"type":"object"},"tracking_details":{"type":"object","nullable":true},"adjustment_total":{"type":"string"},"pre_tax_amount":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"order_id":{"type":"string","nullable":true},"stock_location_id":{"type":"string","nullable":true},"documents":{"type":"object"},"provider_generates_labels":{"type":"boolean"},"fulfillment_items":{"type":"array","items":{"$ref":"#/components/schemas/FulfillmentItem"}},"order":{"$ref":"#/components/schemas/Order"}},"required":["id","number","tracking","tracking_url","tracking_carrier","tracking_carrier_name","pickup_point_data","selected_delivery_rate_id","cost","display_cost","total","display_total","discount_total","display_discount_total","additional_tax_total","display_additional_tax_total","included_tax_total","display_included_tax_total","tax_total","display_tax_total","status","fulfillment_type","fulfilled_at","tracking_status","estimated_delivery_at","delivered_at","items","metadata","tracking_details","adjustment_total","pre_tax_amount","created_at","updated_at","order_id","stock_location_id","documents","provider_generates_labels"],"x-typelizer":true},"GiftCardBatch":{"type":"object","properties":{"id":{"type":"string"},"codes_count":{"type":"number"},"currency":{"type":"string","nullable":true},"prefix":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"amount":{"type":"string","nullable":true},"expires_at":{"type":"string","nullable":true},"created_by_id":{"type":"string","nullable":true}},"required":["id","codes_count","currency","prefix","created_at","updated_at","amount","expires_at","created_by_id"],"x-typelizer":true},"GiftCard":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"status":{"type":"string"},"currency":{"type":"string"},"amount":{"type":"string"},"amount_used":{"type":"string"},"amount_authorized":{"type":"string"},"amount_remaining":{"type":"string"},"display_amount":{"type":"string"},"display_amount_used":{"type":"string"},"display_amount_remaining":{"type":"string"},"expires_at":{"type":"string","nullable":true},"redeemed_at":{"type":"string","nullable":true},"expired":{"type":"boolean"},"active":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"customer_id":{"type":"string","nullable":true},"created_by_id":{"type":"string","nullable":true},"customer":{"$ref":"#/components/schemas/Customer"},"created_by":{"$ref":"#/components/schemas/AdminUser"},"gift_card_batch":{"$ref":"#/components/schemas/GiftCardBatch"},"orders":{"type":"array","items":{"$ref":"#/components/schemas/Order"}}},"required":["id","code","status","currency","amount","amount_used","amount_authorized","amount_remaining","display_amount","display_amount_used","display_amount_remaining","expires_at","redeemed_at","expired","active","created_at","updated_at","customer_id","created_by_id"],"x-typelizer":true},"ImportMapping":{"type":"object","properties":{"id":{"type":"string"},"schema_field":{"type":"string"},"file_column":{"type":"string","nullable":true},"required":{"type":"boolean"}},"required":["id","schema_field","file_column","required"],"x-typelizer":true},"ImportRow":{"type":"object","properties":{"id":{"type":"string"},"row_number":{"type":"number"},"status":{"type":"string"},"validation_errors":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"import_id":{"type":"string","nullable":true},"item_type":{"type":"string","nullable":true},"item_id":{"type":"string","nullable":true},"data":{"type":"object"}},"required":["id","row_number","status","validation_errors","created_at","updated_at","import_id","item_type","item_id","data"],"x-typelizer":true},"Import":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"rows_count":{"type":"number"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string","nullable":true},"status":{"type":"string"},"owner_type":{"type":"string","nullable":true},"owner_id":{"type":"string","nullable":true},"user_id":{"type":"string","nullable":true},"processing_errors":{"type":"string","nullable":true},"preferred_delimiter":{"type":"string"},"original_filename":{"type":"string","nullable":true},"original_byte_size":{"type":"number","nullable":true},"original_file_url":{"type":"string","nullable":true},"completed_rows_count":{"type":"number"},"failed_rows_count":{"type":"number"},"schema_fields":{"type":"array","items":{"$ref":"#/components/schemas/ImportSchemaField"}},"csv_headers":{"type":"array","items":{"type":"string"}},"sample_row":{"type":"object"},"mappings":{"type":"array","items":{"$ref":"#/components/schemas/ImportMapping"}}},"required":["id","number","rows_count","created_at","updated_at","type","status","owner_type","owner_id","user_id","processing_errors","preferred_delimiter","original_filename","original_byte_size","original_file_url","completed_rows_count","failed_rows_count","schema_fields","csv_headers","sample_row","mappings"],"x-typelizer":true},"Integration":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"active":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string"},"group":{"type":"string","nullable":true},"preferences":{"type":"object"},"preference_schema":{"type":"object"}},"required":["id","name","active","created_at","updated_at","type","group","preferences","preference_schema"],"x-typelizer":true},"Invitation":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"status":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"expires_at":{"type":"string"},"role_id":{"type":"string"},"role_name":{"type":"string"},"inviter_email":{"type":"string"},"acceptance_url":{"type":"string"},"invitee_exists":{"type":"boolean"},"store":{"type":"object"}},"required":["id","email","status","created_at","updated_at","expires_at","role_id","role_name","inviter_email","acceptance_url","invitee_exists","store"],"x-typelizer":true},"LineItem":{"type":"object","properties":{"id":{"type":"string"},"variant_id":{"type":"string"},"vendor_id":{"type":"string","nullable":true},"preorder":{"type":"boolean"},"preorder_ships_at":{"type":"string","nullable":true},"quantity":{"type":"number"},"currency":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"options_text":{"type":"string"},"price":{"type":"string"},"display_price":{"type":"string"},"total":{"type":"string"},"display_total":{"type":"string"},"adjustment_total":{"type":"string"},"display_adjustment_total":{"type":"string"},"additional_tax_total":{"type":"string"},"display_additional_tax_total":{"type":"string"},"included_tax_total":{"type":"string"},"display_included_tax_total":{"type":"string"},"discount_total":{"type":"string"},"display_discount_total":{"type":"string"},"pre_tax_amount":{"type":"string"},"display_pre_tax_amount":{"type":"string"},"discounted_amount":{"type":"string"},"display_discounted_amount":{"type":"string"},"display_compare_at_amount":{"type":"string","nullable":true},"compare_at_amount":{"type":"string","nullable":true},"thumbnail_url":{"type":"string","nullable":true},"vendor":{"$ref":"#/components/schemas/Vendor"},"option_values":{"type":"array","items":{"$ref":"#/components/schemas/OptionValue"}},"digital_links":{"type":"array","items":{"$ref":"#/components/schemas/DigitalLink"}},"tax_lines":{"type":"array","items":{"$ref":"#/components/schemas/TaxLine"}},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"cost_price":{"type":"string","nullable":true},"tax_category_id":{"type":"string","nullable":true},"variant":{"$ref":"#/components/schemas/Variant"},"tax_category":{"$ref":"#/components/schemas/TaxCategory"}},"required":["id","variant_id","vendor_id","preorder","preorder_ships_at","quantity","currency","name","slug","options_text","price","display_price","total","display_total","adjustment_total","display_adjustment_total","additional_tax_total","display_additional_tax_total","included_tax_total","display_included_tax_total","discount_total","display_discount_total","pre_tax_amount","display_pre_tax_amount","discounted_amount","display_discounted_amount","display_compare_at_amount","compare_at_amount","thumbnail_url","option_values","digital_links","metadata","created_at","updated_at","cost_price","tax_category_id"],"x-typelizer":true},"Market":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"currency":{"type":"string"},"default_locale":{"type":"string"},"tax_inclusive":{"type":"boolean"},"default":{"type":"boolean"},"country_codes":{"type":"array","items":{"type":"string"}},"supported_locales":{"type":"array","items":{"type":"string"}},"countries":{"type":"array","items":{"$ref":"#/components/schemas/Country"}},"tax_provider":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","name","currency","default_locale","tax_inclusive","default","country_codes","supported_locales","tax_provider","created_at","updated_at"],"x-typelizer":true},"Media":{"type":"object","properties":{"id":{"type":"string"},"product_id":{"type":"string","nullable":true},"variant_ids":{"type":"array","items":{"type":"string"}},"position":{"type":"number"},"alt":{"type":"string","nullable":true},"media_type":{"type":"string"},"focal_point_x":{"type":"number","nullable":true},"focal_point_y":{"type":"number","nullable":true},"external_video_url":{"type":"string","nullable":true},"original_url":{"type":"string","nullable":true},"mini_url":{"type":"string","nullable":true},"small_url":{"type":"string","nullable":true},"medium_url":{"type":"string","nullable":true},"large_url":{"type":"string","nullable":true},"xlarge_url":{"type":"string","nullable":true},"og_image_url":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"viewable_id":{"type":"string"},"download_url":{"type":"string","nullable":true},"metadata":{"type":"object"},"viewable_type":{"type":"string"}},"required":["id","product_id","variant_ids","position","alt","media_type","focal_point_x","focal_point_y","external_video_url","original_url","mini_url","small_url","medium_url","large_url","xlarge_url","og_image_url","created_at","updated_at","viewable_id","download_url","metadata","viewable_type"],"x-typelizer":true},"NewsletterSubscriber":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"verified":{"type":"boolean"},"verified_at":{"type":"string","nullable":true},"customer_id":{"type":"string","nullable":true}},"required":["id","email","created_at","updated_at","verified","verified_at","customer_id"],"x-typelizer":true},"OptionType":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"label":{"type":"string"},"position":{"type":"number"},"kind":{"type":"string"},"translations":{"type":"object"},"metadata":{"type":"object"},"filterable":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"option_values":{"type":"array","items":{"$ref":"#/components/schemas/OptionValue"}}},"required":["id","name","label","position","kind","metadata","filterable","created_at","updated_at"],"x-typelizer":true},"OptionValue":{"type":"object","properties":{"id":{"type":"string"},"option_type_id":{"type":"string"},"name":{"type":"string"},"label":{"type":"string"},"position":{"type":"number"},"color_code":{"type":"string","nullable":true},"option_type_name":{"type":"string"},"option_type_label":{"type":"string"},"image_url":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"option_type":{"$ref":"#/components/schemas/OptionType"}},"required":["id","option_type_id","name","label","position","color_code","option_type_name","option_type_label","image_url","metadata","created_at","updated_at"],"x-typelizer":true},"OrderRoutingRule":{"type":"object","properties":{"id":{"type":"string"},"position":{"type":"number"},"active":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string"},"channel_id":{"type":"string"},"preferences":{"type":"object"},"preference_schema":{"type":"object"},"label":{"type":"string"},"description":{"type":"string"}},"required":["id","position","active","created_at","updated_at","type","channel_id","preferences","preference_schema","label","description"],"x-typelizer":true},"Order":{"type":"object","properties":{"id":{"type":"string"},"market_id":{"type":"string","nullable":true},"cart_id":{"type":"string","nullable":true},"channel_id":{"type":"string","nullable":true},"number":{"type":"string"},"email":{"type":"string"},"customer_note":{"type":"string","nullable":true},"currency":{"type":"string"},"locale":{"type":"string","nullable":true},"total_quantity":{"type":"number"},"coupon_code":{"type":"string","nullable":true},"fulfillment_status":{"type":"string","nullable":true},"payment_status":{"type":"string","nullable":true},"completed_at":{"type":"string","nullable":true},"item_total":{"type":"string"},"display_item_total":{"type":"string"},"adjustment_total":{"type":"string"},"display_adjustment_total":{"type":"string"},"discount_total":{"type":"string"},"display_discount_total":{"type":"string"},"tax_total":{"type":"string"},"display_tax_total":{"type":"string"},"included_tax_total":{"type":"string"},"display_included_tax_total":{"type":"string"},"additional_tax_total":{"type":"string"},"display_additional_tax_total":{"type":"string"},"total":{"type":"string"},"display_total":{"type":"string"},"gift_card_total":{"type":"string"},"display_gift_card_total":{"type":"string"},"amount_due":{"type":"string"},"display_amount_due":{"type":"string"},"delivery_total":{"type":"string"},"display_delivery_total":{"type":"string"},"fee_total":{"type":"string"},"display_fee_total":{"type":"string"},"store_credit_total":{"type":"string"},"display_store_credit_total":{"type":"string"},"covered_by_store_credit":{"type":"boolean"},"items":{"type":"array","items":{"$ref":"#/components/schemas/LineItem"}},"fulfillments":{"type":"array","items":{"$ref":"#/components/schemas/Fulfillment"}},"payments":{"type":"array","items":{"$ref":"#/components/schemas/Payment"}},"billing_address":{"allOf":[{"$ref":"#/components/schemas/Address"}],"nullable":true},"shipping_address":{"allOf":[{"$ref":"#/components/schemas/Address"}],"nullable":true},"gift_card":{"allOf":[{"$ref":"#/components/schemas/GiftCard"}],"nullable":true},"market":{"allOf":[{"$ref":"#/components/schemas/Market"}],"nullable":true},"status":{"type":"string"},"last_ip_address":{"type":"string","nullable":true},"considered_risky":{"type":"boolean"},"confirmation_delivered":{"type":"boolean"},"store_owner_notification_delivered":{"type":"boolean"},"payment_total":{"type":"string"},"display_payment_total":{"type":"string"},"metadata":{"type":"object"},"canceled_at":{"type":"string","nullable":true},"approved_at":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"preferred_stock_location_id":{"type":"string","nullable":true},"company_location_id":{"type":"string","nullable":true},"company_id":{"type":"string","nullable":true},"tags":{"type":"array","items":{"type":"string"}},"internal_note":{"type":"string","nullable":true},"internal_note_html":{"type":"string","nullable":true},"approver_id":{"type":"string","nullable":true},"canceler_id":{"type":"string","nullable":true},"created_by_id":{"type":"string","nullable":true},"customer_id":{"type":"string","nullable":true},"applied_promotions":{"type":"array","items":{"$ref":"#/components/schemas/AppliedPromotion"}},"cart":{"$ref":"#/components/schemas/Cart"},"channel":{"$ref":"#/components/schemas/Channel"},"preferred_stock_location":{"$ref":"#/components/schemas/StockLocation"},"payment_methods":{"type":"array","items":{"$ref":"#/components/schemas/PaymentMethod"}},"customer":{"$ref":"#/components/schemas/Customer"},"approver":{"$ref":"#/components/schemas/Customer"},"canceler":{"$ref":"#/components/schemas/Customer"},"created_by":{"$ref":"#/components/schemas/Customer"},"returns":{"type":"array","items":{"$ref":"#/components/schemas/Return"}},"exchanges":{"type":"array","items":{"$ref":"#/components/schemas/Exchange"}},"claims":{"type":"array","items":{"$ref":"#/components/schemas/Claim"}}},"required":["id","market_id","cart_id","channel_id","number","email","customer_note","currency","locale","total_quantity","coupon_code","fulfillment_status","payment_status","completed_at","item_total","display_item_total","adjustment_total","display_adjustment_total","discount_total","display_discount_total","tax_total","display_tax_total","included_tax_total","display_included_tax_total","additional_tax_total","display_additional_tax_total","total","display_total","gift_card_total","display_gift_card_total","amount_due","display_amount_due","delivery_total","display_delivery_total","fee_total","display_fee_total","store_credit_total","display_store_credit_total","covered_by_store_credit","gift_card","market","status","last_ip_address","considered_risky","confirmation_delivered","store_owner_notification_delivered","payment_total","display_payment_total","metadata","canceled_at","approved_at","created_at","updated_at","preferred_stock_location_id","company_location_id","company_id","tags","internal_note","internal_note_html","approver_id","canceler_id","created_by_id","customer_id"],"x-typelizer":true},"PaymentMethod":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"type":{"type":"string"},"session_required":{"type":"boolean"},"source_required":{"type":"boolean"},"metadata":{"type":"object"},"active":{"type":"boolean"},"auto_capture":{"type":"boolean","nullable":true},"capture_method":{"type":"string","enum":["checkout","on_dispatch","manual"],"nullable":true},"resolved_capture_method":{"type":"string","enum":["checkout","on_dispatch","manual"]},"storefront_visible":{"type":"boolean"},"position":{"type":"number"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"preferences":{"type":"object"},"preference_schema":{"type":"object"}},"required":["id","name","description","type","session_required","source_required","metadata","active","auto_capture","capture_method","resolved_capture_method","storefront_visible","position","created_at","updated_at","preferences","preference_schema"],"x-typelizer":true},"Payment":{"type":"object","properties":{"id":{"type":"string"},"payment_method_id":{"type":"string"},"response_code":{"type":"string","nullable":true},"number":{"type":"string"},"amount":{"type":"string"},"display_amount":{"type":"string"},"status":{"type":"string"},"source_type":{"type":"string","nullable":true,"enum":["credit_card","store_credit","payment_source"]},"source_id":{"type":"string","nullable":true},"source":{"anyOf":[{"$ref":"#/components/schemas/CreditCard"},{"$ref":"#/components/schemas/StoreCredit"},{"$ref":"#/components/schemas/PaymentSource"}],"nullable":true},"payment_method":{"$ref":"#/components/schemas/PaymentMethod"},"metadata":{"type":"object"},"avs_response":{"type":"string","nullable":true},"cvv_response_code":{"type":"string","nullable":true},"cvv_response_message":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"captured_amount":{"type":"string"},"order_id":{"type":"string","nullable":true},"order":{"$ref":"#/components/schemas/Order"},"refunds":{"type":"array","items":{"$ref":"#/components/schemas/Refund"}}},"required":["id","payment_method_id","response_code","number","amount","display_amount","status","source_type","source_id","source","metadata","avs_response","cvv_response_code","cvv_response_message","created_at","updated_at","captured_amount","order_id"],"x-typelizer":true},"PaymentSource":{"type":"object","properties":{"id":{"type":"string"},"gateway_payment_profile_id":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","gateway_payment_profile_id","metadata","created_at","updated_at"],"x-typelizer":true},"Permission":{"type":"object","properties":{"key":{"type":"string"},"resource":{"type":"string"},"kind":{"type":"string"},"group":{"type":"string"},"group_label":{"type":"string"},"label":{"type":"string"},"description":{"type":"string"}},"required":["key","resource","kind","group","group_label","label","description"],"x-typelizer":true},"PriceHistory":{"type":"object","properties":{"id":{"type":"string"},"amount":{"type":"string"},"amount_in_cents":{"type":"number"},"currency":{"type":"string"},"display_amount":{"type":"string"},"recorded_at":{"type":"string"},"variant_id":{"type":"string"},"price_id":{"type":"string"},"compare_at_amount":{"type":"string","nullable":true},"created_at":{"type":"string"}},"required":["id","amount","amount_in_cents","currency","display_amount","recorded_at","variant_id","price_id","compare_at_amount","created_at"],"x-typelizer":true},"PriceList":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string"},"position":{"type":"number"},"match_policy":{"type":"string"},"starts_at":{"type":"string","nullable":true},"ends_at":{"type":"string","nullable":true},"deleted_at":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"currently_active":{"type":"boolean"},"products_count":{"type":"number"},"prices_count":{"type":"number"},"product_ids":{"type":"array","items":{"type":"string"}},"price_rules":{"type":"array","items":{"$ref":"#/components/schemas/PriceRule"}}},"required":["id","name","description","status","position","match_policy","starts_at","ends_at","deleted_at","created_at","updated_at","currently_active","products_count","prices_count","product_ids"],"x-typelizer":true},"PriceRule":{"type":"object","properties":{"id":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string"},"price_list_id":{"type":"string"},"preferences":{"type":"object"},"preference_schema":{"type":"array","items":{"$ref":"#/components/schemas/PreferenceField"}},"label":{"type":"string"},"description":{"type":"string","nullable":true},"markets":{"type":"array","items":{"$ref":"#/components/schemas/Market"}},"customer_groups":{"type":"array","items":{"$ref":"#/components/schemas/CustomerGroup"}},"channels":{"type":"array","items":{"$ref":"#/components/schemas/Channel"}},"customers":{"type":"array","items":{"$ref":"#/components/schemas/Customer"}}},"required":["id","created_at","updated_at","type","price_list_id","preferences","preference_schema","label","description"],"x-typelizer":true},"Price":{"type":"object","properties":{"id":{"type":"string"},"amount":{"type":"string","nullable":true},"amount_in_cents":{"type":"number","nullable":true},"compare_at_amount":{"type":"string","nullable":true},"compare_at_amount_in_cents":{"type":"number","nullable":true},"currency":{"type":"string","nullable":true},"display_amount":{"type":"string","nullable":true},"display_compare_at_amount":{"type":"string","nullable":true},"price_list_id":{"type":"string","nullable":true},"variant_id":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"variant":{"$ref":"#/components/schemas/Variant"}},"required":["id","amount","amount_in_cents","compare_at_amount","compare_at_amount_in_cents","currency","display_amount","display_compare_at_amount","price_list_id","variant_id","created_at","updated_at"],"x-typelizer":true},"ProductPublication":{"type":"object","properties":{"id":{"type":"string"},"published_at":{"type":"string","nullable":true},"unpublished_at":{"type":"string","nullable":true},"product_id":{"type":"string"},"channel_id":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","published_at","unpublished_at","product_id","channel_id","created_at","updated_at"],"x-typelizer":true},"Product":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"meta_title":{"type":"string","nullable":true},"meta_description":{"type":"string","nullable":true},"meta_keywords":{"type":"string","nullable":true},"variant_count":{"type":"number"},"available_on":{"type":"string","nullable":true},"preorder_ships_at":{"type":"string","nullable":true},"purchasable":{"type":"boolean"},"preorder":{"type":"boolean"},"in_stock":{"type":"boolean"},"backorderable":{"type":"boolean"},"available":{"type":"boolean"},"description":{"type":"string","nullable":true},"description_html":{"type":"string","nullable":true},"default_variant_id":{"type":"string"},"thumbnail_url":{"type":"string","nullable":true},"tags":{"type":"array","items":{"type":"string"}},"price":{"allOf":[{"$ref":"#/components/schemas/Price"}],"nullable":true},"original_price":{"allOf":[{"$ref":"#/components/schemas/Price"}],"nullable":true},"vendor_id":{"type":"string","nullable":true},"vendor":{"$ref":"#/components/schemas/Vendor"},"primary_media":{"$ref":"#/components/schemas/Media"},"media":{"type":"array","items":{"$ref":"#/components/schemas/Media"}},"variants":{"type":"array","items":{"$ref":"#/components/schemas/Variant"}},"default_variant":{"$ref":"#/components/schemas/Variant"},"option_types":{"type":"array","items":{"$ref":"#/components/schemas/OptionType"}},"option_values":{"type":"array","items":{"$ref":"#/components/schemas/OptionValue"}},"categories":{"type":"array","items":{"$ref":"#/components/schemas/Category"}},"custom_fields":{"type":"array","items":{"$ref":"#/components/schemas/CustomField"}},"prior_price":{"allOf":[{"$ref":"#/components/schemas/PriceHistory"}],"nullable":true},"translations":{"type":"object"},"status":{"type":"string"},"metadata":{"type":"object"},"deleted_at":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"delivery_profile_id":{"type":"string","nullable":true},"vendor_name":{"type":"string","nullable":true},"product_type_id":{"type":"string","nullable":true},"tax_category_id":{"type":"string","nullable":true},"collections":{"type":"array","items":{"$ref":"#/components/schemas/Collection"}},"product_publications":{"type":"array","items":{"$ref":"#/components/schemas/ProductPublication"}},"channels":{"type":"array","items":{"$ref":"#/components/schemas/Channel"}},"product_type":{"$ref":"#/components/schemas/ProductType"}},"required":["id","name","slug","meta_title","meta_description","meta_keywords","variant_count","available_on","preorder_ships_at","purchasable","preorder","in_stock","backorderable","available","description","description_html","default_variant_id","thumbnail_url","tags","price","original_price","vendor_id","status","metadata","deleted_at","created_at","updated_at","delivery_profile_id","vendor_name","product_type_id","tax_category_id"],"x-typelizer":true},"ProductTypeCustomFieldDefinition":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"namespace":{"type":"string"},"label":{"type":"string"},"field_type":{"type":"string","enum":["short_text","long_text","rich_text","number","boolean","json"]},"required":{"type":"boolean"},"sort_order":{"type":"number"}},"required":["id","key","namespace","label","field_type","required","sort_order"],"x-typelizer":true},"ProductType":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"translations":{"type":"object"},"products_count":{"type":"number"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"delivery_profile_id":{"type":"string","nullable":true},"option_type_ids":{"type":"array","items":{"type":"string"}},"category_ids":{"type":"array","items":{"type":"string"}},"custom_field_definitions":{"type":"array","items":{"$ref":"#/components/schemas/ProductTypeCustomFieldDefinition"}}},"required":["id","name","products_count","created_at","updated_at","delivery_profile_id","option_type_ids","category_ids","custom_field_definitions"],"x-typelizer":true},"PromotionAction":{"type":"object","properties":{"id":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string"},"promotion_id":{"type":"string"},"preferences":{"type":"object"},"preference_schema":{"type":"array","items":{"$ref":"#/components/schemas/PreferenceField"}},"label":{"type":"string"},"calculator":{"allOf":[{"$ref":"#/components/schemas/PromotionActionCalculator"}],"nullable":true},"line_items":{"type":"array","items":{"$ref":"#/components/schemas/PromotionActionLineItem"},"nullable":true}},"required":["id","created_at","updated_at","type","promotion_id","preferences","preference_schema","label","calculator","line_items"],"x-typelizer":true},"PromotionRule":{"type":"object","properties":{"id":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string"},"promotion_id":{"type":"string"},"preferences":{"type":"object"},"preference_schema":{"type":"array","items":{"$ref":"#/components/schemas/PreferenceField"}},"label":{"type":"string"},"product_ids":{"type":"array","items":{"type":"string"},"nullable":true},"category_ids":{"type":"array","items":{"type":"string"},"nullable":true},"customer_ids":{"type":"array","items":{"type":"string"},"nullable":true},"products":{"type":"array","items":{"$ref":"#/components/schemas/Product"}},"categories":{"type":"array","items":{"$ref":"#/components/schemas/Category"}},"customers":{"type":"array","items":{"$ref":"#/components/schemas/Customer"}},"customer_groups":{"type":"array","items":{"$ref":"#/components/schemas/CustomerGroup"}},"countries":{"type":"array","items":{"$ref":"#/components/schemas/Country"}},"channels":{"type":"array","items":{"$ref":"#/components/schemas/Channel"}},"markets":{"type":"array","items":{"$ref":"#/components/schemas/Market"}}},"required":["id","created_at","updated_at","type","promotion_id","preferences","preference_schema","label","product_ids","category_ids","customer_ids"],"x-typelizer":true},"Promotion":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"code":{"type":"string","nullable":true},"starts_at":{"type":"string","nullable":true},"expires_at":{"type":"string","nullable":true},"usage_limit":{"type":"number","nullable":true},"match_policy":{"type":"string","enum":["all","any"]},"path":{"type":"string","nullable":true},"kind":{"type":"string","enum":["coupon_code","automatic"]},"multi_codes":{"type":"boolean"},"number_of_codes":{"type":"number","nullable":true},"code_prefix":{"type":"string","nullable":true},"promotion_category_id":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"action_ids":{"type":"array","items":{"type":"string"}},"rule_ids":{"type":"array","items":{"type":"string"}}},"required":["id","name","description","code","starts_at","expires_at","usage_limit","match_policy","path","kind","multi_codes","number_of_codes","code_prefix","promotion_category_id","metadata","created_at","updated_at","action_ids","rule_ids"],"x-typelizer":true},"RefundReason":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"active":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"can_be_deleted":{"type":"boolean"}},"required":["id","name","active","created_at","updated_at","can_be_deleted"],"x-typelizer":true},"Refund":{"type":"object","properties":{"id":{"type":"string"},"transaction_id":{"type":"string","nullable":true},"amount":{"type":"string","nullable":true},"payment_id":{"type":"string","nullable":true},"refund_reason_id":{"type":"string","nullable":true},"originator_id":{"type":"string","nullable":true},"originator_type":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"payment":{"$ref":"#/components/schemas/Payment"}},"required":["id","transaction_id","amount","payment_id","refund_reason_id","originator_id","originator_type","metadata","created_at","updated_at"],"x-typelizer":true},"ReturnLineItem":{"type":"object","properties":{"id":{"type":"string"},"quantity":{"type":"number"},"received_quantity":{"type":"number"},"resellable":{"type":"boolean"},"pre_tax_amount":{"type":"string"},"display_pre_tax_amount":{"type":"string"},"variant_id":{"type":"string","nullable":true},"line_item_id":{"type":"string","nullable":true},"fulfillment_item_id":{"type":"string","nullable":true},"variant":{"$ref":"#/components/schemas/Variant"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"line_item":{"$ref":"#/components/schemas/LineItem"}},"required":["id","quantity","received_quantity","resellable","pre_tax_amount","display_pre_tax_amount","variant_id","line_item_id","fulfillment_item_id","created_at","updated_at"],"x-typelizer":true},"ReturnReason":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"active":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"can_be_deleted":{"type":"boolean"}},"required":["id","name","active","created_at","updated_at","can_be_deleted"],"x-typelizer":true},"Return":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"status":{"type":"string"},"order_id":{"type":"string","nullable":true},"reason_id":{"type":"string","nullable":true},"refund_total":{"type":"string"},"display_refund_total":{"type":"string"},"approved_at":{"type":"string","nullable":true},"received_at":{"type":"string","nullable":true},"refunded_at":{"type":"string","nullable":true},"canceled_at":{"type":"string","nullable":true},"reason":{"$ref":"#/components/schemas/ReturnReason"},"return_line_items":{"type":"array","items":{"$ref":"#/components/schemas/ReturnLineItem"}},"memo":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"stock_location_id":{"type":"string","nullable":true},"created_by_id":{"type":"string","nullable":true},"refunded_total":{"type":"string"},"refundable_total":{"type":"string"},"order":{"$ref":"#/components/schemas/Order"},"stock_location":{"$ref":"#/components/schemas/StockLocation"},"refunds":{"type":"array","items":{"$ref":"#/components/schemas/Refund"}}},"required":["id","number","status","order_id","reason_id","refund_total","display_refund_total","approved_at","received_at","refunded_at","canceled_at","memo","metadata","created_at","updated_at","stock_location_id","created_by_id","refunded_total","refundable_total"],"x-typelizer":true},"Role":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"permissions":{"type":"array","items":{"type":"string"}},"mutable":{"type":"boolean"},"users_count":{"type":"number"}},"required":["id","name","description","created_at","updated_at","permissions","mutable","users_count"],"x-typelizer":true},"SetupTask":{"type":"object","properties":{"name":{"type":"string"},"done":{"type":"boolean"}},"required":["name","done"],"x-typelizer":true},"State":{"type":"object","properties":{"abbr":{"type":"string"},"name":{"type":"string"}},"required":["abbr","name"],"x-typelizer":true},"StockItem":{"type":"object","properties":{"id":{"type":"string"},"count_on_hand":{"type":"number"},"backorderable":{"type":"boolean"},"stock_location_id":{"type":"string","nullable":true},"variant_id":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"allocated_count":{"type":"number"},"available_count":{"type":"number"},"stock_location":{"$ref":"#/components/schemas/StockLocation"},"variant":{"$ref":"#/components/schemas/Variant"}},"required":["id","count_on_hand","backorderable","stock_location_id","variant_id","metadata","created_at","updated_at","allocated_count","available_count"],"x-typelizer":true},"StockLocation":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"address1":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"zipcode":{"type":"string","nullable":true},"country_code":{"type":"string","nullable":true},"country_name":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true},"state_text":{"type":"string","nullable":true},"pickup_ready_in_minutes":{"type":"number","nullable":true},"pickup_instructions":{"type":"string","nullable":true},"admin_name":{"type":"string","nullable":true},"address2":{"type":"string","nullable":true},"state_name":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"active":{"type":"boolean"},"default":{"type":"boolean"},"backorderable_default":{"type":"boolean"},"propagate_all_variants":{"type":"boolean"},"kind":{"type":"string"},"pickup_enabled":{"type":"boolean"},"pickup_stock_policy":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","name","address1","city","zipcode","country_code","country_name","state_code","state_text","pickup_ready_in_minutes","pickup_instructions","admin_name","address2","state_name","phone","company","active","default","backorderable_default","propagate_all_variants","kind","pickup_enabled","pickup_stock_policy","created_at","updated_at"],"x-typelizer":true},"StockReservation":{"type":"object","properties":{"id":{"type":"string"},"stock_item_id":{"type":"string"},"line_item_id":{"type":"string"},"order_id":{"type":"string"},"variant_id":{"type":"string","nullable":true},"stock_location_id":{"type":"string","nullable":true},"quantity":{"type":"number"},"expires_at":{"type":"string"},"active":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","stock_item_id","line_item_id","order_id","variant_id","stock_location_id","quantity","expires_at","active","created_at","updated_at"],"x-typelizer":true},"StockTransfer":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"reference":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"source_location_id":{"type":"string","nullable":true},"destination_location_id":{"type":"string","nullable":true},"source_location":{"$ref":"#/components/schemas/StockLocation"},"destination_location":{"$ref":"#/components/schemas/StockLocation"}},"required":["id","number","reference","metadata","created_at","updated_at","source_location_id","destination_location_id"],"x-typelizer":true},"StoreCreditCategory":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"non_expiring":{"type":"boolean"}},"required":["id","name","created_at","updated_at","non_expiring"],"x-typelizer":true},"StoreCredit":{"type":"object","properties":{"id":{"type":"string"},"amount":{"type":"string"},"amount_used":{"type":"string"},"amount_remaining":{"type":"string"},"display_amount":{"type":"string"},"display_amount_used":{"type":"string"},"display_amount_remaining":{"type":"string"},"currency":{"type":"string"},"memo":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"customer_id":{"type":"string","nullable":true},"created_by_id":{"type":"string","nullable":true},"category_id":{"type":"string","nullable":true},"category_name":{"type":"string","nullable":true}},"required":["id","amount","amount_used","amount_remaining","display_amount","display_amount_used","display_amount_remaining","currency","memo","metadata","created_at","updated_at","customer_id","created_by_id","category_id","category_name"],"x-typelizer":true},"Store":{"type":"object","properties":{"id":{"type":"string"},"metadata":{"type":"object"},"name":{"type":"string"},"code":{"type":"string"},"preferred_storefront_url":{"type":"string","nullable":true},"default_currency":{"type":"string"},"default_locale":{"type":"string"},"mail_from_address":{"type":"string","nullable":true},"customer_support_email":{"type":"string","nullable":true},"new_order_notifications_email":{"type":"string","nullable":true},"preferred_send_consumer_transactional_emails":{"type":"boolean"},"preferred_admin_locale":{"type":"string","nullable":true},"preferred_timezone":{"type":"string"},"preferred_weight_unit":{"type":"string"},"preferred_default_package_weight":{"type":"number"},"preferred_default_package_length":{"type":"number"},"preferred_default_package_width":{"type":"number"},"preferred_default_package_height":{"type":"number"},"preferred_unit_system":{"type":"string"},"preferred_storefront_access":{"type":"string"},"preferred_guest_checkout":{"type":"boolean"},"preferred_company_field_enabled":{"type":"boolean"},"preferred_address_requires_company":{"type":"boolean"},"preferred_address_requires_phone":{"type":"boolean"},"preferred_capture_method":{"type":"string"},"preferred_track_inventory_levels":{"type":"boolean"},"preferred_stock_reservations_enabled":{"type":"boolean"},"preferred_track_price_history":{"type":"boolean"},"preferred_show_products_without_price":{"type":"boolean"},"preferred_disable_sku_validation":{"type":"boolean"},"preferred_order_routing_strategy":{"type":"string"},"preferred_document_number_format":{"type":"string"},"preferred_order_number_prefix":{"type":"string"},"preferred_order_number_suffix":{"type":"string"},"preferred_order_number_sequence_start":{"type":"number"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"order_number_sequence_started":{"type":"boolean"},"url":{"type":"string"},"api_url":{"type":"string"},"setup_tasks":{"type":"array","items":{"$ref":"#/components/schemas/SetupTask"}},"supported_currencies":{"type":"array","items":{"type":"string"}},"supported_locales":{"type":"array","items":{"type":"string"}},"available_locales":{"type":"array","items":{"type":"string"}},"logo_url":{"type":"string","nullable":true},"mailer_logo_url":{"type":"string","nullable":true}},"required":["id","metadata","name","code","preferred_storefront_url","default_currency","default_locale","mail_from_address","customer_support_email","new_order_notifications_email","preferred_send_consumer_transactional_emails","preferred_admin_locale","preferred_timezone","preferred_weight_unit","preferred_default_package_weight","preferred_default_package_length","preferred_default_package_width","preferred_default_package_height","preferred_unit_system","preferred_storefront_access","preferred_guest_checkout","preferred_company_field_enabled","preferred_address_requires_company","preferred_address_requires_phone","preferred_capture_method","preferred_track_inventory_levels","preferred_stock_reservations_enabled","preferred_track_price_history","preferred_show_products_without_price","preferred_disable_sku_validation","preferred_order_routing_strategy","preferred_document_number_format","preferred_order_number_prefix","preferred_order_number_suffix","preferred_order_number_sequence_start","created_at","updated_at","order_number_sequence_started","url","api_url","setup_tasks","supported_currencies","supported_locales","available_locales","logo_url","mailer_logo_url"],"x-typelizer":true},"TaxCategory":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"tax_code":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"is_default":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","name","tax_code","description","is_default","created_at","updated_at"],"x-typelizer":true},"TaxExemptionCertificate":{"type":"object","properties":{"id":{"type":"string"},"certificate_number":{"type":"string"},"reason_code":{"type":"string"},"status":{"type":"string"},"issuing_authority":{"type":"string","nullable":true},"metadata":{"type":"object","nullable":true},"issued_at":{"type":"string"},"expires_at":{"type":"string"},"verified_at":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"company_id":{"type":"string"},"country_code":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true},"active":{"type":"boolean"},"lapsed":{"type":"boolean"},"can_be_deleted":{"type":"boolean"},"document_filename":{"type":"string","nullable":true},"document_byte_size":{"type":"number","nullable":true},"document_url":{"type":"string","nullable":true}},"required":["id","certificate_number","reason_code","status","issuing_authority","metadata","issued_at","expires_at","verified_at","created_at","updated_at","company_id","country_code","state_code","active","lapsed","can_be_deleted","document_filename","document_byte_size","document_url"],"x-typelizer":true},"TaxIdentifier":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string"},"value":{"type":"string"},"validation_status":{"type":"string","nullable":true},"validation_evidence":{"type":"object","nullable":true},"source":{"type":"string","nullable":true},"validated_at":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"validatable":{"type":"boolean"},"customer_id":{"type":"string","nullable":true},"cart_id":{"type":"string","nullable":true},"order_id":{"type":"string","nullable":true}},"required":["id","kind","value","validation_status","validation_evidence","source","validated_at","created_at","updated_at","validatable","customer_id","cart_id","order_id"],"x-typelizer":true},"TaxLine":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"included":{"type":"boolean"},"rate":{"type":"string"},"tax_rate_id":{"type":"string","nullable":true},"line_item_id":{"type":"string","nullable":true},"fulfillment_id":{"type":"string","nullable":true},"fee_id":{"type":"string","nullable":true},"amount":{"type":"string"},"display_amount":{"type":"string"},"provider_id":{"type":"string","nullable":true},"metadata":{"type":"object","nullable":true},"taxability_reason":{"type":"string","nullable":true},"country_code":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true},"data":{"type":"object","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","label","included","rate","tax_rate_id","line_item_id","fulfillment_id","fee_id","amount","display_amount","provider_id","metadata","taxability_reason","country_code","state_code","data","created_at","updated_at"],"x-typelizer":true},"TaxRate":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"included_in_price":{"type":"boolean"},"show_rate_in_label":{"type":"boolean"},"metadata":{"type":"object","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"deleted_at":{"type":"string","nullable":true},"amount":{"type":"string"},"amount_percentage":{"type":"number","nullable":true},"tax_category_id":{"type":"string","nullable":true},"store_id":{"type":"string","nullable":true},"country_code":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true}},"required":["id","name","included_in_price","show_rate_in_label","metadata","created_at","updated_at","deleted_at","amount","amount_percentage","tax_category_id","store_id","country_code","state_code"],"x-typelizer":true},"Variant":{"type":"object","properties":{"id":{"type":"string"},"product_id":{"type":"string"},"sku":{"type":"string","nullable":true},"options_text":{"type":"string"},"track_inventory":{"type":"boolean"},"media_count":{"type":"number"},"preorder_ships_at":{"type":"string","nullable":true},"thumbnail_url":{"type":"string","nullable":true},"purchasable":{"type":"boolean"},"in_stock":{"type":"boolean"},"backorderable":{"type":"boolean"},"preorder":{"type":"boolean"},"weight":{"type":"number","nullable":true},"height":{"type":"number","nullable":true},"width":{"type":"number","nullable":true},"depth":{"type":"number","nullable":true},"price":{"$ref":"#/components/schemas/Price"},"original_price":{"allOf":[{"$ref":"#/components/schemas/Price"}],"nullable":true},"primary_media":{"$ref":"#/components/schemas/Media"},"media":{"type":"array","items":{"$ref":"#/components/schemas/Media"}},"option_values":{"type":"array","items":{"$ref":"#/components/schemas/OptionValue"}},"custom_fields":{"type":"array","items":{"$ref":"#/components/schemas/CustomField"}},"prior_price":{"allOf":[{"$ref":"#/components/schemas/PriceHistory"}],"nullable":true},"metadata":{"type":"object"},"position":{"type":"number"},"cost_price":{"type":"string","nullable":true},"cost_currency":{"type":"string","nullable":true},"barcode":{"type":"string","nullable":true},"weight_unit":{"type":"string","nullable":true},"dimensions_unit":{"type":"string","nullable":true},"backorder_limit":{"type":"number","nullable":true},"hs_code":{"type":"string","nullable":true},"country_of_origin":{"type":"string","nullable":true},"customs_description":{"type":"string","nullable":true},"deleted_at":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"preorderable":{"type":"boolean"},"tax_category_id":{"type":"string","nullable":true},"available_stock":{"type":"number","nullable":true},"reserved_quantity":{"type":"number"},"total_on_hand":{"type":"number","nullable":true},"product_name":{"type":"string"},"prices":{"type":"array","items":{"$ref":"#/components/schemas/Price"}},"stock_items":{"type":"array","items":{"$ref":"#/components/schemas/StockItem"}}},"required":["id","product_id","sku","options_text","track_inventory","media_count","preorder_ships_at","thumbnail_url","purchasable","in_stock","backorderable","preorder","weight","height","width","depth","price","original_price","option_values","metadata","position","cost_price","cost_currency","barcode","weight_unit","dimensions_unit","backorder_limit","hs_code","country_of_origin","customs_description","deleted_at","created_at","updated_at","preorderable","tax_category_id","available_stock","reserved_quantity","total_on_hand","product_name"],"x-typelizer":true},"Vendor":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"about":{"type":"string"},"about_html":{"type":"string"},"logo_url":{"type":"string","nullable":true},"square_logo_url":{"type":"string","nullable":true},"cover_photo_url":{"type":"string","nullable":true},"status":{"type":"string"},"contact_email":{"type":"string","nullable":true},"billing_email":{"type":"string","nullable":true},"tax_remittance":{"type":"string"},"payouts_schedule_interval":{"type":"string","nullable":true},"metadata":{"type":"object","nullable":true},"holiday_mode_until":{"type":"string","nullable":true},"terms_accepted_at":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"deleted_at":{"type":"string","nullable":true},"minimum_payout_amount":{"type":"string","nullable":true},"on_holiday":{"type":"boolean"},"sellable":{"type":"boolean"},"products_count":{"type":"number"},"users_count":{"type":"number"},"billing_address":{"$ref":"#/components/schemas/Address"},"returns_address":{"$ref":"#/components/schemas/Address"}},"required":["id","name","slug","about","about_html","logo_url","square_logo_url","cover_photo_url","status","contact_email","billing_email","tax_remittance","payouts_schedule_interval","metadata","holiday_mode_until","terms_accepted_at","created_at","updated_at","deleted_at","minimum_payout_amount","on_holiday","sellable","products_count","users_count"],"x-typelizer":true},"WebhookDelivery":{"type":"object","properties":{"id":{"type":"string"},"event_name":{"type":"string"},"event_id":{"type":"string","nullable":true},"response_code":{"type":"number","nullable":true},"execution_time":{"type":"number","nullable":true},"error_type":{"type":"string","nullable":true},"request_errors":{"type":"string","nullable":true},"response_body":{"type":"string","nullable":true},"success":{"type":"boolean","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"delivered_at":{"type":"string","nullable":true},"payload":{"type":"object"},"webhook_endpoint_id":{"type":"string"},"webhook_endpoint_url":{"type":"string"}},"required":["id","event_name","event_id","response_code","execution_time","error_type","request_errors","response_body","success","created_at","updated_at","delivered_at","payload","webhook_endpoint_id","webhook_endpoint_url"],"x-typelizer":true},"WebhookEndpoint":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string","nullable":true},"url":{"type":"string"},"active":{"type":"boolean"},"subscriptions":{"type":"array","items":{"type":"string"}},"disabled_reason":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"disabled_at":{"type":"string","nullable":true},"secret_key":{"type":"string","nullable":true},"last_delivery_at":{"type":"string","nullable":true},"recent_delivery_count":{"type":"number"},"recent_failure_count":{"type":"number"},"total_delivery_count":{"type":"number"},"successful_delivery_count":{"type":"number"},"failed_delivery_count":{"type":"number"}},"required":["id","name","url","active","subscriptions","disabled_reason","created_at","updated_at","disabled_at","secret_key","last_delivery_at","recent_delivery_count","recent_failure_count","total_delivery_count","successful_delivery_count","failed_delivery_count"],"x-typelizer":true}}}}
\ No newline at end of file
+{"info":{"title":"Admin API","contact":{"name":"Spree Commerce","url":"https://spreecommerce.org","email":"[email protected]"},"description":"Spree Admin API v3 - Administrative API for managing products, orders, and store settings.\n\n## Authentication\n\nThe Admin API requires a secret API key passed in the `x-spree-api-key` header.\nSecret API keys can be generated in the Spree admin dashboard.\n\n## Response Format\n\nAll responses are JSON. List endpoints return paginated responses with `data` and `meta` keys.\nSingle resource endpoints return a flat JSON object.\n\n## Resource IDs\n\nEvery resource is identified by an opaque string ID (e.g. `prod_86Rf07xd4z`,\n`variant_k5nR8xLq`, `or_UkLWZg9DAJ`). Use these IDs everywhere — URL paths,\nrequest bodies, and Ransack filters all accept them directly.\n\n## Error Handling\n\nErrors return a consistent format:\n```json\n{\n \"error\": {\n \"code\": \"validation_error\",\n \"message\": \"Validation failed\",\n \"details\": { \"name\": [\"can't be blank\"] }\n }\n}\n```\n","version":"v3"},"paths":{"/api/v3/admin/auth/login":{"post":{"summary":"Login","tags":["Authentication"],"security":[{"api_key":[]}],"description":"Authenticates an admin user and returns a short-lived JWT access token.\nThe rotatable refresh token is set in an HttpOnly cookie — it is not\nincluded in the response body.\n\nThe `provider` field selects the authentication method. When omitted it\ndefaults to `email`, the built-in email/password login.\n\nTo authenticate against a third-party identity provider (Okta, Azure AD,\nGoogle Workspace SSO, a custom JWT issuer, SAML, etc.), send\n`{ \"provider\": \"<your_key>\", ... }` with the fields that provider\nrequires. The endpoint returns the same JWT regardless of which provider\nauthenticated the request. See\n[Custom API Authentication](https://spreecommerce.org/docs/developer/how-to/custom-api-authentication)\nfor the list of configured providers and their required fields.\n","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"login successful","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthResponse"}}}},"401":{"description":"invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"oneOf":[{"title":"EmailPasswordLogin","description":"Built-in email/password authentication (default when `provider` is omitted).","type":"object","properties":{"provider":{"type":"string","enum":["email"],"default":"email"},"email":{"type":"string","format":"email"},"password":{"type":"string"}},"required":["email","password"]},{"title":"ProviderLogin","description":"Provider-dispatched login. The `provider` key selects a configured\nauthentication provider; the remaining fields are forwarded to it.\nRequired fields depend on the provider — see\n[Custom API Authentication](https://spreecommerce.org/docs/developer/how-to/custom-api-authentication).\n","type":"object","properties":{"provider":{"type":"string","description":"Registered provider key (anything other than `email`).","not":{"enum":["email"]}}},"required":["provider"],"additionalProperties":true}]}}}}}},"/api/v3/admin/auth/refresh":{"post":{"summary":"Refresh token","tags":["Authentication"],"security":[{"api_key":[]}],"description":"Exchanges the HttpOnly refresh-token cookie for a new access JWT and a\nrotated refresh token cookie. No request body or Authorization header\nis required — the cookie alone authenticates the call.\n","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"refresh successful","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthResponse"}}}},"401":{"description":"missing or invalid refresh-token cookie","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/auth/logout":{"post":{"summary":"Logout","tags":["Authentication"],"security":[{"api_key":[]}],"description":"Revokes the refresh-token cookie, effectively logging the admin out.","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"logout successful"}}}},"/api/v3/admin/me":{"get":{"summary":"Get current admin user and permissions","tags":["Authentication"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the current admin user profile and a serialized list of permissions (CanCanCan rules). The SPA uses these to drive UI permission checks.","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"current admin user and permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update the current admin profile","tags":["Authentication"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Self-service update of the signed-in admin's own profile, such as their admin UI display language (`selected_locale`).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"profile updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"selected_locale":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"}}}}}}}},"/api/v3/admin/auth/password_resets":{"post":{"summary":"Request password reset","tags":["Authentication"],"security":[{"api_key":[]}],"description":"Requests a password reset email for an admin user. Always returns `202`\nwhether or not the email matches an account, to prevent enumeration.\n\n`redirect_url` is where the emailed link should point (the reset token\nis appended as a `token` query param). It must match one of the store's\nallowed origins — otherwise it is silently ignored and the server-side\ndefault is used. The email is delivered by Spree itself via the\n`admin_user.password_reset_requested` event; this event is never\nforwarded to webhook endpoints.\n","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"202":{"description":"reset requested","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"redirect_url":{"type":"string","description":"Must match an allowed origin of the store; ignored otherwise."}},"required":["email"]}}}}}},"/api/v3/admin/auth/password_resets/{id}":{"patch":{"summary":"Reset password","tags":["Authentication"],"security":[{"api_key":[]}],"description":"Consumes a password reset token (the `token` query param from the\nemailed link), sets the new password, and signs the admin in: the\nresponse carries a JWT access token and the rotatable refresh token is\nset in an HttpOnly cookie. The token is single-use — it invalidates as\nsoon as the password changes.\n","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","description":"The reset token from the emailed link","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"password reset","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthResponse"}}}},"422":{"description":"invalid or expired token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"password":{"type":"string"},"password_confirmation":{"type":"string"}},"required":["password","password_confirmation"]}}}}}},"/api/v3/admin/auth/setup":{"get":{"summary":"Check first-run setup availability","tags":["Authentication"],"description":"Reports whether first-run setup is still available — true only while\nthe installation has no admin user. Unauthenticated; the dashboard\nlogin page uses it to offer the setup screen.\n","responses":{"200":{"description":"setup status","content":{"application/json":{}}}}},"post":{"summary":"Complete first-run setup","tags":["Authentication"],"description":"Creates the first admin account and adopts the seeded store, authorized\nby the one-time setup token printed at install time (rotate it with\n`bin/rails spree:setup:token`). Issues a JWT access token and a\nrefresh-token cookie exactly like login. Returns 404 once any admin\nuser exists — the flow is closed permanently after setup.\n","parameters":[],"responses":{"200":{"description":"setup completed","content":{"application/json":{}}},"404":{"description":"setup not available","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["setup_token","email","password","country_code"],"properties":{"setup_token":{"type":"string","description":"One-time token from the install output."},"email":{"type":"string","format":"email"},"password":{"type":"string"},"password_confirmation":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"store_name":{"type":"string"},"country_code":{"type":"string","description":"ISO 3166-1 alpha-2 country the store sells from. Determines the default market, the warehouse, the delivery zones and the currency."},"locale":{"type":"string","description":"Storefront locale. Defaults to the country's own language."},"currency":{"type":"string","description":"ISO 4217 currency. Defaults to the country's own currency — pass one only when the store prices in something else."}}}}}}}},"/api/v3/admin/auth/setup/countries":{"get":{"summary":"List countries for first-run setup","tags":["Authentication"],"description":"Countries the store can be set up in, each with the currency and\nofficial languages derived from it. Unauthenticated, because the setup\nscreen runs before any credential exists. Returns 404 once any admin\nuser exists.\n","responses":{"200":{"description":"countries","content":{"application/json":{}}}}}},"/api/v3/admin/allowed_origins":{"get":{"summary":"List allowed origins","tags":["Allowed Origins"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the CORS allowlist for the current store. Each entry is a\nbare `scheme://host[:port]` permitted to call the admin API from a\nbrowser. Backs the `Rack::Cors` allowlist and the CSRF boundary of\nthe admin cookie session (see\n`docs/plans/5.5-admin-auth-cookie-refresh.md`).\n\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[origin_cont]","in":"query","required":false,"description":"Filter by origin (contains)","schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"allowed origins found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/AllowedOrigin"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create an allowed origin","tags":["Allowed Origins"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Adds an origin to the admin CORS allowlist. The value must be a bare\n`scheme://host[:port]` (no path, query, or fragment) and use `http` or\n`https`.\n\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"allowed origin created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AllowedOrigin"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"origin":{"type":"string"}},"required":["origin"]}}}}}},"/api/v3/admin/allowed_origins/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"Allowed origin ID","schema":{"type":"string"}}],"get":{"summary":"Get an allowed origin","tags":["Allowed Origins"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single allowed origin by prefixed ID.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"allowed origin found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AllowedOrigin"}}}},"404":{"description":"allowed origin not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update an allowed origin","tags":["Allowed Origins"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates an existing allowed origin.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"allowed origin updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AllowedOrigin"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"origin":{"type":"string"}}}}}}},"delete":{"summary":"Delete an allowed origin","tags":["Allowed Origins"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes an origin from the admin CORS allowlist. After deletion the\nadmin SPA running at that origin will no longer be able to call the\nadmin API from a browser.\n\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"204":{"description":"allowed origin deleted"}}}},"/api/v3/admin/api_keys":{"get":{"summary":"List API keys","tags":["API Keys"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns publishable and secret API keys for the current store. Secret keys are listed by `token_prefix` only — the plaintext token is delivered exactly once on create.\n\n**Required scope:** `read_api_keys` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"API keys found","content":{"application/json":{}}}}},"post":{"summary":"Create an API key","tags":["API Keys"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a publishable or secret API key. The plaintext token is included in the response **once** for secret keys; publishable keys expose their token on every read since they are intended for client-side use.\n\n**Required scope:** `write_api_keys` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"secret key created — plaintext token returned once","content":{"application/json":{}}},"422":{"description":"validation error","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name","key_type"],"properties":{"name":{"type":"string"},"key_type":{"type":"string","enum":["publishable","secret"]},"scopes":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/api_keys/{id}":{"get":{"summary":"Show an API key","tags":["API Keys"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_api_keys` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"API key found","content":{"application/json":{}}}}},"patch":{"summary":"Update an API key","tags":["API Keys"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Renames a key. `key_type` and `scopes` are fixed at creation — to change a key's authority, create a new key and revoke the old one.\n\n**Required scope:** `write_api_keys` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"API key renamed","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"}}}}}}},"delete":{"summary":"Delete an API key","tags":["API Keys"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_api_keys` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"API key deleted"}}}},"/api/v3/admin/api_keys/current":{"get":{"summary":"Describe the current API key","tags":["API Keys"],"security":[{"api_key":[]}],"description":"Returns the secret key that authenticated this request, including its live scopes. Useful to confirm a key's real, current authority. Only secret-key principals have a single key to describe.\n\n**Required scope:** none — any key can describe itself (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"current API key","content":{"application/json":{}}}}}},"/api/v3/admin/api_keys/{id}/revoke":{"patch":{"summary":"Revoke an API key","tags":["API Keys"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Marks the key revoked. Future requests using its token will fail; the row is preserved for audit.\n\n**Required scope:** `write_api_keys` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"API key revoked","content":{"application/json":{}}}}}},"/api/v3/admin/categories":{"get":{"summary":"List categories","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a paginated list of the store's categories (manual hierarchical taxons; rule-based collections are excluded).\n\n**Required scope:** `read_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., children, parent, ancestors).","schema":{"type":"string"}}],"responses":{"200":{"description":"categories found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Category"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Create a category","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a category. Nests under the parent when parent_id is given, otherwise creates a top-level category.\n\n**Required scope:** `write_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"category created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Category"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"parent_id":{"type":"string","description":"Prefixed ID of the parent category"},"description":{"type":"string"},"permalink":{"type":"string"},"meta_title":{"type":"string"},"meta_description":{"type":"string"},"meta_keywords":{"type":"string"}},"required":["name"]}}}}}},"/api/v3/admin/categories/{id}":{"get":{"summary":"Get a category","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single category by ID.\n\n**Required scope:** `read_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Category ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., children, parent, ancestors).","schema":{"type":"string"}}],"responses":{"200":{"description":"category found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Category"}}}},"404":{"description":"category not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a category","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a category.\n\n**Required scope:** `write_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Category ID","schema":{"type":"string"}}],"responses":{"200":{"description":"category updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Category"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"parent_id":{"type":"string","description":"Prefixed ID of the parent category"},"description":{"type":"string"},"permalink":{"type":"string"},"meta_title":{"type":"string"},"meta_description":{"type":"string"},"meta_keywords":{"type":"string"}}}}}}},"delete":{"summary":"Delete a category","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes a category and its descendants.\n\n**Required scope:** `write_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Category ID","schema":{"type":"string"}}],"responses":{"204":{"description":"category deleted"}}}},"/api/v3/admin/categories/{id}/reposition":{"patch":{"summary":"Reposition a category","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Moves a category to a new parent and/or index within the tree.\n\n**Required scope:** `write_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Category ID","schema":{"type":"string"}}],"responses":{"200":{"description":"category repositioned","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Category"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"new_parent_id":{"type":"string","description":"Prefixed ID of the new parent (omit for top level)"},"new_position":{"type":"integer","description":"0-based index among the new parent's children"}},"required":["new_position"]}}}}}},"/api/v3/admin/categories/{category_id}/products":{"get":{"summary":"List category products","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Products classified under the category, ordered by their classification position.\n\n**Required scope:** `read_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"category_id","in":"path","required":true,"description":"Category ID","schema":{"type":"string"}}],"responses":{"200":{"description":"products found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Product"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Add a product to a category","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Classifies a product under the category (appended to the end).\n\n**Required scope:** `write_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"category_id","in":"path","required":true,"description":"Category ID","schema":{"type":"string"}}],"responses":{"201":{"description":"product added","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"product_id":{"type":"string"}},"required":["product_id"]}}}}}},"/api/v3/admin/categories/{category_id}/products/{id}":{"delete":{"summary":"Remove a product from a category","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes a product from the category's manual classification.\n\n**Required scope:** `write_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"category_id","in":"path","required":true,"description":"Category ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}}],"responses":{"204":{"description":"product removed"}}}},"/api/v3/admin/categories/{category_id}/products/{id}/reposition":{"patch":{"summary":"Reposition a category product","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Moves a product to a new index among the category's products.\n\n**Required scope:** `write_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"category_id","in":"path","required":true,"description":"Category ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}}],"responses":{"204":{"description":"product repositioned"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"new_position":{"type":"integer","description":"0-based index among the category's products"}},"required":["new_position"]}}}}}},"/api/v3/admin/channels":{"get":{"summary":"List channels","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the channels configured for the current store.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"channels found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Channel"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Create a channel","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new channel on the current store. `code` is normalized to a\nURL-safe slug (`Point of Sale` → `point-of-sale`); when omitted it's\nderived from `name`.\n\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"channel created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"code":{"type":"string","description":"Slug — auto-derived from `name` when blank."},"active":{"type":"boolean","default":true},"default":{"type":"boolean","default":false},"preferred_order_routing_strategy":{"type":"string","nullable":true,"description":"Routing strategy class name. `null` inherits the store setting."},"preferred_storefront_access":{"type":"string","nullable":true,"enum":["public","prices_hidden","login_required"],"description":"Anonymous-visitor access posture. `null` inherits the store setting."},"preferred_guest_checkout":{"type":"boolean","nullable":true,"description":"Whether guests can check out without an account. `null` inherits the store setting."}}}}}}}},"/api/v3/admin/channels/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get a channel","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"channel found","content":{"application/json":{}}}}},"patch":{"summary":"Update a channel","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"channel updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"code":{"type":"string"},"active":{"type":"boolean"},"default":{"type":"boolean"},"preferred_order_routing_strategy":{"type":"string","nullable":true,"description":"Routing strategy class name. `null` inherits the store setting."},"preferred_storefront_access":{"type":"string","nullable":true,"enum":["public","prices_hidden","login_required"],"description":"Anonymous-visitor access posture. `null` inherits the store setting."},"preferred_guest_checkout":{"type":"boolean","nullable":true,"description":"Whether guests can check out without an account. `null` inherits the store setting."}}}}}}},"delete":{"summary":"Delete a channel","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"channel deleted"}}}},"/api/v3/admin/channels/{id}/add_products":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"post":{"summary":"Publish products on a channel","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Publishes the listed products on this channel. Idempotent — re-publishing\nan already-published product updates its publication window. Products from\nsibling stores are silently dropped.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products published","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["product_ids"],"properties":{"product_ids":{"type":"array","items":{"type":"string"}},"published_at":{"type":"string","format":"date-time","nullable":true,"description":"When the publications go live. `null` means immediately."},"unpublished_at":{"type":"string","format":"date-time","nullable":true,"description":"When the publications come down. `null` means never."}}}}}}}},"/api/v3/admin/channels/{id}/remove_products":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"post":{"summary":"Unpublish products from a channel","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Unpublishes the listed products from this channel.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products unpublished","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["product_ids"],"properties":{"product_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/channels/{channel_id}/order_routing_rules":{"parameters":[{"name":"channel_id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"List order routing rules for a channel","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the channel's routing rules in priority order. The rules engine walks them top-down; see the Order Routing guide.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"rules found","content":{"application/json":{}}}}},"post":{"summary":"Create an order routing rule on a channel","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Adds a rule to the channel's routing list. The `type` is the wire shorthand from `GET /order_routing_rules/types` (e.g. `preferred_location`). Omitting `position` appends the rule at the end of the list. Each rule kind can appear at most once per channel — a duplicate `type` is rejected with a validation error.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"rule created","content":{"application/json":{}}},"422":{"description":"unknown rule type","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"active":{"type":"boolean"},"position":{"type":"integer"},"preferences":{"type":"object","additionalProperties":true}},"required":["type"]}}}}}},"/api/v3/admin/channels/{channel_id}/order_routing_rules/{id}":{"parameters":[{"name":"channel_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"summary":"Update an order routing rule","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a rule's `active` flag, `position` (the list reorders around it), or `preferences`. The rule kind cannot be changed — delete and re-create instead.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"rule updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"active":{"type":"boolean"},"position":{"type":"integer"},"preferences":{"type":"object","additionalProperties":true}}}}}}},"delete":{"summary":"Delete an order routing rule","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"rule deleted"}}}},"/api/v3/admin/order_routing_rules/types":{"get":{"summary":"List available order routing rule types","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Enumerates the registered rule kinds with their labels, descriptions and preference schemas — drives the \"Add rule\" picker in the admin dashboard. Plugins extend the list by registering `Spree::OrderRoutingRule` subclasses via `Spree.order_routing.rules`.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"types found","content":{"application/json":{}}}}}},"/api/v3/admin/custom_field_definitions":{"get":{"summary":"List custom field definitions","tags":["Custom Fields"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns all defined custom fields. Filter by `?q[resource_type_eq]=Spree::Product` to narrow to one parent type.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand. Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., key,label,field_type). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"definitions returned","content":{"application/json":{}}}}},"post":{"summary":"Create a custom field definition","tags":["Custom Fields"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"definition created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["key","field_type","resource_type"],"properties":{"namespace":{"type":"string","description":"Defaults to `custom`"},"key":{"type":"string"},"label":{"type":"string","description":"Human-readable name; defaults to titleized `key`"},"field_type":{"type":"string","description":"Custom field type identifier (one of the registered field-type class names)."},"resource_type":{"type":"string","description":"Owner class, e.g. `Spree::Product`"},"storefront_visible":{"type":"boolean","description":"When false, the definition is admin-only and never exposed in the Store API"},"searchable":{"type":"boolean","description":"When true, values are included in storefront product text search"},"sortable":{"type":"boolean","description":"When true, storefront product listings can sort by this field"}}}}}}}},"/api/v3/admin/custom_field_definitions/{id}":{"get":{"summary":"Show a custom field definition","tags":["Custom Fields"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand. Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., key,label,field_type). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"definition found","content":{"application/json":{}}}}},"patch":{"summary":"Update a custom field definition","tags":["Custom Fields"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"definition updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string"},"storefront_visible":{"type":"boolean"},"searchable":{"type":"boolean"},"sortable":{"type":"boolean"}}}}}}},"delete":{"summary":"Delete a custom field definition","tags":["Custom Fields"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes the definition and cascades to all custom field values referencing it.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"definition deleted"}}}},"/api/v3/admin/customer_groups":{"get":{"summary":"List customer groups","tags":["Customer Groups"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the customer groups configured for the current store. Groups\nsegment customers for targeted promotions (see the `customer_group`\npromotion rule) and reporting. The list endpoint never embeds the\nmember list — fetch a single group with `?expand=customers` if you\nneed them inline, or query `/admin/customers?customer_group_id_in=…`\nfor paginated membership.\n\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"description":"Filter by name (contains)","schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"customer groups found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CustomerGroup"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a customer group","tags":["Customer Groups"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a customer group in the current store. `customer_ids` is\noptional; when present, customers are attached at create time.\nPass prefixed IDs (e.g. `cus_…`) — the server decodes them\nautomatically.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"customer group created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerGroup"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"customer_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/customer_groups/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"Customer group prefixed ID","schema":{"type":"string"}}],"get":{"summary":"Get a customer group","tags":["Customer Groups"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single customer group. Pass `?expand=customers` to embed\nthe full member list inline (recommended only for single-record\nreads — embed cost scales with membership size).\n\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to embed. Supported: `customers`.","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"customer group with embedded customers","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerGroup"}}}},"404":{"description":"customer group not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a customer group","tags":["Customer Groups"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates name, description, or membership. `customer_ids` is a\nfull-set replacement — the server reconciles the membership to\nmatch the array, adding new IDs and removing ones not present.\nSend `customer_ids: []` to clear all members.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"customer group updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerGroup"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"customer_ids":{"type":"array","items":{"type":"string"}}}}}}}},"delete":{"summary":"Delete a customer group","tags":["Customer Groups"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes the group. Member users are not deleted; their `customer_group_users` rows are dropped.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"customer group deleted"}}}},"/api/v3/admin/customers/{customer_id}/addresses":{"get":{"summary":"List customer addresses","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the customer's saved addresses.\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., country, state). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., first_name,last_name,address1,city). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"addresses found","content":{"application/json":{}}}}},"post":{"summary":"Create a customer address","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Adds a new address to the customer's address book. Pass `is_default_billing: true` or `is_default_shipping: true` to set as the default — the previous default loses its flag in the same transaction.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"address created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"address1":{"type":"string"},"address2":{"type":"string"},"city":{"type":"string"},"postal_code":{"type":"string"},"country_code":{"type":"string","description":"ISO-2 country code (e.g. US)"},"state_code":{"type":"string","description":"State/province abbreviation (e.g. NY)"},"phone":{"type":"string"},"company":{"type":"string"},"label":{"type":"string"},"is_default_billing":{"type":"boolean"},"is_default_shipping":{"type":"boolean"}}}}}}}},"/api/v3/admin/customers/{customer_id}/addresses/{id}":{"patch":{"summary":"Update a customer address","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a customer address.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"address updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"city":{"type":"string"},"is_default_billing":{"type":"boolean"},"is_default_shipping":{"type":"boolean"}}}}}}},"delete":{"summary":"Delete a customer address","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes the address. If it was a default, the customer loses that default (no auto-promotion).\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"address deleted"}}}},"/api/v3/admin/customers/{customer_id}/credit_cards":{"get":{"summary":"List customer credit cards","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the customer's saved credit cards. Useful for off-session admin charges via `POST /admin/orders/:id/payments { source_id }`.\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., payment_method). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., brand,last4,month,year). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"credit cards found","content":{"application/json":{}}}}}},"/api/v3/admin/customers/{customer_id}/credit_cards/{id}":{"get":{"summary":"Show a customer credit card","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a saved credit card by ID.\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., payment_method). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., brand,last4,month,year). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"credit card found","content":{"application/json":{}}}}},"delete":{"summary":"Delete a customer credit card","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes a saved credit card.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"credit card deleted"}}}},"/api/v3/admin/customers/{customer_id}/store_credits":{"get":{"summary":"List customer store credits","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns store credits issued to the customer.\n\n**Required scope:** `read_store_credits` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., category, store, created_by). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., amount,amount_used,memo,currency). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"store credits found","content":{"application/json":{}}}}},"post":{"summary":"Issue a store credit to a customer","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"`created_by` is set automatically from the authenticated admin.\n\n**Required scope:** `write_store_credits` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"store credit created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["amount","currency","category_id"],"properties":{"amount":{"type":"string"},"currency":{"type":"string"},"category_id":{"type":"string","description":"StoreCreditCategory ID"},"memo":{"type":"string"}}}}}}}},"/api/v3/admin/customers/{customer_id}/store_credits/{id}":{"patch":{"summary":"Update a store credit","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Update memo / category / amount. The amount can only be changed if `amount_used == 0`.\n\n**Required scope:** `write_store_credits` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"store credit updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"amount":{"type":"string"},"category_id":{"type":"string"},"memo":{"type":"string"}}}}}}},"delete":{"summary":"Delete a store credit","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes an unused store credit (amount_used == 0). Returns 422 otherwise.\n\n**Required scope:** `write_store_credits` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"store credit deleted"}}}},"/api/v3/admin/customers":{"get":{"summary":"List customers","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a paginated list of customers. Supports Ransack search/filters.\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"q[search]","in":"query","required":false,"description":"Email + name full-text-ish search","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., addresses, store_credits). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., email,first_name,last_name). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"customers found","content":{"application/json":{}}}}},"post":{"summary":"Create a customer","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a customer. No welcome email is sent automatically.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"customer created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"phone":{"type":"string"},"accepts_email_marketing":{"type":"boolean"},"internal_note":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"metadata":{"type":"object"}}}}}}}},"/api/v3/admin/customers/{id}":{"get":{"summary":"Show a customer","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns full customer details including computed order stats (orders_count, total_spent, last_order_completed_at).\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Customer ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations: addresses, orders, store_credits, default_billing_address, default_shipping_address","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., email,first_name,last_name). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"customer found","content":{"application/json":{}}}}},"patch":{"summary":"Update a customer","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates customer attributes. `tags` replaces the full set.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"customer updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"phone":{"type":"string"},"accepts_email_marketing":{"type":"boolean"},"internal_note":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"metadata":{"type":"object"}}}}}}},"delete":{"summary":"Delete a customer","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes a customer. Returns 422 if the customer has any orders.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"customer deleted"}}}},"/api/v3/admin/customers/bulk_add_to_groups":{"post":{"summary":"Bulk-add customers to groups","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Attaches each customer in `ids` to every group in `customer_group_ids`.\nIdempotent — customers already in a group are skipped server-side.\nGroups from sibling stores are silently ignored. Returns counts of\ncustomers and groups that were processed (post store-scoping).\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"customers added to groups","content":{"application/json":{"schema":{"type":"object","properties":{"customer_count":{"type":"integer"},"customer_group_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","customer_group_ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"customer_group_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/customers/bulk_remove_from_groups":{"post":{"summary":"Bulk-remove customers from groups","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Detaches each customer in `ids` from every group in `customer_group_ids`.\nNo-op for non-members. Groups from sibling stores are silently ignored.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"customers removed from groups","content":{"application/json":{"schema":{"type":"object","properties":{"customer_count":{"type":"integer"},"customer_group_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","customer_group_ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"customer_group_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/customers/bulk_add_tags":{"post":{"summary":"Bulk-add tags to customers","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Adds each tag name in `tags` to every customer in `ids`. Tags are\nupserted by name; re-adding an existing tag is a no-op.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"tags added","content":{"application/json":{"schema":{"type":"object","properties":{"customer_count":{"type":"integer"},"tag_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","tags"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/customers/bulk_remove_tags":{"post":{"summary":"Bulk-remove tags from customers","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes each tag name in `tags` from every customer in `ids`. No-op\nfor customers that don't carry the tag.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"tags removed","content":{"application/json":{"schema":{"type":"object","properties":{"customer_count":{"type":"integer"},"tag_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","tags"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/exports":{"get":{"summary":"List exports","tags":["Exports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns CSV exports queued or completed for the current store. Polled by the admin SPA to detect when an export finishes (`done: true`).\n\n**Required scope:** the read scope of the exported resource — `read_products` for product exports, `read_customers` for customer exports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"exports found","content":{"application/json":{}}}}},"post":{"summary":"Create an export","tags":["Exports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Queues a CSV export. The `type` selects the dataset; `search_params` is an\noptional Ransack query (same shape used by the `q[...]` params on list endpoints)\nthat filters which records are exported. Pass `record_selection: \"all\"` to\nclear the filter server-side and export everything in scope.\n\nGeneration is asynchronous. Poll `GET /admin/exports/{id}` until `done` is `true`,\nthen redirect the browser to `download_url` to fetch the file.\n\n\n**Required scope:** the read scope of the exported resource — `read_products` for product exports, `read_customers` for customer exports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"export queued","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["products","orders","customers","product_translations","gift_cards","coupon_codes","newsletter_subscribers"]},"record_selection":{"type":"string","enum":["filtered","all"],"description":"Set to \"all\" to ignore search_params and export everything in scope."},"search_params":{"type":"object","description":"Ransack query hash. Same predicates accepted by the list endpoint.","additionalProperties":true},"results_url":{"type":"string","description":"Absolute URL of your admin exports view; the export-done email uses it as the download button target. Only honored when it matches one of the store's configured allowed origins."}}}}}}}},"/api/v3/admin/exports/{id}":{"get":{"summary":"Show an export","tags":["Exports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns export status. While `done` is `false`, the SPA continues polling.\n\n**Required scope:** the read scope of the exported resource — `read_products` for product exports, `read_customers` for customer exports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"export found","content":{"application/json":{}}}}},"delete":{"summary":"Delete an export","tags":["Exports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes the export and purges its attachment.\n\n**Required scope:** the read scope of the exported resource — `read_products` for product exports, `read_customers` for customer exports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"export deleted"}}}},"/api/v3/admin/exports/{id}/download":{"get":{"summary":"Download an export","tags":["Exports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Streams the exported CSV with `Content-Disposition: attachment`. Returns 422 with `code: export_not_ready` while `done` is still `false`. The endpoint is JWT/API-key protected, so SPA clients must fetch it (with `Authorization` header) and trigger the browser download via a Blob URL — a top-level navigation cannot carry the JWT.\n\n**Required scope:** the read scope of the exported resource — `read_products` for product exports, `read_customers` for customer exports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"CSV file","content":{"application/json":{},"text/csv":{"schema":{"type":"string","format":"binary"}}}}}}},"/api/v3/admin/orders/{order_id}/fulfillments":{"get":{"summary":"List fulfillments","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns all shipments for an order.\n\n**Required scope:** `read_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., inventory_units, stock_location, shipping_rates). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., number,status,tracking,cost). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"fulfillments found","content":{"application/json":{}}}}},"post":{"summary":"Create a fulfillment","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Manually creates a fulfillment on a completed order, bypassing order routing — for example to mirror a shipment handled by an external carrier or 3PL. Moves the requested line item quantities out of their current fulfillments; when `items` is omitted, every not-yet-shipped unit is moved. Pass `status: 'shipped'` to register an already-shipped fulfillment (fires shipped webhooks and freezes cost/carrier). When `delivery_method_id` is omitted, the fulfillment inherits the delivery method and cost of the source fulfillment(s) it fully drains — keeping the order total unchanged; partially drained splits get no carrier when shipped, and pending fulfillments are otherwise (re)priced by the standard rate engine, which selects the lowest-cost available rate. Pass `cost` to set an explicit shipping cost instead (e.g. the 3PL price) — note this changes the order total and payment state, and is guaranteed to persist only with `status: 'shipped'` (pending fulfillments are re-priced by the rate engine).\n\n**Required scope:** `write_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"201":{"description":"fulfillment created","content":{"application/json":{}}},"422":{"description":"order not completed","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["stock_location_id"],"properties":{"stock_location_id":{"type":"string","description":"Stock location the fulfillment ships from"},"tracking":{"type":"string","description":"Carrier tracking number, or a full https:// tracking link — a full URL is served back as tracking_url unchanged instead of being templated into the delivery method tracking URL"},"delivery_method_id":{"type":"string","description":"Delivery method (carrier) to attach as the selected rate. Defaults to the delivery method of the fully drained source fulfillment(s)"},"cost":{"type":"string","description":"Explicit shipping cost. Defaults to the summed cost of the fully drained source fulfillment(s), which keeps the order total unchanged; an explicit cost changes the order total and payment state. Guaranteed to persist only with status: 'shipped' — pending fulfillments are re-priced by the rate engine"},"status":{"type":"string","enum":["shipped"],"description":"Pass 'shipped' to register the fulfillment as already shipped"},"items":{"type":"array","description":"Line item quantities to fulfill. Omit to fulfill every not-yet-shipped unit.","items":{"type":"object","required":["item_id","quantity"],"properties":{"item_id":{"type":"string","description":"Line item ID"},"quantity":{"type":"integer"}}}},"metadata":{"type":"object","additionalProperties":true}}}}}}}},"/api/v3/admin/orders/{order_id}/fulfillments/{id}":{"get":{"summary":"Show a shipment","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns details of a specific shipment.\n\n**Required scope:** `read_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Fulfillment ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., inventory_units, stock_location, shipping_rates). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., number,status,tracking,cost). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"shipment found","content":{"application/json":{}}}}},"patch":{"summary":"Update a shipment","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a fulfillment (tracking, delivery rate).\n\n**Required scope:** `write_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Fulfillment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"shipment updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"tracking":{"type":"string","description":"Carrier tracking number, or a full https:// tracking link served back as tracking_url unchanged"},"selected_delivery_rate_id":{"type":"string","description":"Delivery rate ID (dr_...) to select"}}}}}}}},"/api/v3/admin/orders/{order_id}/fulfillments/{id}/fulfill":{"patch":{"summary":"Fulfill a fulfillment","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Marks a fulfillment as fulfilled.\n\n**Required scope:** `write_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Fulfillment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"fulfillment fulfilled","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{order_id}/fulfillments/{id}/purchase_label":{"patch":{"summary":"Buy the shipping label","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Buys the shipping label for a parcel that has not shipped yet — print it, pack the box, then mark the fulfillment fulfilled. Only delivery methods whose provider produces labels accept this.\n\n**Required scope:** `write_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Fulfillment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"label purchased","content":{"application/json":{}}},"422":{"description":"provider does not produce labels","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{order_id}/fulfillments/{id}/mark_delivered":{"patch":{"summary":"Mark a fulfillment delivered","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Records that the customer received the goods. Only a fulfilled shipment can be marked delivered.\n\n**Required scope:** `write_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Fulfillment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"fulfillment delivered","content":{"application/json":{}}},"422":{"description":"fulfillment has not shipped","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"delivered_at":{"type":"string","format":"date-time","description":"When the goods arrived. Defaults to now."},"notify_customer":{"type":"boolean","description":"Whether the customer gets a delivery notification. Defaults to true."}}}}}}}},"/api/v3/admin/orders/{order_id}/fulfillments/{id}/cancel":{"patch":{"summary":"Cancel a fulfillment","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Cancels a fulfillment.\n\n**Required scope:** `write_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Fulfillment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"fulfillment canceled","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{order_id}/fulfillments/{id}/resume":{"patch":{"summary":"Resume a fulfillment","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Resumes a canceled fulfillment.\n\n**Required scope:** `write_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Fulfillment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"fulfillment resumed","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{order_id}/fulfillments/{id}/split":{"patch":{"summary":"Split a fulfillment","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Transfers items from this shipment to a new shipment at a different stock location.\n\n**Required scope:** `write_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Fulfillment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"fulfillment split","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["variant_id","quantity"],"properties":{"variant_id":{"type":"string","description":"Variant ID"},"quantity":{"type":"integer"},"stock_location_id":{"type":"string","description":"Target stock location ID"}}}}}}}},"/api/v3/admin/gift_card_batches":{"get":{"summary":"List gift card batches","tags":["Gift Cards"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the gift card batches issued by the current store. Each batch\ngroups the cards generated together for a campaign or bulk-issuance\n— the cards themselves live under `/admin/gift_cards` and reference\nthe batch via `gift_card_batch_id`.\n\n\n**Required scope:** `read_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Records per page","schema":{"type":"integer"}},{"name":"q[prefix_cont]","in":"query","required":false,"description":"Filter by prefix (contains)","schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending.","schema":{"type":"string"}}],"responses":{"200":{"description":"gift card batches found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/GiftCardBatch"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Create a gift card batch","tags":["Gift Cards"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Issues a batch of gift cards in a single call. The server generates\n`codes_count` cards inline for small batches (configurable via\n`Spree.config.gift_card_batch_web_limit`, default 500) or enqueues\na background job for larger ones. Each card's code is the batch\n`prefix` followed by random hex.\n\n\n**Required scope:** `write_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"gift card batch created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GiftCardBatch"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["prefix","amount","codes_count"],"properties":{"prefix":{"type":"string","description":"Lowercased and prepended to every generated code."},"amount":{"type":"string","description":"Decimal amount per card, greater than zero."},"currency":{"type":"string","description":"ISO 4217 currency code. Defaults to the store currency."},"codes_count":{"type":"integer","description":"Number of cards to generate. Capped at `gift_card_batch_limit`."},"expires_at":{"type":"string","nullable":true}}}}}}}},"/api/v3/admin/gift_card_batches/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"Gift card batch prefixed ID","schema":{"type":"string"}}],"get":{"summary":"Get a gift card batch","tags":["Gift Cards"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single batch.\n\n**Required scope:** `read_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"gift card batch found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GiftCardBatch"}}}},"404":{"description":"gift card batch not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/gift_cards":{"get":{"summary":"List gift cards","tags":["Gift Cards"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the gift cards issued by the current store. Filter by\n`q[code_cont]` for code search, `q[user_id_eq]` for cards issued\nto a specific customer, or `q[state_eq]` for status filtering.\n\n\n**Required scope:** `read_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[code_cont]","in":"query","required":false,"description":"Filter by gift card code (contains)","schema":{"type":"string"}},{"name":"q[state_eq]","in":"query","required":false,"description":"Filter by status (active, redeemed, partially_redeemed, canceled)","schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"gift cards found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/GiftCard"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a gift card","tags":["Gift Cards"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Issues a gift card scoped to the current store. The code is\nauto-generated when omitted. `currency` defaults to the store's\nconfigured currency. Pass `user_id` (prefixed ID) to attach the\ncard to a specific customer.\n\n\n**Required scope:** `write_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"gift card created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GiftCard"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["amount"],"properties":{"amount":{"type":"string","description":"Decimal amount, greater than zero."},"currency":{"type":"string","description":"ISO 4217 currency code. Defaults to the store currency."},"code":{"type":"string","description":"Optional caller-supplied code. Auto-generated when omitted."},"expires_at":{"type":"string","description":"ISO 8601 date.","nullable":true},"user_id":{"type":"string","description":"Optional customer prefixed ID.","nullable":true}}}}}}}},"/api/v3/admin/gift_cards/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"Gift card prefixed ID","schema":{"type":"string"}}],"get":{"summary":"Get a gift card","tags":["Gift Cards"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single gift card.\n\n**Required scope:** `read_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"gift card found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GiftCard"}}}},"404":{"description":"gift card not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a gift card","tags":["Gift Cards"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates an active gift card's editable attributes. Redeemed or\npartially-redeemed cards cannot be edited.\n\n\n**Required scope:** `write_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"gift card updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GiftCard"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"amount":{"type":"string"},"expires_at":{"type":"string","nullable":true},"user_id":{"type":"string","nullable":true}}}}}}},"delete":{"summary":"Delete a gift card","tags":["Gift Cards"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes an unused gift card. Cards that have been redeemed or\npartially redeemed cannot be deleted and return 422.\n\n\n**Required scope:** `write_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"gift card deleted"},"422":{"description":"redeemed gift card cannot be deleted","content":{"application/json":{}}}}}},"/api/v3/admin/imports":{"get":{"summary":"List imports","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns CSV imports queued or completed for the current store.\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"imports found","content":{"application/json":{}}}}},"post":{"summary":"Create an import","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Queues a CSV import. Upload the file first via `POST /api/v3/admin/direct_uploads`\nand pass the returned `signed_id` as `attachment`. On success the import is in the\n`mapping` state and the response carries the mapping payload: `schema_fields`\n(the canonical columns for the type), `csv_headers`, a `sample_row`, and the\nauto-assigned `mappings`.\n\nAdjust mappings if needed, then call `PATCH /admin/imports/{id}/complete_mapping`\nto start processing. Poll `GET /admin/imports/{id}` while `status` is\n`completed_mapping`/`processing`; terminal statuses are `completed` and `failed`.\n\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"import created in mapping state","content":{"application/json":{}}},"422":{"description":"unknown import type","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["type","attachment"],"properties":{"type":{"type":"string","enum":["products","customers","product_translations"]},"attachment":{"type":"string","description":"ActiveStorage signed blob id from POST /api/v3/admin/direct_uploads."},"preferred_delimiter":{"type":"string","enum":[",",";","|","\t"],"description":"CSV column separator. Defaults to a comma."},"results_url":{"type":"string","description":"Absolute URL of your admin imports view; the import-done email links back to it with `?import=<id>` appended. Only honored when it matches one of the store's configured allowed origins."}}}}}}}},"/api/v3/admin/imports/template":{"get":{"summary":"Download an import template","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a CSV header row for the given import type, including the custom field columns available for the model.\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"type","in":"query","required":true,"description":"Registered import type, e.g. products.","schema":{"type":"string"}}],"responses":{"200":{"description":"CSV template","content":{"application/json":{},"text/csv":{"schema":{"type":"string","format":"binary"}}}}}}},"/api/v3/admin/imports/example":{"get":{"summary":"Download an example import file","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Redirects to a populated example CSV for the given import type — the same sample data `rake spree:load_sample_data` uses, pinned to the installed Spree version. Returns 404 for a type that ships no example file.\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"type","in":"query","required":true,"description":"Registered import type, e.g. products.","schema":{"type":"string"}}],"responses":{"302":{"description":"Redirect to the example CSV"}}}},"/api/v3/admin/imports/{id}":{"get":{"summary":"Show an import","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns import status and row counters. The admin dashboard polls this endpoint while `status` is `completed_mapping` or `processing`; `rows_count`, `completed_rows_count` and `failed_rows_count` drive the progress bar. The mapping payload (`csv_headers`, `sample_row`) is only present while `status` is `mapping`.\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"import found","content":{"application/json":{}}}}},"delete":{"summary":"Delete an import","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes the import, its rows and the uploaded file. Returns 422 while the import is being processed.\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"import deleted"}}}},"/api/v3/admin/imports/{id}/download":{"get":{"summary":"Download the originally uploaded file","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Streams the CSV exactly as it was uploaded — the audit trail for what was imported. JWT/API-key protected; SPA clients fetch it with the Authorization header and trigger the browser download via a Blob URL.\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"CSV file","content":{"application/json":{},"text/csv":{"schema":{"type":"string","format":"binary"}}}}}}},"/api/v3/admin/imports/{id}/complete_mapping":{"patch":{"summary":"Complete mapping and start processing","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Applies the submitted column mappings, then starts row processing. Omit `mappings`\nto accept the auto-assigned ones from the create response. Returns 422 when a\nrequired schema field is left unmapped (`details.missing_required_fields`) or a\nfile column is assigned twice.\n\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"mapping completed, processing queued","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"mappings":{"type":"array","description":"Column assignments to apply before starting. `file_column: null` unmaps a field.","items":{"type":"object","required":["schema_field"],"properties":{"schema_field":{"type":"string"},"file_column":{"type":"string","nullable":true}}}}}}}}}}},"/api/v3/admin/imports/{id}/retry_failed_rows":{"patch":{"summary":"Retry failed rows","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Re-processes the rows that failed. The import re-enters `processing`; poll `GET /admin/imports/{id}` until it completes again. Returns 422 when the import is not `completed` or has no failed rows.\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"retry queued","content":{"application/json":{}}}}}},"/api/v3/admin/imports/{import_id}/rows":{"get":{"summary":"List import rows","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Paginated rows of an import — the failure report. Filter with `q[status_eq]=failed` to list only rows that could not be imported; each row carries the raw CSV `data` and its `validation_errors`.\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"import_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"q[status_eq]","in":"query","required":false,"description":"Filter rows by status: pending, processing, completed, failed.","schema":{"type":"string"}}],"responses":{"200":{"description":"rows found","content":{"application/json":{}}}}}},"/api/v3/admin/markets":{"get":{"summary":"List markets","tags":["Markets"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the markets configured for the current store. Markets are\nstore-scoped and ordered by `position` (an `acts_as_list` column —\nupdate the order via `PATCH /markets/{id}` with `position`).\n\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to embed. Supported: `countries`.","schema":{"type":"string"}}],"responses":{"200":{"description":"markets found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Market"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Create a market","tags":["Markets"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new market for the current store.\n\n- `country_codes` accepts 2-letter ISO country codes (e.g. `[\"DE\", \"FR\"]`);\n the market must contain at least one country. Unknown codes are\n silently dropped.\n- `supported_locales` accepts an array of locale codes; the\n `default_locale` is always implicitly included.\n- Setting `default: true` automatically demotes the previous default\n market in the store.\n\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"market created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Market"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"currency":{"type":"string","description":"ISO 4217 currency code."},"default_locale":{"type":"string","description":"IETF locale tag used as the market default."},"supported_locales":{"type":"array","items":{"type":"string"},"description":"Locale codes available in this market. The default is always implicitly included."},"tax_inclusive":{"type":"boolean","default":false,"description":"Display prices with tax included."},"default":{"type":"boolean","default":false,"description":"Setting to true demotes the previous default."},"position":{"type":"integer","description":"Sort order within the store; lower = first."},"country_codes":{"type":"array","items":{"type":"string"},"description":"2-letter ISO country codes assigned to this market. At least one is required."}},"required":["name","currency","default_locale","country_codes"]}}}}}},"/api/v3/admin/markets/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get a market","tags":["Markets"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"market found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Market"}}}},"404":{"description":"market not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a market","tags":["Markets"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates an existing market. Pass `country_codes` to replace the\nmarket's country list (full-set update), `supported_locales` to\nreplace the supported locales, or `position` to reorder the market\nwithin the store.\n\nSetting `default: true` automatically demotes the previous default.\n\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"market updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Market"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"currency":{"type":"string"},"default_locale":{"type":"string"},"supported_locales":{"type":"array","items":{"type":"string"}},"tax_inclusive":{"type":"boolean"},"default":{"type":"boolean"},"position":{"type":"integer"},"country_codes":{"type":"array","items":{"type":"string"}}}}}}}},"delete":{"summary":"Delete a market","tags":["Markets"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes the market (sets `deleted_at`). The default market and\nthe last remaining market in a store cannot be deleted — both return\n422 with a `validation_error`.\n\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"market deleted"},"422":{"description":"cannot delete default or last market","content":{"application/json":{}}}}}},"/api/v3/admin/option_types":{"get":{"summary":"List option types","tags":["Option Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a paginated list of option types.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"description":"Filter by name (contains)","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., option_values). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., name,label,position). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"option types found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/OptionType"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create an option type","tags":["Option Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new option type. Supports nested option values.\n\nOption values can be provided inline and will be created or updated by name.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"option type created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OptionType"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"label":{"type":"string"},"position":{"type":"integer"},"filterable":{"type":"boolean"},"option_values":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"label":{"type":"string"},"position":{"type":"integer"}}}}},"required":["name","label"]}}}}}},"/api/v3/admin/option_types/{id}":{"get":{"summary":"Get an option type","tags":["Option Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single option type by ID, including its option values.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Option type ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., option_values). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., name,label,position). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"option type found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OptionType"}}}},"404":{"description":"option type not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update an option type","tags":["Option Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates an option type. Supports updating nested option values.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Option type ID","schema":{"type":"string"}}],"responses":{"200":{"description":"option type updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OptionType"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"label":{"type":"string"},"position":{"type":"integer"},"filterable":{"type":"boolean"},"option_values":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Existing option value ID to update"},"name":{"type":"string"},"label":{"type":"string"},"position":{"type":"integer"}}}}}}}}}},"delete":{"summary":"Delete an option type","tags":["Option Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes an option type.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Option type ID","schema":{"type":"string"}}],"responses":{"204":{"description":"option type deleted"}}}},"/api/v3/admin/orders/{order_id}/tax_lines":{"get":{"summary":"List tax lines","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Typed tax rows on the order. Read-only — written exclusively by the tax provider.\n\n**Required scope:** `read_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order prefixed ID","schema":{"type":"string"}}],"responses":{"200":{"description":"tax lines found","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{order_id}/discounts":{"get":{"summary":"List discounts","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Typed discount rows (promotion-sourced and manual) on the order.\n\n**Required scope:** `read_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order prefixed ID","schema":{"type":"string"}}],"responses":{"200":{"description":"discounts found","content":{"application/json":{}}}}},"post":{"summary":"Create manual discount","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a manual discount. With line_item_id a single row is created; without it the amount is distributed across line items (largest remainder). This is the sanctioned post-placement discount path and works on completed orders.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order prefixed ID","schema":{"type":"string"}}],"responses":{"201":{"description":"discount created","content":{"application/json":{}}},"422":{"description":"invalid discount","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string"},"value":{"type":"number"},"value_type":{"type":"string","enum":["flat","percent"]},"line_item_id":{"type":"string","nullable":true,"description":"Target line item; omit to distribute order-level"}},"required":["label","value"]}}}}}},"/api/v3/admin/orders/{order_id}/fees":{"post":{"summary":"Create fee","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a fee (surcharge, handling, gift wrap, COD, payment fee). Order-level when no target is given. Works on completed orders.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order prefixed ID","schema":{"type":"string"}}],"responses":{"201":{"description":"fee created","content":{"application/json":{}}},"422":{"description":"invalid fee","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string"},"amount":{"type":"number"},"kind":{"type":"string","enum":["surcharge","handling","gift_wrap","cod","payment","duty"],"description":"Defaults to 'surcharge'"},"line_item_id":{"type":"string","nullable":true},"fulfillment_id":{"type":"string","nullable":true}},"required":["label","amount"]}}}}}},"/api/v3/admin/orders/{order_id}/gift_cards":{"post":{"summary":"Apply a gift card to an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Applies a gift card by code to the order. Returns the gift card.\n\n**Required scope:** `write_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"201":{"description":"gift card applied","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["code"],"properties":{"code":{"type":"string","description":"Gift card code"}}}}}}}},"/api/v3/admin/orders/{order_id}/gift_cards/{id}":{"delete":{"summary":"Remove a gift card from an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes the gift card from the order.\n\n**Required scope:** `write_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Gift card ID","schema":{"type":"string"}}],"responses":{"204":{"description":"gift card removed"}}}},"/api/v3/admin/orders/{order_id}/items":{"get":{"summary":"List order items","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns all line items for an order.\n\n**Required scope:** `read_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., variant, variant.product). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., quantity,price,total). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"items found","content":{"application/json":{}}}}},"post":{"summary":"Add an item","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Adds a new line item to the order.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"201":{"description":"item added","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["variant_id"],"properties":{"variant_id":{"type":"string","description":"Prefixed variant ID"},"quantity":{"type":"integer","default":1}}}}}}}},"/api/v3/admin/orders/{order_id}/items/{id}":{"get":{"summary":"Show an item","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns details of a specific line item.\n\n**Required scope:** `read_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Item ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., variant, variant.product). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., quantity,price,total). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"item found","content":{"application/json":{}}}}},"patch":{"summary":"Update an item","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates an order item quantity or metadata.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Item ID","schema":{"type":"string"}}],"responses":{"200":{"description":"item updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"quantity":{"type":"integer"}}}}}}},"delete":{"summary":"Remove an item","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes an item from the order.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Item ID","schema":{"type":"string"}}],"responses":{"204":{"description":"line item removed"}}}},"/api/v3/admin/orders/{order_id}/store_credits":{"post":{"summary":"Apply customer's store credit to an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Applies the order customer's available store credit. When `amount` is omitted, applies up to the order outstanding balance.\n\n**Required scope:** `write_store_credits` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"201":{"description":"store credit applied","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"amount":{"type":"string","description":"Optional explicit amount; defaults to order outstanding balance"}}}}}}},"delete":{"summary":"Remove store credit from an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes any applied store credit from the order.\n\n**Required scope:** `write_store_credits` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"204":{"description":"store credit removed"}}}},"/api/v3/admin/orders":{"get":{"summary":"List orders","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a paginated list of orders for the current store.\n\n**Required scope:** `read_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"sort","in":"query","required":false,"description":"Sort field (e.g., created_at, -created_at, completed_at)","schema":{"type":"string"}},{"name":"q[state_eq]","in":"query","required":false,"description":"Filter by state (cart, address, delivery, payment, confirm, complete, canceled)","schema":{"type":"string"}},{"name":"q[email_cont]","in":"query","required":false,"description":"Filter by email (contains)","schema":{"type":"string"}},{"name":"q[number_eq]","in":"query","required":false,"description":"Filter by order number","schema":{"type":"string"}},{"name":"q[completed_at_gt]","in":"query","required":false,"description":"Filter by completed after date","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., items, fulfillments, payments, customer, discounts, billing_address, shipping_address). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., number,total,status,completed_at). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"orders found","content":{"application/json":{}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a draft order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new draft order in one shot. Customer, items, addresses, currency,\nmarket, channel, locale, notes, metadata, and a coupon code can all be\nprovided inline.\n\nSetting `preferred_stock_location_id` pins the order's preferred fulfillment\nlocation — Order Routing's built-in `PreferredLocation` rule consumes it\nwhen picking which stock location ships each shipment.\n\nInvalid coupon codes are non-fatal — the order is created and the failure\nis reported on the service result (not in the API response body for now).\n\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"order created with preferred_stock_location_id","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string"},"customer_id":{"type":"string","description":"Customer ID. Alias: user_id (legacy)."},"use_customer_default_address":{"type":"boolean","description":"When true with customer_id, copies the customer's saved billing/shipping addresses onto the order."},"currency":{"type":"string"},"market_id":{"type":"string","description":"Market ID"},"channel_id":{"type":"string","description":"Channel ID. Defaults to the store primary channel when omitted."},"preferred_stock_location_id":{"type":"string","description":"Stock Location ID to prefer for fulfillment. Order Routing's built-in PreferredLocation rule reads this and ranks the location first; routing falls back to the next rule when the preferred location can't cover the cart."},"locale":{"type":"string"},"customer_note":{"type":"string","description":"Public, customer-visible note"},"internal_note":{"type":"string","description":"Staff-only note"},"metadata":{"type":"object","description":"Arbitrary key/value metadata"},"shipping_address":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"address1":{"type":"string"},"city":{"type":"string"},"postal_code":{"type":"string"},"country_code":{"type":"string"},"state_code":{"type":"string"},"phone":{"type":"string"}}},"shipping_address_id":{"type":"string","description":"Existing customer address ID"},"billing_address":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"address1":{"type":"string"},"city":{"type":"string"},"postal_code":{"type":"string"},"country_code":{"type":"string"},"state_code":{"type":"string"},"phone":{"type":"string"}}},"billing_address_id":{"type":"string","description":"Existing customer address ID"},"items":{"type":"array","items":{"type":"object","required":["variant_id","quantity"],"properties":{"variant_id":{"type":"string","description":"Variant ID"},"quantity":{"type":"integer"},"metadata":{"type":"object"}}}},"coupon_code":{"type":"string","description":"Optional. Applied non-fatally; invalid codes do not block creation."}}}}}}}},"/api/v3/admin/orders/{id}":{"get":{"summary":"Show an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns full order details including admin-only fields.\n\n**Required scope:** `read_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Order ID (e.g., or_xxx)","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., items, fulfillments, payments, customer, discounts, billing_address, shipping_address). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., number,total,status,completed_at). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"order found","content":{"application/json":{}}},"404":{"description":"order not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates an order. Supports updating email, addresses, special instructions, and line items.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"200":{"description":"order updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string"},"customer_note":{"type":"string"},"internal_note":{"type":"string"},"channel_id":{"type":"string","description":"Channel ID"},"preferred_stock_location_id":{"type":"string","description":"Stock Location ID to prefer for fulfillment. Re-runs Order Routing's PreferredLocation rule on subsequent shipment rebuilds."},"ship_address":{"type":"object","properties":{"firstname":{"type":"string"},"lastname":{"type":"string"},"address1":{"type":"string"},"city":{"type":"string"},"zipcode":{"type":"string"},"country_code":{"type":"string"},"state_code":{"type":"string"},"phone":{"type":"string"}}},"bill_address":{"type":"object","properties":{"firstname":{"type":"string"},"lastname":{"type":"string"},"address1":{"type":"string"},"city":{"type":"string"},"zipcode":{"type":"string"},"country_code":{"type":"string"},"state_code":{"type":"string"},"phone":{"type":"string"}}},"items":{"type":"array","items":{"type":"object","required":["variant_id"],"properties":{"variant_id":{"type":"string","description":"Variant ID"},"quantity":{"type":"integer"},"metadata":{"type":"object"}}}}}}}}}},"delete":{"summary":"Delete a draft order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes a draft order. Completed orders cannot be deleted.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"204":{"description":"order deleted"}}}},"/api/v3/admin/orders/{id}/complete":{"patch":{"summary":"Complete an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Completes an order in the `confirm` state, marking it as placed.\n\nSet `notify_customer: true` to send the order confirmation email.\n\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"200":{"description":"order completed","content":{"application/json":{}}},"422":{"description":"order cannot be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"notify_customer":{"type":"boolean","description":"Send the order confirmation email after completion."}}}}}}}},"/api/v3/admin/orders/{id}/cancel":{"patch":{"summary":"Cancel an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Cancels a completed order.\n\nSet `notify_customer: true` to send the order cancellation email.\n\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"200":{"description":"order canceled","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"notify_customer":{"type":"boolean","description":"Send the order cancellation email after canceling."}}}}}}}},"/api/v3/admin/orders/{id}/approve":{"patch":{"summary":"Approve an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Approves an order (e.g., for fraud review).\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"200":{"description":"order approved","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{id}/resume":{"patch":{"summary":"Resume a canceled order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Resumes a previously canceled order.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"200":{"description":"order resumed","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{id}/resend_confirmation":{"post":{"summary":"Resend confirmation email","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Publishes the order.completed event to trigger confirmation email delivery.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"200":{"description":"confirmation resent","content":{"application/json":{}}}}}},"/api/v3/admin/payment_methods":{"get":{"summary":"List payment methods","tags":["Payment Methods"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the store's configured payment methods. Use `source_required: true` to know which methods need a saved source.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand. Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., name,type,active). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"payment methods found","content":{"application/json":{}}}}}},"/api/v3/admin/payment_methods/types":{"get":{"summary":"List available payment provider types","tags":["Payment Methods"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the registered Spree::PaymentMethod subclasses that can be used to create new payment methods. Useful for populating a \"Provider\" dropdown in admin UIs.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"provider types found","content":{"application/json":{}}}}}},"/api/v3/admin/payment_methods/{id}":{"get":{"summary":"Show a payment method","tags":["Payment Methods"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a payment method by ID.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand. Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., name,type,active). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"payment method found","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{order_id}/payments":{"get":{"summary":"List payments","tags":["Payments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns all payments for an order.\n\n**Required scope:** `read_payments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., payment_method, source). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., amount,status,number,response_code). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"payments found","content":{"application/json":{}}}}},"post":{"summary":"Create a payment","tags":["Payments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new payment for the order.\n\n**Required scope:** `write_payments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"201":{"description":"payment created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["payment_method_id"],"properties":{"payment_method_id":{"type":"string","description":"Payment method ID"},"amount":{"type":"string"},"source_id":{"type":"string","description":"Payment source ID"}}}}}}}},"/api/v3/admin/orders/{order_id}/payments/{id}":{"get":{"summary":"Show a payment","tags":["Payments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns details of a specific payment.\n\n**Required scope:** `read_payments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Payment ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., payment_method, source). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., amount,status,number,response_code). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"payment found","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{order_id}/payments/{id}/capture":{"patch":{"summary":"Capture a payment","tags":["Payments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Captures a pending payment.\n\n**Required scope:** `write_payments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Payment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"payment captured","content":{"application/json":{}}},"422":{"description":"capture failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/orders/{order_id}/payments/{id}/void":{"patch":{"summary":"Void a payment","tags":["Payments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Voids a payment.\n\n**Required scope:** `write_payments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Payment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"payment voided","content":{"application/json":{}}}}}},"/api/v3/admin/price_lists":{"get":{"summary":"List price lists","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the price lists configured for the current store.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"schema":{"type":"string"}},{"name":"q[status_eq]","in":"query","required":false,"schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to embed. Supported: `price_rules`.","schema":{"type":"string"}}],"responses":{"200":{"description":"price lists found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PriceList"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Create a price list","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new draft price list.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"price list created (server-to-server — rules + prices, no product_ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceList"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"starts_at":{"type":"string","nullable":true},"ends_at":{"type":"string","nullable":true},"match_policy":{"type":"string","enum":["all","any"]},"position":{"type":"integer"},"product_ids":{"type":"array","items":{"type":"string"},"description":"Prefixed product ids to seed the list with."},"rules":{"type":"array","description":"STI-typed price rules to attach on create. Existing rules on the same payload via PATCH reconcile by id.","items":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true}}}},"prices":{"type":"array","description":"Server-to-server alternative to `product_ids`: ship the exact per-variant prices the list should contain. Each row upserts on the unique key `(variant_id, currency, price_list_id)`. Mix-and-match with `product_ids` is supported but typically unnecessary — `prices` alone tells the server which variants belong to the list and what the override amount is.","items":{"type":"object","required":["variant_id","currency"],"properties":{"variant_id":{"type":"string"},"currency":{"type":"string"},"amount":{"type":"string","nullable":true},"compare_at_amount":{"type":"string","nullable":true}}}}}}}}}}},"/api/v3/admin/price_lists/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get a price list","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"price list found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceList"}}}},"404":{"description":"price list not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a price list","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a price list. The optional `rules:` array reconciles nested\nSTI-typed price rules in a single round-trip — existing rules update\nby `id`, new rules build, missing rules destroy. Mirrors the\npromotion editor's \"save the whole thing on Save\" pattern.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"price list updated with nested rules","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceList"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"starts_at":{"type":"string","nullable":true},"ends_at":{"type":"string","nullable":true},"match_policy":{"type":"string","enum":["all","any"]},"position":{"type":"integer"},"product_ids":{"type":"array","items":{"type":"string"},"description":"Prefixed product ids — reconciles list membership (adds + removes)."},"rules":{"type":"array","items":{"type":"object","required":["type"],"properties":{"id":{"type":"string","nullable":true},"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true}}}},"prices":{"type":"array","description":"Individual price overrides (the spreadsheet payload). Each row updates by `id` if shipped, otherwise upserts on the unique key `(variant_id, currency, price_list_id)`.","items":{"type":"object","oneOf":[{"required":["id"]},{"required":["variant_id","currency"]}],"properties":{"id":{"type":"string"},"variant_id":{"type":"string"},"currency":{"type":"string"},"amount":{"type":"string","nullable":true},"compare_at_amount":{"type":"string","nullable":true}}}}}}}}}},"delete":{"summary":"Delete a price list","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes the price list. Associated prices are removed asynchronously.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"price list deleted"}}}},"/api/v3/admin/price_lists/{id}/activate":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"summary":"Activate a price list","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Transitions a draft / inactive list to `active`. If `starts_at` is\nin the future the list is marked `scheduled` instead, matching the\nlegacy admin behaviour.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"price list activated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceList"}}}}}}},"/api/v3/admin/price_lists/{id}/deactivate":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"summary":"Deactivate a price list","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"price list deactivated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceList"}}}}}}},"/api/v3/admin/prices":{"get":{"summary":"List prices","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Generic prices endpoint covering both base prices and price-list\noverrides. Filter with Ransack: `q[price_list_id_eq]=…`,\n`q[currency_eq]=USD`, `q[price_list_id_null]=true` (base prices only).\n\nThe admin spreadsheet uses this with server-side pagination so it\nscales past the metadata-PATCH path on `/price_lists/:id`.\n\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"q[price_list_id_eq]","in":"query","required":false,"schema":{"type":"string"}},{"name":"q[price_list_id_null]","in":"query","required":false,"schema":{"type":"boolean"}},{"name":"q[currency_eq]","in":"query","required":false,"schema":{"type":"string"}},{"name":"q[variant_id_eq]","in":"query","required":false,"schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"Comma-separated sort keys. Supports e.g. `variant_product_name,variant_id`.","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to embed. Supported: `variant`.","schema":{"type":"string"}}],"responses":{"200":{"description":"prices found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Price"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Create a price","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a single price. Omit `price_list_id` to create a base price.\nFor more than a handful of rows, prefer `POST /admin/prices/bulk_upsert`.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"price created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Price"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["variant_id","currency"],"properties":{"variant_id":{"type":"string"},"currency":{"type":"string"},"amount":{"type":"string","nullable":true},"compare_at_amount":{"type":"string","nullable":true},"price_list_id":{"type":"string","nullable":true}}}}}}}},"/api/v3/admin/prices/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get a price","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"price found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Price"}}}},"404":{"description":"price not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a price","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"price updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Price"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"amount":{"type":"string","nullable":true},"compare_at_amount":{"type":"string","nullable":true}}}}}}},"delete":{"summary":"Delete a price","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes the price (acts_as_paranoid).\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"price deleted"}}}},"/api/v3/admin/prices/bulk_upsert":{"post":{"summary":"Bulk-upsert prices","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Upserts a batch of prices in a single SQL round trip.\n\nEach row either:\n* targets an existing price by `id`, OR\n* matches on the unique key `(variant_id, currency, price_list_id)` —\n updating the existing row if one exists, creating one otherwise.\n\nModel callbacks (e.g. PriceHistory) are bypassed; this is a\nbulk-write fast path for the admin spreadsheet. The response\ncarries `price_count` — the number of rows touched.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"prices upserted","content":{"application/json":{"schema":{"type":"object","properties":{"price_count":{"type":"integer"}}}}}},"422":{"description":"missing prices key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["prices"],"properties":{"prices":{"type":"array","items":{"type":"object","required":["variant_id","currency"],"properties":{"id":{"type":"string","nullable":true},"variant_id":{"type":"string"},"currency":{"type":"string"},"price_list_id":{"type":"string","nullable":true},"amount":{"type":"string","nullable":true},"compare_at_amount":{"type":"string","nullable":true}}}}}}}}}}},"/api/v3/admin/prices/bulk_destroy":{"delete":{"summary":"Bulk-delete prices","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes each price in `ids`. Returns the count actually destroyed.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"prices deleted","content":{"application/json":{"schema":{"type":"object","properties":{"price_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/{product_id}/custom_fields":{"get":{"summary":"List product custom fields","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the product's custom field values.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., custom_field_definition). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., key,value,namespace). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"custom fields found","content":{"application/json":{}}}}},"post":{"summary":"Create a product custom field","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Sets a custom field value on the product. Requires an existing CustomFieldDefinition; pass its prefixed `cfdef_…` id.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"custom field created","content":{"application/json":{}}},"422":{"description":"duplicate definition for the same product","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["custom_field_definition_id","value"],"properties":{"custom_field_definition_id":{"type":"string","description":"Prefixed `cfdef_…` id"},"value":{"description":"Value matching the definition's `field_type`"}}}}}}}},"/api/v3/admin/products/{product_id}/custom_fields/{id}":{"get":{"summary":"Show a product custom field","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., custom_field_definition). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., key,value,namespace). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"custom field found","content":{"application/json":{}}}}},"patch":{"summary":"Update a product custom field","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates the custom field's `value`. The linked definition cannot be changed — delete and recreate to switch.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"custom field updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["value"],"properties":{"value":{"description":"New value"}}}}}}},"delete":{"summary":"Delete a product custom field","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"custom field deleted"}}}},"/api/v3/admin/products/{product_id}/translations":{"get":{"summary":"List product translations","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the full translation matrix for the product: the source value and content type per translatable field, plus the translated value for every supported locale.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"translations found","content":{"application/json":{}}}}}},"/api/v3/admin/products":{"get":{"summary":"List products","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a paginated list of products for the current store.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"sort","in":"query","required":false,"description":"Sort field (e.g., name, -name, price, -price, best_selling)","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., variants, media, option_types, categories). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., name,slug,price,status). id is always included.","schema":{"type":"string"}},{"name":"q[name_cont]","in":"query","required":false,"description":"Filter by name (contains)","schema":{"type":"string"}},{"name":"q[status_eq]","in":"query","required":false,"description":"Filter by status","schema":{"type":"string"}}],"responses":{"200":{"description":"products found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Product"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a product","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new product. Supports nested variants with prices and option types.\n\nOption types and values are auto-created if they don't exist.\nPrices are upserted by currency. Stock items are upserted by stock location.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"product created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"slug":{"type":"string"},"status":{"type":"string","enum":["draft","active","archived"]},"tax_category_id":{"type":"string","description":"Tax category ID"},"category_ids":{"type":"array","items":{"type":"string"},"description":"Array of category IDs"},"tags":{"type":"array","items":{"type":"string"}},"prices":{"type":"array","description":"Shorthand for a simple (no-options) product: per-currency prices that forward to the product's sole variant. For products with options, set prices per variant under `variants:` instead.","items":{"type":"object","required":["currency","amount"],"properties":{"currency":{"type":"string"},"amount":{"type":"string"},"compare_at_amount":{"type":"string","nullable":true}}}},"variants":{"type":"array","description":"Array of variant payloads. Variants can declare multiple option pairs via `options:` and per-currency prices via `prices:`. Stock counts go in `stock_items:` (per stock location).","items":{"type":"object","properties":{"sku":{"type":"string"},"options":{"type":"array","description":"One pair per option type the variant participates in (e.g. size + color). Option types and values are auto-created if missing.","items":{"type":"object","required":["name","value"],"properties":{"name":{"type":"string"},"value":{"type":"string"}}}},"prices":{"type":"array","description":"Per-currency prices. Upserted by currency.","items":{"type":"object","required":["currency","amount"],"properties":{"currency":{"type":"string"},"amount":{"type":"string"},"compare_at_amount":{"type":"string","nullable":true}}}},"stock_items":{"type":"array","description":"Per-stock-location inventory. Upserted by stock_location_id.","items":{"type":"object","required":["stock_location_id","count_on_hand"],"properties":{"stock_location_id":{"type":"string","description":"Stock location ID (e.g. sloc_xxx)"},"count_on_hand":{"type":"integer"},"backorderable":{"type":"boolean"}}}}}}}},"required":["name"]}}}}}},"/api/v3/admin/products/{id}":{"get":{"summary":"Get a product","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single product by ID.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Product ID (e.g., prod_xxx)","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., variants, media, option_types, categories). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., name,slug,price,status). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"product found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}},"404":{"description":"product not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a product","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a product. Only provided fields are updated.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}}],"responses":{"200":{"description":"product updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"slug":{"type":"string"},"status":{"type":"string","enum":["draft","active","archived"]},"tax_category_id":{"type":"string","description":"Tax category ID"},"category_ids":{"type":"array","items":{"type":"string"},"description":"Array of category IDs"},"tags":{"type":"array","items":{"type":"string"}},"prices":{"type":"array","description":"Shorthand for a simple (no-options) product: per-currency prices that forward to the product's sole variant. For products with options, set prices per variant under `variants:` instead.","items":{"type":"object","required":["currency","amount"],"properties":{"currency":{"type":"string"},"amount":{"type":"string"},"compare_at_amount":{"type":"string","nullable":true}}}},"variants":{"type":"array","description":"Array of variant payloads. Variants can declare multiple option pairs via `options:` and per-currency prices via `prices:`. Stock counts go in `stock_items:` (per stock location).","items":{"type":"object","properties":{"sku":{"type":"string"},"options":{"type":"array","description":"One pair per option type the variant participates in (e.g. size + color). Option types and values are auto-created if missing.","items":{"type":"object","required":["name","value"],"properties":{"name":{"type":"string"},"value":{"type":"string"}}}},"prices":{"type":"array","description":"Per-currency prices. Upserted by currency.","items":{"type":"object","required":["currency","amount"],"properties":{"currency":{"type":"string"},"amount":{"type":"string"},"compare_at_amount":{"type":"string","nullable":true}}}},"stock_items":{"type":"array","description":"Per-stock-location inventory. Upserted by stock_location_id.","items":{"type":"object","required":["stock_location_id","count_on_hand"],"properties":{"stock_location_id":{"type":"string","description":"Stock location ID (e.g. sloc_xxx)"},"count_on_hand":{"type":"integer"},"backorderable":{"type":"boolean"}}}}}}}}}}}}},"delete":{"summary":"Delete a product","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes a product.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}}],"responses":{"204":{"description":"product deleted"},"422":{"description":"deletion refused by a store rule","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/products/bulk_status_update":{"post":{"summary":"Bulk-update product status","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Sets `status` on each product in `ids`. Reindexes the affected products\nfor search. Cross-store IDs are silently dropped. Returns counts.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"cross-store products silently dropped","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"},"status":{"type":"string"}}}}}},"422":{"description":"invalid status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","status"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["draft","active","archived"]}}}}}}}},"/api/v3/admin/products/bulk_add_to_categories":{"post":{"summary":"Bulk-add products to categories","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Attaches each product in `ids` to every category (category) in `category_ids`.\nCategories from sibling stores are silently ignored.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products added to categories","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"},"category_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","category_ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"category_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/bulk_remove_from_categories":{"post":{"summary":"Bulk-remove products from categories","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Detaches each product in `ids` from every category in `category_ids`.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products removed from categories","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","category_ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"category_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/bulk_add_to_collections":{"post":{"summary":"Bulk-add products to collections","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Attaches each product in `ids` to every manual collection in `collection_ids`.\nAutomatic (rule-based) and sibling-store collections are silently ignored.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products added to collections","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"},"collection_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","collection_ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"collection_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/bulk_remove_from_collections":{"post":{"summary":"Bulk-remove products from collections","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Detaches each product in `ids` from every collection in `collection_ids`.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products removed from collections","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","collection_ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"collection_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/bulk_add_to_channels":{"post":{"summary":"Bulk-add products to channels","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Publishes each product in `ids` on every channel in `channel_ids`. Idempotent —\nre-publishing on an existing channel is a no-op. Channels from sibling stores\nare silently ignored.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products published on channels","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"},"channel_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","channel_ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"channel_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/bulk_remove_from_channels":{"post":{"summary":"Bulk-remove products from channels","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Unpublishes each product in `ids` from every channel in `channel_ids`.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products unpublished from channels","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"},"channel_count":{"type":"integer"},"removed":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","channel_ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"channel_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/bulk_add_tags":{"post":{"summary":"Bulk-add tags to products","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Adds each tag name in `tags` to every product in `ids`. Tags are upserted by name.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"tags added","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"},"tag_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","tags"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/bulk_remove_tags":{"post":{"summary":"Bulk-remove tags from products","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes each tag in `tags` from every product in `ids`.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"tags removed","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","tags"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/bulk_destroy":{"delete":{"summary":"Bulk-delete products","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes each product in `ids`. Returns the count actually destroyed.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products deleted","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/promotions/{promotion_id}/coupon_codes":{"parameters":[{"name":"promotion_id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"List coupon codes for a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the auto-generated coupon codes for a multi-code promotion. Single-code promotions store the code on the promotion itself; this endpoint returns an empty list for them.\n\n**Required scope:** `read_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"coupon codes found","content":{"application/json":{}}}}}},"/api/v3/admin/promotions/{promotion_id}/promotion_actions":{"parameters":[{"name":"promotion_id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"List actions for a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"actions found","content":{"application/json":{}}}}},"post":{"summary":"Create an action on a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Adds a new action to a promotion. The `type` is the wire shorthand from `GET /promotion_actions/types` (e.g. `free_shipping`, `create_item_adjustments`). Fully-qualified Ruby class names are also accepted for backward compatibility.\n\n**Required scope:** `write_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"action created","content":{"application/json":{}}},"422":{"description":"unknown action type","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true}},"required":["type"]}}}}}},"/api/v3/admin/promotions/{promotion_id}/promotion_actions/{id}":{"parameters":[{"name":"promotion_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"delete":{"summary":"Delete an action from a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"action deleted"}}}},"/api/v3/admin/promotions/{promotion_id}/promotion_rules":{"parameters":[{"name":"promotion_id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"List rules for a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"rules found","content":{"application/json":{}}}}},"post":{"summary":"Create a rule on a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Adds a new rule to a promotion. The `type` is the wire shorthand from `GET /promotion_rules/types` (e.g. `currency`, `item_total`, `product`). Fully-qualified Ruby class names are also accepted for backward compatibility.\n\n**Required scope:** `write_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"rule created with preferences","content":{"application/json":{}}},"422":{"description":"unknown rule type","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true}},"required":["type"]}}}}}},"/api/v3/admin/promotions/{promotion_id}/promotion_rules/{id}":{"parameters":[{"name":"promotion_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"summary":"Update a rule's preferences","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"rule updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"preferences":{"type":"object","additionalProperties":true}}}}}}},"delete":{"summary":"Delete a rule from a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"rule deleted"}}}},"/api/v3/admin/promotions":{"get":{"summary":"List promotions","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the store's promotions, including manual coupon and automatic promotions.\n\n**Required scope:** `read_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"promotions found","content":{"application/json":{}}}}},"post":{"summary":"Create a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new promotion. `code` is required for single-code coupon promotions;\npass `multi_codes: true` with `number_of_codes` to auto-generate a batch.\n\nRules and actions can be created in the same request by passing arrays of\n`{ type, preferences, ... }` rows. The server reconciles to the desired set:\nnew rows are built, existing rows (by `id`) are updated, omitted rows are removed.\n\n\n**Required scope:** `write_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"promotion created with rules and actions","content":{"application/json":{}}},"422":{"description":"invalid params","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"code":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"starts_at":{"type":"string","format":"date-time","nullable":true},"expires_at":{"type":"string","format":"date-time","nullable":true},"usage_limit":{"type":"integer","nullable":true},"match_policy":{"type":"string","enum":["all","any"]},"kind":{"type":"string","enum":["coupon_code","automatic"]},"multi_codes":{"type":"boolean"},"number_of_codes":{"type":"integer","nullable":true},"code_prefix":{"type":"string","nullable":true},"promotion_category_id":{"type":"string","nullable":true},"rules":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true},"product_ids":{"type":"array","items":{"type":"string"}},"category_ids":{"type":"array","items":{"type":"string"}},"customer_ids":{"type":"array","items":{"type":"string"}}},"required":["type"]}},"actions":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true},"calculator":{"type":"object","properties":{"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true}}}},"required":["type"]}}},"required":["name"]}}}}}},"/api/v3/admin/promotions/{id}":{"get":{"summary":"Show a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"promotion found","content":{"application/json":{}}}}},"patch":{"summary":"Update a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a promotion. The `rules` and `actions` arrays are treated as\na *desired set* — rows with `id` update in place, rows without `id` are\nbuilt fresh, and any existing row not present in the array is destroyed.\nPass `rules: []` or `actions: []` to clear them.\n\n\n**Required scope:** `write_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"rules and actions cleared with empty arrays","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"code":{"type":"string","nullable":true},"starts_at":{"type":"string","format":"date-time","nullable":true},"expires_at":{"type":"string","format":"date-time","nullable":true},"usage_limit":{"type":"integer","nullable":true},"match_policy":{"type":"string","enum":["all","any"]},"kind":{"type":"string","enum":["coupon_code","automatic"]},"promotion_category_id":{"type":"string","nullable":true},"rules":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","nullable":true,"description":"Pass to update an existing rule; omit to build a new one"},"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true},"product_ids":{"type":"array","items":{"type":"string"}},"category_ids":{"type":"array","items":{"type":"string"}},"customer_ids":{"type":"array","items":{"type":"string"}}},"required":["type"]}},"actions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","nullable":true},"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true},"calculator":{"type":"object","properties":{"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true}}}},"required":["type"]}}}}}}}},"delete":{"summary":"Delete a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"promotion deleted"}}}},"/api/v3/admin/promotion_actions/types":{"get":{"summary":"List available promotion action types","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the registered Spree::PromotionAction subclasses with their preference schemas. Used by admin UIs to populate the \"Add action\" picker and render generic preference forms.\n\n**Required scope:** `read_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"action types found","content":{"application/json":{}}}}}},"/api/v3/admin/promotion_rules/types":{"get":{"summary":"List available promotion rule types","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the registered Spree::PromotionRule subclasses with their preference schemas.\n\n**Required scope:** `read_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"rule types found","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{order_id}/refunds":{"get":{"summary":"List refunds","tags":["Refunds"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns all refunds for an order.\n\n**Required scope:** `read_refunds` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., payment, refund_reason). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., amount,reason,transaction_id). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"refunds found","content":{"application/json":{}}}}},"post":{"summary":"Create a refund","tags":["Refunds"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a refund for a payment on the order. The refund is automatically processed via the payment gateway.\n\n**Required scope:** `write_refunds` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"201":{"description":"refund created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["payment_id","amount"],"properties":{"payment_id":{"type":"string","description":"Payment ID"},"amount":{"type":"string"},"refund_reason_id":{"type":"string","description":"Refund reason ID"}}}}}}}},"/api/v3/admin/locales":{"get":{"summary":"List supported locales","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the locales a merchant can translate content into for the current store, with the default and right-to-left flags.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"locales found","content":{"application/json":{}}}}}},"/api/v3/admin/store_credit_categories":{"get":{"summary":"List store credit categories","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the configured store credit categories. Categories classify\nstore credits (e.g., \"Goodwill\", \"Gift Card\", \"Refund\") and surface\nin the admin UI as a dropdown when issuing or editing a store\ncredit. Category names matching `Spree::Config[:non_expiring_credit_types]`\nare flagged via `non_expiring: true`.\n\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"description":"Filter by name (contains)","schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"store credit categories found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/StoreCreditCategory"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/store_credit_categories/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"Store credit category ID","schema":{"type":"string"}}],"get":{"summary":"Get a store credit category","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single store credit category by prefixed ID.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"store credit category found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StoreCreditCategory"}}}},"404":{"description":"store credit category not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/store":{"get":{"summary":"Get the current store","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the current store configuration. The store is resolved from the request context (host or admin selection); there is no `id` parameter.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"current store","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Store"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update the current store","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates the current store configuration.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"store updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Store"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"preferred_admin_locale":{"type":"string"},"preferred_timezone":{"type":"string"},"preferred_weight_unit":{"type":"string"},"preferred_unit_system":{"type":"string"}}}}}}}},"/api/v3/admin/tags":{"get":{"summary":"List tags","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns tag names for a given taggable type. Used for autocomplete in tag inputs on products, orders, and customers.","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"taggable_type","in":"query","required":true,"description":"Taggable type (`Spree::Product`, `Spree::Order`, or `Spree::User`)","schema":{"type":"string"}},{"name":"q","in":"query","required":false,"description":"Optional case-insensitive substring filter","schema":{"type":"string"}}],"responses":{"200":{"description":"tags found","content":{"application/json":{}}},"422":{"description":"invalid taggable type","content":{"application/json":{}}}}}},"/api/v3/admin/tax_rates":{"get":{"summary":"List tax rates","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the store's tax rates. Rates are the entire configuration of\nthe built-in tax provider: each pairs a tax category with a jurisdiction\n(a country, optionally narrowed to one state) and a percentage, and\ndecides whether the tax is already included in the product price\n(VAT-style) or added on top (US-style).\n\nMarkets using an external tax provider ignore these rows — that\nprovider carries its own jurisdiction data.\n\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"description":"Filter by name (contains)","schema":{"type":"string"}},{"name":"q[included_in_price_true]","in":"query","required":false,"description":"Only rates included in the product price","schema":{"type":"boolean"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).","schema":{"type":"string"}}],"responses":{"200":{"description":"tax rates found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/TaxRate"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a tax rate","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a tax rate for the current store. Give either `amount` as a\ndecimal (`0.19`) or `amount_percentage` as a percentage (`19`).\n\nName the jurisdiction with `country_code` (and `state_code` for a\nstate-level rate). Omitting the country makes the rate apply everywhere.\n\nSet `included_in_price` for VAT-style pricing, where the rate is backed\nout of the displayed price rather than added to it.\n\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"tax rate created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaxRate"}}}},"422":{"description":"validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"Customer-facing rate name, e.g. \"VAT\""},"amount":{"type":"string","description":"Rate as a decimal, e.g. \"0.19\""},"amount_percentage":{"type":"number","description":"Rate as a percentage, e.g. 19"},"included_in_price":{"type":"boolean"},"show_rate_in_label":{"type":"boolean"},"tax_category_id":{"type":"string"},"country_code":{"type":"string","description":"ISO code, e.g. \"DE\". Omit for every country."},"state_code":{"type":"string","description":"State abbreviation within that country, e.g. \"CA\"."}},"required":["name","tax_category_id"]}}},"required":true}}},"/api/v3/admin/tax_rates/{id}":{"parameters":[{"name":"id","in":"path","description":"Tax rate ID","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get a tax rate","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"tax rate found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaxRate"}}}}}},"patch":{"summary":"Update a tax rate","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"tax rate updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaxRate"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"amount":{"type":"string"},"amount_percentage":{"type":"number"},"included_in_price":{"type":"boolean"},"show_rate_in_label":{"type":"boolean"},"tax_category_id":{"type":"string"},"country_code":{"type":"string"},"state_code":{"type":"string"}}}}},"required":true}},"delete":{"summary":"Delete a tax rate","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes the rate. Tax lines it already produced keep their own rate snapshot.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"204":{"description":"tax rate deleted"}}}},"/api/v3/admin/translatable_resources":{"get":{"summary":"List translatable resources","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns every translatable resource type and its translatable fields (key + content type), so clients can render translation editors generically.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"translatable resources found","content":{"application/json":{}}}}}},"/api/v3/admin/translations/batch":{"post":{"summary":"Batch upsert translations","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Atomically upserts translations across many records of (possibly) different translatable resource types in one request — e.g. an option type and all its option values in one save. A flat list of independent registry writes; all entries succeed or none do.\n\n**Required scope:** `write_<resource>` for every resource type in the batch (for API-key authentication) (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"translations upserted","content":{"application/json":{}}},"422":{"description":"unsupported locale rolls back the whole batch","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["translations"],"properties":{"translations":{"type":"array","items":{"type":"object","required":["resource_type","resource_id","values"],"properties":{"resource_type":{"type":"string","description":"Translatable resource type token, e.g. `option_type`"},"resource_id":{"type":"string","description":"Prefixed id of the record"},"values":{"type":"object","description":"Map of locale code to { field: value }","additionalProperties":{"type":"object","additionalProperties":true}}}}}}}}}}}},"/api/v3/admin/admin_users":{"get":{"summary":"List staff","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns admin users with at least one role assignment on the current store.\n\n**Required scope:** `read_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"staff found","content":{"application/json":{}}}}}},"/api/v3/admin/admin_users/{id}":{"get":{"summary":"Show a staff member","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"staff member found","content":{"application/json":{}}}}},"patch":{"summary":"Update a staff member","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates name fields and reassigns roles for the current store. `role_ids` is a complete replacement — roles not in the array are removed for this store.\n\n**Required scope:** `write_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"staff member updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"role_ids":{"type":"array","items":{"type":"string"}}}}}}}},"delete":{"summary":"Remove a staff member from this store","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes the user's role assignments on the current store. The account is preserved — the user keeps access to any other stores.\n\n**Required scope:** `write_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"staff removed from store"}}}},"/api/v3/admin/invitations":{"get":{"summary":"List invitations","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns invitations for the current store, including pending and accepted.\n\n**Required scope:** `read_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"invitations found","content":{"application/json":{}}}}},"post":{"summary":"Create an invitation","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Invites a teammate by email. The invitation is scoped to the current store and carries the chosen role; on accept, a `RoleUser` is created via the invitation's `after_accept` callback.\n\n**Required scope:** `write_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"invitation created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["email","role_id"],"properties":{"email":{"type":"string"},"role_id":{"type":"string"}}}}}}}},"/api/v3/admin/invitations/{id}":{"delete":{"summary":"Revoke an invitation","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"invitation revoked"}}}},"/api/v3/admin/invitations/{id}/resend":{"patch":{"summary":"Resend an invitation","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Issues a fresh token and dispatches the invitation email again.\n\n**Required scope:** `write_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"invitation resent","content":{"application/json":{}}}}}},"/api/v3/admin/permissions":{"get":{"summary":"List the permission catalog","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the permission catalog — the grant vocabulary shared by staff role permissions and secret API key scopes. Entries are grouped for permission pickers; labels and descriptions are localized. Readable by any authenticated admin credential.","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"catalog returned","content":{"application/json":{}}}}}},"/api/v3/admin/roles":{"get":{"summary":"List roles","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns staff roles with their catalog permissions. Roles are global, not per-store; `mutable: false` marks the protected admin role and host-locked rows.\n\n**Required scope:** `read_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"roles found","content":{"application/json":{}}}}},"post":{"summary":"Create a role","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a staff role. `permissions` holds catalog keys (see GET /admin/permissions); a caller may only grant keys they effectively hold.\n\n**Required scope:** `write_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"role created","content":{"application/json":{}}},"422":{"description":"invalid request","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"permissions":{"type":"array","items":{"type":"string"}}},"required":["name"]}}}}}},"/api/v3/admin/roles/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"summary":"Update a role","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a role name, description or permissions. The admin role and host-locked roles (`mutable: false`) reject changes.\n\n**Required scope:** `write_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"role updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"permissions":{"type":"array","items":{"type":"string"}}}}}}}},"delete":{"summary":"Delete a role","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes a role. Fails with 422 while the role is protected or still referenced by staff members or pending invitations.\n\n**Required scope:** `write_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"role deleted"},"422":{"description":"role cannot be deleted","content":{"application/json":{}}}}}},"/api/v3/admin/stock_locations":{"get":{"summary":"List stock locations","tags":["Stock Locations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the configured stock locations. Stock locations are global\n(shared across stores). Filter with Ransack predicates such as\n`q[active_eq]`, `q[kind_eq]`, `q[pickup_enabled_eq]`, or\n`q[name_cont]`.\n\nPickup-related attributes (`kind`, `pickup_enabled`,\n`pickup_stock_policy`, `pickup_ready_in_minutes`,\n`pickup_instructions`) drive merchant pickup support at checkout —\ncustomers can collect orders from any active location with\n`pickup_enabled: true`.\n\n\n**Required scope:** `read_stock` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"description":"Filter by name (contains)","schema":{"type":"string"}},{"name":"q[active_eq]","in":"query","required":false,"description":"Filter by active status","schema":{"type":"boolean"}},{"name":"q[kind_eq]","in":"query","required":false,"description":"Filter by kind (built-in: 'warehouse', 'store', 'fulfillment_center')","schema":{"type":"string"}},{"name":"q[pickup_enabled_eq]","in":"query","required":false,"description":"Filter by pickup-enabled flag","schema":{"type":"boolean"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"stock locations found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/StockLocation"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a stock location","tags":["Stock Locations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new stock location.\n\nSetting `default: true` automatically demotes the previous default\nlocation.\n\n\n**Required scope:** `write_stock` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"stock location created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockLocation"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"admin_name":{"type":"string","nullable":true,"description":"Internal name shown only in the admin"},"active":{"type":"boolean"},"default":{"type":"boolean","description":"Setting to true demotes the previous default."},"kind":{"type":"string","enum":["warehouse","store","fulfillment_center"],"description":"Categorizes the location."},"propagate_all_variants":{"type":"boolean"},"backorderable_default":{"type":"boolean"},"address1":{"type":"string","nullable":true},"address2":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"zipcode":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"country_code":{"type":"string","nullable":true,"description":"ISO-3166 alpha-2 country code (e.g. \"US\")."},"state_code":{"type":"string","nullable":true,"description":"State / province abbreviation (e.g. \"NY\"). Resolved against the selected country."},"state_name":{"type":"string","nullable":true,"description":"Free-text state for countries without a states list."},"pickup_enabled":{"type":"boolean"},"pickup_stock_policy":{"type":"string","enum":["local","any"],"description":"'local' = items at this location only; 'any' = transfer-eligible (ship-to-store)."},"pickup_ready_in_minutes":{"type":"number","nullable":true,"minimum":0},"pickup_instructions":{"type":"string","nullable":true}},"required":["name"]}}}}}},"/api/v3/admin/stock_locations/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"Stock location ID","schema":{"type":"string"}}],"get":{"summary":"Get a stock location","tags":["Stock Locations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single stock location by prefixed ID.\n\n**Required scope:** `read_stock` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"stock location found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockLocation"}}}},"404":{"description":"stock location not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a stock location","tags":["Stock Locations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates an existing stock location. Same address-field conventions as\nthe create endpoint.\n\nSetting `default: true` automatically demotes the previous default.\n\n\n**Required scope:** `write_stock` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"stock location updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockLocation"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"admin_name":{"type":"string","nullable":true},"active":{"type":"boolean"},"default":{"type":"boolean"},"kind":{"type":"string","enum":["warehouse","store","fulfillment_center"]},"propagate_all_variants":{"type":"boolean"},"backorderable_default":{"type":"boolean"},"address1":{"type":"string","nullable":true},"address2":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"zipcode":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"country_code":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true},"state_name":{"type":"string","nullable":true},"pickup_enabled":{"type":"boolean"},"pickup_stock_policy":{"type":"string","enum":["local","any"]},"pickup_ready_in_minutes":{"type":"number","nullable":true,"minimum":0},"pickup_instructions":{"type":"string","nullable":true}}}}}}},"delete":{"summary":"Delete a stock location","tags":["Stock Locations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes the stock location (sets `deleted_at`). Existing\nfulfillments that referenced it keep the historical record via\n`Spree::StockLocation.with_deleted`.\n\n\n**Required scope:** `write_stock` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"204":{"description":"stock location deleted"}}}},"/api/v3/admin/products/{product_id}/variants":{"get":{"summary":"List product variants","tags":["Variants"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a paginated list of variants for a product, including the default variant.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., images, prices, stock_items, option_values). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., sku,price,stock). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"variants found","content":{"application/json":{}}}}},"post":{"summary":"Create a variant","tags":["Variants"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new variant for a product. Supports nested prices and stock items.\n\nOption types and values are auto-created if they don't exist.\nPrices are upserted by currency. Stock items are upserted by stock location.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}}],"responses":{"201":{"description":"variant created","content":{"application/json":{}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"sku":{"type":"string"},"cost_price":{"type":"string"},"cost_currency":{"type":"string"},"weight":{"type":"number"},"height":{"type":"number"},"width":{"type":"number"},"depth":{"type":"number"},"weight_unit":{"type":"string"},"dimensions_unit":{"type":"string"},"track_inventory":{"type":"boolean"},"tax_category_id":{"type":"string"},"options":{"type":"array","description":"A variant on a product with option types should declare its option pairs (e.g. size + color) — one per option type it participates in. Option types and values are auto-created if missing.","items":{"type":"object","required":["name","value"],"properties":{"name":{"type":"string"},"value":{"type":"string"}}}},"position":{"type":"integer"},"barcode":{"type":"string"},"prices":{"type":"array","description":"Per-currency prices. Upserted by currency.","items":{"type":"object","required":["currency","amount"],"properties":{"currency":{"type":"string"},"amount":{"type":"string"},"compare_at_amount":{"type":"string","nullable":true}}}},"stock_items":{"type":"array","description":"Per-stock-location inventory. Upserted by stock_location_id.","items":{"type":"object","required":["stock_location_id","count_on_hand"],"properties":{"stock_location_id":{"type":"string","description":"Stock location ID (e.g. sloc_xxx)"},"count_on_hand":{"type":"integer"},"backorderable":{"type":"boolean"}}}}}}}}}}},"/api/v3/admin/products/{product_id}/variants/{id}":{"get":{"summary":"Get a variant","tags":["Variants"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single variant by ID.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Variant ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., images, prices, stock_items, option_values). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., sku,price,stock). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"variant found","content":{"application/json":{}}},"404":{"description":"variant not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a variant","tags":["Variants"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a variant. Only provided fields are updated.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Variant ID","schema":{"type":"string"}}],"responses":{"200":{"description":"variant updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"sku":{"type":"string"},"cost_price":{"type":"string"},"cost_currency":{"type":"string"},"weight":{"type":"number"},"height":{"type":"number"},"width":{"type":"number"},"depth":{"type":"number"},"weight_unit":{"type":"string"},"dimensions_unit":{"type":"string"},"track_inventory":{"type":"boolean"},"tax_category_id":{"type":"string"},"options":{"type":"array","description":"One pair per option type the variant participates in (e.g. size + color). Option types and values are auto-created if missing.","items":{"type":"object","required":["name","value"],"properties":{"name":{"type":"string"},"value":{"type":"string"}}}},"position":{"type":"integer"},"barcode":{"type":"string"},"prices":{"type":"array","description":"Per-currency prices. Upserted by currency.","items":{"type":"object","required":["currency","amount"],"properties":{"currency":{"type":"string"},"amount":{"type":"string"},"compare_at_amount":{"type":"string","nullable":true}}}},"stock_items":{"type":"array","description":"Per-stock-location inventory. Upserted by stock_location_id.","items":{"type":"object","required":["stock_location_id","count_on_hand"],"properties":{"stock_location_id":{"type":"string","description":"Stock location ID (e.g. sloc_xxx)"},"count_on_hand":{"type":"integer"},"backorderable":{"type":"boolean"}}}}}}}}}},"delete":{"summary":"Delete a variant","tags":["Variants"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes a variant.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Variant ID","schema":{"type":"string"}}],"responses":{"204":{"description":"variant deleted"}}}},"/api/v3/admin/webhook_endpoints/{webhook_endpoint_id}/deliveries":{"parameters":[{"name":"webhook_endpoint_id","in":"path","required":true,"description":"Parent webhook endpoint ID","schema":{"type":"string"}}],"get":{"summary":"List webhook deliveries","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns delivery attempts for the given endpoint, most recent first.\nEach row carries the original request payload, the response code\n(when the receiver replied), the execution time, and any transport\nerror — everything needed to audit failures and decide whether to\nredeliver.\n\n\n**Required scope:** `read_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[event_name_eq]","in":"query","required":false,"description":"Filter by event name (exact)","schema":{"type":"string"}},{"name":"q[success_eq]","in":"query","required":false,"description":"Filter by success flag","schema":{"type":"boolean"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-delivered_at`).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"deliveries found","content":{"application/json":{}}},"404":{"description":"parent webhook endpoint not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/webhook_endpoints/{webhook_endpoint_id}/deliveries/{id}":{"parameters":[{"name":"webhook_endpoint_id","in":"path","required":true,"description":"Parent webhook endpoint ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Webhook delivery ID","schema":{"type":"string"}}],"get":{"summary":"Get a webhook delivery","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single delivery attempt with the full request payload and\nthe response body the receiver returned. Use this for ad-hoc debug\nof failed deliveries.\n\n\n**Required scope:** `read_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"delivery found","content":{"application/json":{}}},"404":{"description":"delivery not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/webhook_endpoints/{webhook_endpoint_id}/deliveries/{id}/redeliver":{"parameters":[{"name":"webhook_endpoint_id","in":"path","required":true,"description":"Parent webhook endpoint ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Webhook delivery ID to redeliver","schema":{"type":"string"}}],"post":{"summary":"Redeliver a webhook delivery","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new delivery row with the same payload + event_name and\nqueues it. The original row is preserved for audit history.\n\n\n**Required scope:** `write_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"redelivery queued","content":{"application/json":{}}}}}},"/api/v3/admin/webhook_endpoints":{"get":{"summary":"List webhook endpoints","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns outbound webhook subscriptions for the current store. Each\nendpoint receives a signed POST when any subscribed event fires.\n`secret_key` is `null` on list reads — the plaintext is delivered\nexactly once on create.\n\n\n**Required scope:** `read_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"description":"Filter by name (contains)","schema":{"type":"string"}},{"name":"q[url_cont]","in":"query","required":false,"description":"Filter by URL (contains)","schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"webhook endpoints found","content":{"application/json":{}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a webhook endpoint","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new outbound webhook subscription. The plaintext\n`secret_key` is returned **once** in this response — persist it\nimmediately to verify incoming webhook signatures. Subsequent reads\nreturn `null` for the secret. Pass an empty `subscriptions` array or\nomit it to receive every event.\n\n\n**Required scope:** `write_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"webhook endpoint created — secret_key returned once","content":{"application/json":{}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["url"],"properties":{"name":{"type":"string"},"url":{"type":"string"},"active":{"type":"boolean"},"subscriptions":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/webhook_endpoints/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"Webhook endpoint ID","schema":{"type":"string"}}],"get":{"summary":"Get a webhook endpoint","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single webhook endpoint by prefixed ID.\n\n**Required scope:** `read_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"webhook endpoint found","content":{"application/json":{}}},"404":{"description":"webhook endpoint not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a webhook endpoint","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates name, URL, active flag, or the event subscription list.\nToggling `active` here is equivalent to calling `disable`/`enable`\nwithout an audit reason.\n\n\n**Required scope:** `write_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"webhook endpoint updated","content":{"application/json":{}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"url":{"type":"string"},"active":{"type":"boolean"},"subscriptions":{"type":"array","items":{"type":"string"}}}}}}}},"delete":{"summary":"Delete a webhook endpoint","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes the endpoint and stops future deliveries.\n\n**Required scope:** `write_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"204":{"description":"webhook endpoint deleted"}}}},"/api/v3/admin/webhook_endpoints/{id}/send_test":{"parameters":[{"name":"id","in":"path","required":true,"description":"Webhook endpoint ID","schema":{"type":"string"}}],"post":{"summary":"Send a test delivery","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a `webhook.test` delivery record and queues it. Use this to\nverify the endpoint is reachable and your signature verification\naccepts Spree's payloads.\n\n\n**Required scope:** `write_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"test delivery queued","content":{"application/json":{}}}}}},"/api/v3/admin/webhook_endpoints/{id}/enable":{"parameters":[{"name":"id","in":"path","required":true,"description":"Webhook endpoint ID","schema":{"type":"string"}}],"patch":{"summary":"Re-enable a webhook endpoint","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Re-enables an endpoint that was manually or automatically disabled.\n\n**Required scope:** `write_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"webhook endpoint enabled","content":{"application/json":{}}}}}},"/api/v3/admin/webhook_endpoints/{id}/disable":{"parameters":[{"name":"id","in":"path","required":true,"description":"Webhook endpoint ID","schema":{"type":"string"}}],"patch":{"summary":"Disable a webhook endpoint","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Manually pauses an endpoint. Unlike auto-disable (triggered after\nrepeated delivery failures), no notification email is sent.\n\n\n**Required scope:** `write_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"webhook endpoint disabled","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string"}}}}}}}},"/api/v3/admin/collections":{"get":{"summary":"List collections","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a paginated list of the store's collections.\n\n**Required scope:** `read_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., rules, custom_fields, translations).","schema":{"type":"string"}}],"responses":{"200":{"description":"collections found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Collection"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Create a collection","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a manual or automatic (rule-based) collection. For automatic collections, send the full desired rule set under `rules`.\n\n**Required scope:** `write_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"collection created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"automatic":{"type":"boolean"},"rules_match_policy":{"type":"string","enum":["all","any"]},"sort_order":{"type":"string"},"permalink":{"type":"string"},"description":{"type":"string"},"meta_title":{"type":"string"},"meta_description":{"type":"string"},"meta_keywords":{"type":"string"},"rules":{"type":"array","description":"Full desired rule set. Entries with an id update, id-less entries create, omitted rules are removed.","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"value":{"type":"string"},"match_policy":{"type":"string"}}}}},"required":["name"]}}}}}},"/api/v3/admin/collections/{id}":{"get":{"summary":"Get a collection","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single collection by ID, including its rules.\n\n**Required scope:** `read_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Collection ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., rules, custom_fields, translations).","schema":{"type":"string"}}],"responses":{"200":{"description":"collection found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}},"404":{"description":"collection not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a collection","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a collection. Send `position` to reorder it within the flat list; send the full `rules` set to sync automatic rules.\n\n**Required scope:** `write_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Collection ID","schema":{"type":"string"}}],"responses":{"200":{"description":"collection updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"permalink":{"type":"string"},"description":{"type":"string"},"meta_title":{"type":"string"},"meta_description":{"type":"string"},"meta_keywords":{"type":"string"},"sort_order":{"type":"string"},"automatic":{"type":"boolean"},"rules_match_policy":{"type":"string","enum":["all","any"]},"position":{"type":"integer","description":"Reorders the collection within the flat list (acts_as_list)"},"rules":{"type":"array","description":"Full desired rule set (see create).","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"value":{"type":"string"},"match_policy":{"type":"string"}}}}}}}}}},"delete":{"summary":"Delete a collection","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes a collection.\n\n**Required scope:** `write_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Collection ID","schema":{"type":"string"}}],"responses":{"204":{"description":"collection deleted"}}}},"/api/v3/admin/collections/{collection_id}/products":{"get":{"summary":"List collection products","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Products curated in the collection, ordered by their membership position.\n\n**Required scope:** `read_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"collection_id","in":"path","required":true,"description":"Collection ID","schema":{"type":"string"}}],"responses":{"200":{"description":"products found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Product"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Add a product to a collection","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Curates a product into the collection (appended to the end).\n\n**Required scope:** `write_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"collection_id","in":"path","required":true,"description":"Collection ID","schema":{"type":"string"}}],"responses":{"201":{"description":"product added","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"product_id":{"type":"string"}},"required":["product_id"]}}}}}},"/api/v3/admin/collections/{collection_id}/products/{id}":{"delete":{"summary":"Remove a product from a collection","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes a product from the collection's manual curation.\n\n**Required scope:** `write_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"collection_id","in":"path","required":true,"description":"Collection ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}}],"responses":{"204":{"description":"product removed"}}}},"/api/v3/admin/collections/{collection_id}/products/{id}/reposition":{"patch":{"summary":"Reposition a collection product","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Moves a product to a new index among the collection's products.\n\n**Required scope:** `write_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"collection_id","in":"path","required":true,"description":"Collection ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}}],"responses":{"204":{"description":"product repositioned"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"new_position":{"type":"integer","description":"0-based index among the collection's products"}},"required":["new_position"]}}}}}},"/api/v3/admin/collection_rules/types":{"get":{"summary":"List available collection rule types","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Enumerates the registered rule kinds with their labels and descriptions — drives the rule picker on an automatic collection. Plugins extend the list by registering `Spree::CollectionRule` subclasses via `config.spree.collection_rules`. The `type` returned here is the wire shorthand accepted when writing a collection's `rules`.\n\n**Required scope:** `read_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"types found","content":{"application/json":{}}}}}},"/api/v3/admin/commission_lines":{"get":{"summary":"List commission lines","tags":["Commission Lines"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"What each sale actually earned the marketplace, frozen when the order\nwas placed. A later change to a commission rate never reaches these.\n\n`amount` is the fee charged to the seller and `tax_amount` is the VAT on\nthat fee — the marketplace's own service to the seller, a supply\nseparate from the sale itself, which is why the two are not folded\ntogether. `total` is their sum.\n\nOne line per commissioned item, plus one per delivery when the rate that\napplied charges shipping too — read `line_item_id` and `fulfillment_id`\nto tell them apart.\n\nRead-only: correcting a charge is a reversal, not an edit.\n\n\n**Required scope:** `read_commissions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[seller_id_eq]","in":"query","required":false,"description":"Filter to one seller","schema":{"type":"string"}},{"name":"q[order_id_eq]","in":"query","required":false,"description":"Filter to one order","schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).","schema":{"type":"string"}}],"responses":{"200":{"description":"commission lines found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CommissionLine"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/commission_lines/{id}":{"parameters":[{"name":"id","in":"path","description":"Commission line ID","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get a commission line","tags":["Commission Lines"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_commissions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"commission line found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommissionLine"}}}},"404":{"description":"commission line not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/commission_rates":{"get":{"summary":"List commission rates","tags":["Commission Rates"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"What the marketplace charges its sellers.\n\nRates are returned in resolution order: the list is walked top-down and\nthe first rate whose targeting matches the sale wins, so the order you\nsee is the precedence. Move a rate with `position` on update.\n\nA rate carrying no rules matches every sale — `global` says so — which\nis how a marketplace expresses a single default. Because resolution\nstops at the first match, a global rate makes everything below it\nunreachable, so it belongs at the bottom.\n\n\n**Required scope:** `read_commissions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"description":"Filter by name (contains)","schema":{"type":"string"}},{"name":"q[enabled_eq]","in":"query","required":false,"description":"Filter by whether the rate is in use","schema":{"type":"boolean"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-position`).","schema":{"type":"string"}}],"responses":{"200":{"description":"commission rates found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CommissionRate"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a commission rate","tags":["Commission Rates"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Sets what the marketplace charges, and which sales it applies to.\n\n`rules` is the rate's whole targeting, sent inline. Every rule has to\nhold, and a rule naming several records means any of them — so\n\"(Cameras OR Audio) AND that seller\" is a category rule holding two ids\nbeside a seller rule holding one. Send no rules to charge every sale.\n\nRule kinds come from `GET /commission_rates/rule_types`, which also\ndescribes the configuration each one takes. A marketplace that adds its\nown kind sees it there without this endpoint changing.\n\n`commission_tax_rate` is VAT on the commission itself — the\nmarketplace's own service to the seller, a separate supply from the\nsale. Leave it null to let the store's tax engine answer for wherever\nthe seller's business sits.\n\n\n**Required scope:** `write_commissions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"commission rate created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommissionRate"}}}},"422":{"description":"validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name","kind","value"],"properties":{"name":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Your own identifier for this rate; unique per store."},"enabled":{"type":"boolean"},"position":{"type":"integer","description":"Place in the list. Rates resolve top-down, so 1 is tried first. New rates are created at the top; send this to move one."},"kind":{"type":"string","enum":["percentage","fixed"]},"value":{"type":"string","description":"A percentage (10 = 10%) or a flat amount, per `kind`."},"amounts":{"type":"object","additionalProperties":{"type":"string"},"description":"What a flat fee charges, keyed by currency. A currency with no amount is one this rate does not charge — those sales fall to the next rate. Ignored for a percentage."},"tax_inclusive":{"type":"boolean","description":"Charge on the price including the customer's VAT. Left off, commission is charged on the seller's net revenue, which is the usual basis where the fee is taxed as its own supply."},"include_shipping":{"type":"boolean","description":"Also charge commission on the seller's delivery revenue."},"bounds":{"type":"object","additionalProperties":{"type":"object","properties":{"min_amount":{"type":"string","nullable":true},"max_amount":{"type":"string","nullable":true}}},"description":"The floor and cap a percentage charges within, keyed by currency. Each holds only in its own currency; a sale in a currency with no bounds is charged unbounded."},"commission_tax_rate":{"type":"string","nullable":true,"description":"A fraction, not a percentage. Null asks the tax engine."},"rules":{"type":"array","description":"The full targeting; what you send replaces what the rate holds.","items":{"type":"object","properties":{"id":{"type":"string","description":"Present for an existing rule; omit to create one."},"type":{"type":"string","description":"A kind from /commission_rates/rule_types."},"preferences":{"type":"object","description":"Configuration for the kind, per its preference_schema."},"product_ids":{"type":"array","items":{"type":"string"},"description":"For kinds that name products, which are kept outside preferences."}}}}}}}}}}},"/api/v3/admin/commission_rates/rule_types":{"get":{"summary":"List the commission rule kinds","tags":["Commission Rates"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Every rule kind a rate can be narrowed by, with the schema describing\nthe configuration it takes — so a client builds its editor from what\nthis marketplace has rather than a list hardcoded to match core's.\n\n`association_fields` names any catalog-scale reference a kind keeps\noutside its preferences, so an editor knows to render a picker for it.\n\n\n**Required scope:** `read_commissions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"subject types found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"preference_schema":{"type":"array","items":{"type":"object"}},"association_fields":{"type":"array","items":{"type":"string"}}}}}}}}}}}}},"/api/v3/admin/commission_rates/{id}":{"parameters":[{"name":"id","in":"path","description":"Commission rate ID","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get a commission rate","tags":["Commission Rates"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_commissions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"commission rate found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommissionRate"}}}},"404":{"description":"commission rate not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a commission rate","tags":["Commission Rates"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Editing a rate changes what the next sale is charged, never what a past\none was: commission lines keep their own snapshot of the rate that\napplied.\n\n\n**Required scope:** `write_commissions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"commission rate updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommissionRate"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"enabled":{"type":"boolean"},"position":{"type":"integer"},"value":{"type":"string"},"rules":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"preferences":{"type":"object"},"product_ids":{"type":"array","items":{"type":"string"}}}}}}}}}}},"delete":{"summary":"Delete a commission rate","tags":["Commission Rates"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_commissions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"commission rate deleted"}}}},"/api/v3/admin/companies/{company_id}/locations":{"get":{"summary":"List company locations","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the branches of a business customer. Each branch owns its own addresses and the buyers authorised to purchase for it.\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"locations found","content":{"application/json":{}}}}},"post":{"summary":"Create a company location","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a branch. Addresses are supplied inline and belong to the branch, so editing one later changes the branch's own record rather than an address the buyer also uses.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"location created","content":{"application/json":{}}},"422":{"description":"invalid request","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"external_id":{"type":"string","nullable":true},"billing_address":{"type":"object","description":"Created inline and owned by the branch.","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"address1":{"type":"string"},"city":{"type":"string"},"postal_code":{"type":"string"},"country_code":{"type":"string"}}}},"required":["name"]}}}}}},"/api/v3/admin/company_locations/{id}":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get a company location","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Branches are addressed by their own id once you hold one — the company id is not needed.\n\n**Required scope:** `read_customers` (for API-key authentication).","responses":{"200":{"description":"location found","content":{"application/json":{}}}}},"patch":{"summary":"Update a company location","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Address fields sent here edit the branch's existing address in place; send only what changes.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[],"responses":{"200":{"description":"location updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"billing_address":{"type":"object","properties":{"city":{"type":"string"}}}}}}}}},"delete":{"summary":"Delete a company location","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes the branch, its buyers and the addresses it owned.\n\n**Required scope:** `write_customers` (for API-key authentication).","responses":{"204":{"description":"location deleted"}}}},"/api/v3/admin/companies/{company_id}/tax_exemption_certificates":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"List tax exemption certificates","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a business's exemption evidence. `active` is the field that decides whether a certificate\nexempts a sale: a verified certificate stops counting once its expiry date passes, so the status\nalone does not answer it.\n\n\n**Required scope:** `read_customers` (for API-key authentication).","responses":{"200":{"description":"certificates found","content":{"application/json":{}}}}},"post":{"summary":"Create a tax exemption certificate","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Records exemption evidence against a business. Certificates start `pending` and exempt nothing\nuntil verified.\n\n`country_code` and `state_code` say where the certificate holds — omit both for one valid\neverywhere, give only the country for one valid throughout it. `document` takes an ActiveStorage\nsigned blob id obtained from `POST /api/v3/admin/direct_uploads`.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[],"responses":{"201":{"description":"certificate created","content":{"application/json":{}}},"422":{"description":"invalid request","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"certificate_number":{"type":"string"},"reason_code":{"type":"string","description":"Becomes the tax provider's entity use code."},"country_code":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true},"expires_at":{"type":"string","format":"date-time","nullable":true},"issuing_authority":{"type":"string","nullable":true},"document":{"type":"string","description":"ActiveStorage signed blob id from POST /api/v3/admin/direct_uploads."}},"required":["certificate_number","reason_code"]}}}}}},"/api/v3/admin/companies/{company_id}/tax_exemption_certificates/{id}/verify":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"summary":"Verify a tax exemption certificate","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Accepts the certificate as evidence, which is what makes it exempt sales. Only a pending\ncertificate can be accepted — re-accepting a revoked one would restore evidence that was\ndeliberately withdrawn. An installation that checks numbers against a registry, or requires a\nsecond approval, can refuse here, and the refusal is returned as a validation error.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","responses":{"200":{"description":"certificate verified","content":{"application/json":{}}}}}},"/api/v3/admin/companies/{company_id}/tax_exemption_certificates/{id}/revoke":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"summary":"Revoke a tax exemption certificate","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Withdraws accepted evidence. A verified certificate cannot be deleted — how a sale was taxed has to remain explainable — so revoking is the way out.\n\n**Required scope:** `write_customers` (for API-key authentication).","responses":{"200":{"description":"certificate revoked","content":{"application/json":{}}}}}},"/api/v3/admin/companies/{company_id}/tax_exemption_certificates/{id}/download":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"Download a certificate document","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Streams the uploaded document. Deliberately not a storage link: the bytes come through the API so\nthe same credentials apply to every read of a confidential document. Requires only read access.\n\n\n**Required scope:** `read_customers` (for API-key authentication).","responses":{"200":{"description":"document streamed","content":{"application/json":{}}},"422":{"description":"no document attached","content":{"application/json":{}}}}}},"/api/v3/admin/companies/{company_id}/tax_identifiers":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"List company tax registrations","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the business's tax registrations, one per kind. A business registration takes precedence\nover the buyer's own when a sale is for that business, because the invoice is addressed to the\nentity rather than the person who placed the order.\n\n\n**Required scope:** `read_customers` (for API-key authentication).","responses":{"200":{"description":"registrations found","content":{"application/json":{}}}}},"post":{"summary":"Create a company tax registration","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Registers a tax number against the business. Verification against the relevant registry runs in\nthe background where a validator is installed for the kind; a stock installation registers none,\nleaving the status unattempted.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[],"responses":{"201":{"description":"registration created","content":{"application/json":{}}},"422":{"description":"invalid request","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","description":"The regime the number belongs to."},"value":{"type":"string"}},"required":["kind","value"]}}}}}},"/api/v3/admin/companies/{company_id}/tax_identifiers/{id}/validate":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"post":{"summary":"Re-check a company tax registration","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Asks the registry again. Manual because a registry answers only \"valid now\" — a number verified\nlast year may have been deregistered since — and because a check that came back unavailable\ncannot otherwise be retried without editing the number.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","responses":{"422":{"description":"no validator installed for this kind","content":{"application/json":{}}}}}},"/api/v3/admin/companies":{"get":{"summary":"List companies","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the business customers of the current store.\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"companies found","content":{"application/json":{}}}}},"post":{"summary":"Create a company","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a business customer. Exemption certificates and tax registrations hang off it.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"company created","content":{"application/json":{}}},"422":{"description":"invalid request","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"external_id":{"type":"string","nullable":true,"description":"Your own reference for this business, unique within the store."}},"required":["name"]}}}}}},"/api/v3/admin/company_locations/{company_location_id}/contacts":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_location_id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"List company contacts","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the customers authorised to purchase for a branch. A customer may act for more than one branch.\n\n**Required scope:** `read_customers` (for API-key authentication).","responses":{"200":{"description":"contacts found","content":{"application/json":{}}}}},"post":{"summary":"Create a company contact","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Authorises a customer to purchase for a branch. A customer who acts for exactly one branch has\ntheir orders attributed to it automatically; one who acts for several needs the branch set on\nthe order, because guessing would invoice the wrong business.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[],"responses":{"201":{"description":"contact created","content":{"application/json":{}}},"422":{"description":"invalid request","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"customer_id":{"type":"string"},"role":{"type":"string","description":"Free-form label; carries no permissions in 6.0."}},"required":["customer_id"]}}}}}},"/api/v3/admin/company_contacts/{id}":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get a company contact","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_customers` (for API-key authentication).","responses":{"200":{"description":"contact found","content":{"application/json":{}}}}},"delete":{"summary":"Delete a company contact","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Withdraws the customer's authority to purchase for the branch. The customer account itself is untouched.\n\n**Required scope:** `write_customers` (for API-key authentication).","responses":{"204":{"description":"contact deleted"}}}},"/api/v3/admin/delivery_profiles":{"get":{"summary":"List delivery profiles","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Fulfillment profiles group products with the stock locations, delivery zones and delivery methods that fulfill them. Every store has exactly one default profile.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"delivery profiles found","content":{"application/json":{}}}}},"post":{"summary":"Create a delivery profile","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a delivery profile. `kind` selects the registered profile kind (shipping, digital, extension kinds); `stock_location_ids` limits fulfillment to those locations — empty means every store location.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"delivery profile created","content":{"application/json":{}}},"422":{"description":"validation error","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"kind":{"type":"string","description":"Registered profile kind; defaults to shipping."},"default":{"type":"boolean"},"stock_location_ids":{"type":"array","items":{"type":"string"},"description":"Empty means every store location."}},"required":["name"]}}}}}},"/api/v3/admin/delivery_profiles/{delivery_profile_id}/origin_groups":{"parameters":[{"name":"delivery_profile_id","in":"path","required":true,"schema":{"type":"string"}}],"post":{"summary":"Create an origin group","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Origin groups partition a profile's fulfillment origins: zones and methods belong to a group, so the same products can quote different rate tables per warehouse. `stock_location_ids` replaces the full membership; empty means every store location.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"origin group created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","nullable":true},"position":{"type":"integer","nullable":true},"stock_location_ids":{"type":"array","items":{"type":"string"},"description":"Empty means every store location."}}}}}}}},"/api/v3/admin/delivery_profiles/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"summary":"Update a delivery profile","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"delivery profile updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"default":{"type":"boolean"},"stock_location_ids":{"type":"array","items":{"type":"string"}}}}}}}},"delete":{"summary":"Delete a delivery profile","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"The default profile and profiles still referenced by products cannot be deleted.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"delivery profile deleted"}}}},"/api/v3/admin/delivery_methods":{"get":{"summary":"List delivery methods","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns all delivery methods with calculator and zone configuration.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"delivery methods found","content":{"application/json":{}}}}},"post":{"summary":"Create delivery method","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a delivery method inside a delivery profile (defaults to the store default profile). Delivery behavior comes from the fulfillment provider.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"delivery method created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"admin_name":{"type":"string","nullable":true},"code":{"type":"string","nullable":true},"fulfillment_provider":{"type":"string","nullable":true},"delivery_profile_id":{"type":"string","nullable":true},"storefront_visible":{"type":"boolean"},"tracking_url":{"type":"string","nullable":true},"estimated_transit_business_days_min":{"type":"integer","nullable":true},"estimated_transit_business_days_max":{"type":"integer","nullable":true},"tax_category_id":{"type":"string","nullable":true},"calculator_type":{"type":"string"},"calculator_preferences":{"type":"object"},"delivery_zone_id":{"type":"string","nullable":true}},"required":["name"]}}}}}},"/api/v3/admin/delivery_methods/calculators":{"get":{"summary":"List delivery calculators","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Registered delivery calculator classes with preference schemas for building configuration forms.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"calculators found","content":{"application/json":{}}}}}},"/api/v3/admin/delivery_zones":{"post":{"summary":"Create delivery zone","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a delivery zone with typed members: country, state, or postal_code (prefix or from/to range).\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to embed, e.g. `members`","schema":{"type":"string"}}],"responses":{"201":{"description":"delivery zone created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"members":{"type":"array","items":{"type":"object","properties":{"member_type":{"type":"string","enum":["country","state","postal_code"]},"country_code":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true},"postal_code_prefix":{"type":"string","nullable":true},"postal_code_from":{"type":"string","nullable":true},"postal_code_to":{"type":"string","nullable":true}},"required":["member_type"]}}},"required":["name"]}}}}}},"/api/v3/admin/integrations":{"get":{"summary":"List integrations","tags":["Integrations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the integrations connected to the current store. Secret preference values are masked.\n\n**Required scope:** `read_integrations` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"integrations found","content":{"application/json":{}}}}},"post":{"summary":"Connect integration","tags":["Integrations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Connects an integration type to the current store. Setting active: true verifies the connection and fails with 422 when it cannot connect. Submitting a masked secret value back keeps the stored secret.\n\n**Required scope:** `write_integrations` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"integration connected","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"Wire shorthand from GET /integrations/types"},"active":{"type":"boolean"},"preferences":{"type":"object"}},"required":["type"]}}}}}},"/api/v3/admin/integrations/types":{"get":{"summary":"List integration types","tags":["Integrations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Every registered integration type with its gallery metadata and configuration schema. Pure registry discovery — read live connection state from GET /integrations.\n\n**Required scope:** `read_integrations` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"integration types found","content":{"application/json":{}}}}}},"/api/v3/admin/integrations/{id}/test":{"post":{"summary":"Test integration connection","tags":["Integrations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Runs a live connection check against the provider. Nothing is persisted; a failed check reports the seller error message.\n\n**Required scope:** `write_integrations` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"connection checked","content":{"application/json":{}}}}}},"/api/v3/admin/product_types":{"get":{"summary":"List product types","tags":["Product Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a paginated list of product types.\n\nA product type is a back-office template: it seeds option types and\ncategories onto products created with it, and defines which custom\nfields those products' forms show. It is not exposed on the Store API.\n\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}}],"responses":{"200":{"description":"product types found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ProductType"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a product type","tags":["Product Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a product type.\n\n`option_type_ids` and `category_ids` seed products created with this\ntype. `custom_field_definitions` is a replace-set of the definitions the\nproduct form renders, in `sort_order`. `required` is advisory — the\ndashboard marks the field, but a blank value is never rejected.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"product type created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductType"}}}},"422":{"description":"unprocessable entity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"delivery_profile_id":{"type":"string","nullable":true,"description":"Fulfillment profile stamped onto products created with this type. Null leaves new products on the store default profile."},"option_type_ids":{"type":"array","items":{"type":"string"},"description":"Option types seeded onto products created with this type."},"category_ids":{"type":"array","items":{"type":"string"},"description":"Categories seeded onto products created with this type."},"custom_field_definitions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Prefixed custom field definition id."},"required":{"type":"boolean"},"sort_order":{"type":"integer"}}}}},"required":["name"]}}}}}},"/api/v3/admin/product_types/{id}":{"parameters":[{"name":"id","in":"path","description":"Product type ID","required":true,"schema":{"type":"string"}}],"get":{"summary":"Retrieve a product type","tags":["Product Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single product type with its option types, categories and custom fields.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"product type found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductType"}}}},"404":{"description":"product type not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a product type","tags":["Product Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a product type.\n\nChanges never modify products that already carry the type — use\n`apply_to_products` to backfill those.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"product type updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductType"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"delivery_profile_id":{"type":"string","nullable":true},"option_type_ids":{"type":"array","items":{"type":"string"}},"category_ids":{"type":"array","items":{"type":"string"}},"custom_field_definitions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"required":{"type":"boolean"},"sort_order":{"type":"integer"}}}}}}}}}},"delete":{"summary":"Delete a product type","tags":["Product Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes a product type. Types still used by products cannot be deleted.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"204":{"description":"product type deleted"}}}},"/api/v3/admin/product_types/{id}/apply_to_products":{"parameters":[{"name":"id","in":"path","description":"Product type ID","required":true,"schema":{"type":"string"}}],"post":{"summary":"Apply a product type to its existing products","tags":["Product Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Backfills the type's option types and categories onto the products that\nalready carry it. Additive and idempotent — nothing is removed, and\nre-running is safe.\n\nRuns in the background; the response reports how many products the type\ncurrently has.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"202":{"description":"backfill accepted","content":{"application/json":{"schema":{"type":"object","properties":{"products_count":{"type":"integer"}}}}}}}}},"/api/v3/admin/sellers":{"get":{"summary":"List sellers","tags":["Sellers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the sellers on this marketplace. `status` says where each one\nis in its life on the marketplace, and `sellable` answers the question\nthe status alone cannot: an approved seller who is away cannot be\nbought from either.\n\n\n**Required scope:** `read_sellers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"description":"Filter by name (contains)","schema":{"type":"string"}},{"name":"q[status_eq]","in":"query","required":false,"description":"Filter by status","schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).","schema":{"type":"string"}}],"responses":{"200":{"description":"sellers found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Seller"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a seller","tags":["Sellers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Opens a seller record. The seller starts as `pending` and has no team\nyet — invite someone to run it with the `invite` action below.\n\n`status` is deliberately not writable here or on update: every move\nthrough the lifecycle is its own action, because each one does more\nthan set a column.\n\n\n**Required scope:** `write_sellers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"seller created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Seller"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"slug":{"type":"string","description":"Derived from the name when omitted."},"contact_email":{"type":"string","nullable":true},"billing_email":{"type":"string","nullable":true},"about":{"type":"string","nullable":true},"tax_remittance":{"type":"string","enum":["seller","platform"]},"payouts_schedule_interval":{"type":"string","enum":["daily","weekly","biweekly","monthly","manual"],"nullable":true},"minimum_payout_amount":{"type":"string","nullable":true}}}}}}}},"/api/v3/admin/sellers/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"Seller prefixed ID","schema":{"type":"string"}}],"get":{"summary":"Get a seller","tags":["Sellers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single seller, including its settlement and tax configuration.\n\n**Required scope:** `read_sellers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"seller found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Seller"}}}},"404":{"description":"seller not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a seller","tags":["Sellers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates the seller's profile and the settlement configuration the\noperator owns. A `status` sent here is ignored — use the lifecycle\nactions.\n\n\n**Required scope:** `write_sellers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"seller address written inline","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Seller"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"billing_email":{"type":"string","nullable":true},"payouts_schedule_interval":{"type":"string","enum":["daily","weekly","biweekly","monthly","manual"],"nullable":true},"minimum_payout_amount":{"type":"string","nullable":true},"holiday_mode_until":{"type":"string","format":"date-time","nullable":true},"logo":{"type":"string","nullable":true,"description":"ActiveStorage signed id of a direct-uploaded file. Send `null` to remove the attachment, or omit the key to leave it alone. Same for `square_logo` and `cover_photo`."},"square_logo":{"type":"string","nullable":true},"cover_photo":{"type":"string","nullable":true},"billing_address":{"type":"object","description":"The seller's own address, written inline. There is no `billing_address_id` — an address belongs to whoever it was created for, so it is never referenced by id here.","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"company":{"type":"string"},"address1":{"type":"string"},"address2":{"type":"string"},"city":{"type":"string"},"postal_code":{"type":"string"},"phone":{"type":"string"},"country_code":{"type":"string"},"state_code":{"type":"string"},"state_name":{"type":"string"},"label":{"type":"string"}}},"returns_address":{"type":"object","description":"The seller's own address, written inline. There is no `billing_address_id` — an address belongs to whoever it was created for, so it is never referenced by id here.","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"company":{"type":"string"},"address1":{"type":"string"},"address2":{"type":"string"},"city":{"type":"string"},"postal_code":{"type":"string"},"phone":{"type":"string"},"country_code":{"type":"string"},"state_code":{"type":"string"},"state_name":{"type":"string"},"label":{"type":"string"}}}}}}}}},"delete":{"summary":"Delete a seller","tags":["Sellers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes the seller. Their products are kept and left without a\nseller rather than deleted — what happens to a departed seller's\ncatalog is the operator's decision.\n\n\n**Required scope:** `write_sellers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"seller deleted"}}}},"/api/v3/admin/sellers/{id}/invite":{"parameters":[{"name":"id","in":"path","required":true,"description":"Seller prefixed ID","schema":{"type":"string"}}],"post":{"summary":"Invite someone to run a seller","tags":["Sellers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Sends an invitation to the seller's own team and moves the seller to\n`invited`. The person becomes a member when they accept, and can then\nsign in to the seller panel.\n\n`role_id` must name a role this seller owns; omit it for the seller's\nown admin role. Re-inviting is allowed — an invitation expires, or the\nfirst one goes to the wrong address.\n\n\n**Required scope:** `write_sellers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"invitation sent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Seller"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string"},"role_id":{"type":"string","nullable":true}}}}}}}},"/api/v3/admin/sellers/{id}/approve":{"parameters":[{"name":"id","in":"path","required":true,"description":"Seller prefixed ID","schema":{"type":"string"}}],"patch":{"summary":"Approve a seller","tags":["Sellers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Lets the seller sell. This is also the way back for one that was\nsuspended or turned down, and it clears any holiday along with the\nsuspension.\n\n\n**Required scope:** `write_sellers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"seller approved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Seller"}}}},"422":{"description":"seller cannot be approved from its current status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/sellers/{id}/suspend":{"parameters":[{"name":"id","in":"path","required":true,"description":"Seller prefixed ID","schema":{"type":"string"}}],"patch":{"summary":"Suspend a seller","tags":["Sellers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Stops a trading seller from selling. Their catalog and history stay,\nand approving reinstates them. Use this rather than `reject` for a\nseller already on the marketplace — it says something different, and\nit can be undone.\n\n\n**Required scope:** `write_sellers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"seller suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Seller"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string"}}}}}}}},"/api/v3/admin/sellers/{id}/reject":{"parameters":[{"name":"id","in":"path","required":true,"description":"Seller prefixed ID","schema":{"type":"string"}}],"patch":{"summary":"Reject a seller","tags":["Sellers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Turns down an applicant who never traded. A seller already selling is\nsuspended instead; rejecting one is refused.\n\n\n**Required scope:** `write_sellers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"seller rejected","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Seller"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string"}}}}}}}}},"components":{"schemas":{"PaginationMeta":{"type":"object","properties":{"page":{"type":"integer"},"limit":{"type":"integer"},"count":{"type":"integer","description":"Total number of records"},"pages":{"type":"integer","description":"Total number of pages"},"from":{"type":"integer","description":"Index of first record on this page"},"to":{"type":"integer","description":"Index of last record on this page"},"in":{"type":"integer","description":"Number of records on this page"},"previous":{"type":"integer","nullable":true,"description":"Previous page number"},"next":{"type":"integer","nullable":true,"description":"Next page number"}},"required":["page","limit","count","pages","from","to","in"]},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","description":"Field-specific validation errors","nullable":true}},"required":["code","message"]}},"required":["error"]},"AuthResponse":{"type":"object","properties":{"token":{"type":"string","description":"JWT access token"},"user":{"$ref":"#/components/schemas/AdminUser"}},"required":["token","user"]},"PermissionRule":{"type":"object","description":"A single permission rule (CanCanCan rule). Rules are applied in order, last-matching-wins.","properties":{"allow":{"type":"boolean","description":"true for `can`, false for `cannot`"},"actions":{"type":"array","items":{"type":"string"},"description":"Action names, e.g. [\"read\", \"update\"] or [\"manage\"]"},"subjects":{"type":"array","items":{"type":"string"},"description":"Subject class names, e.g. [\"Spree::Product\"] or [\"all\"]"},"has_conditions":{"type":"boolean","description":"True if the server-side rule has per-record conditions. The SPA shows the action optimistically and handles 403 from the API."}},"required":["allow","actions","subjects","has_conditions"]},"MeResponse":{"type":"object","description":"Current admin user profile and serialized permissions","properties":{"user":{"$ref":"#/components/schemas/AdminUser"},"permissions":{"type":"array","items":{"$ref":"#/components/schemas/PermissionRule"}}},"required":["user","permissions"]},"ImportSchemaField":{"type":"object","description":"A canonical column of an import type, including per-store custom field columns","properties":{"name":{"type":"string","description":"Canonical field name used in mappings"},"label":{"type":"string","description":"Human-readable label"},"required":{"type":"boolean","description":"Whether the field must be mapped before processing"}},"required":["name","label","required"]},"CheckoutRequirement":{"type":"object","properties":{"step":{"type":"string","description":"Checkout step this requirement belongs to"},"field":{"type":"string","description":"Field that needs to be satisfied"},"message":{"type":"string","description":"Human-readable requirement message"}},"required":["step","field","message"]},"CartWarning":{"type":"object","description":"A warning about a cart issue (e.g., item removed due to stock change)","properties":{"code":{"type":"string","description":"Machine-readable warning code"},"message":{"type":"string","description":"Human-readable warning message"},"line_item_id":{"type":"string","nullable":true,"description":"Prefixed line item ID (when applicable)"},"variant_id":{"type":"string","nullable":true,"description":"Prefixed variant ID (when applicable)"},"item_index":{"type":"integer","nullable":true,"description":"Position in the submitted items array, for warnings raised while applying a batch of item changes"}},"required":["code","message"]},"FulfillmentManifestItem":{"type":"object","description":"An item within a fulfillment — which line item and how many units are in this fulfillment","properties":{"item_id":{"type":"string","description":"Line item ID"},"variant_id":{"type":"string","description":"Variant ID"},"quantity":{"type":"integer","description":"Quantity in this fulfillment"}},"required":["item_id","variant_id","quantity"]},"AdminUserRoleAssignment":{"type":"object","description":"A role assignment for the current store on a staff member","properties":{"id":{"type":"string","description":"Prefixed role ID"},"name":{"type":"string","description":"Role name"}},"required":["id","name"]},"AdminUserStore":{"type":"object","description":"A store the staff member can access through a role assignment","properties":{"id":{"type":"string","description":"Prefixed store ID"},"name":{"type":"string","description":"Store name"},"code":{"type":"string","description":"Store code"}},"required":["id","name","code"]},"PreferenceField":{"type":"object","description":"A single configurable preference on a payment method, promotion rule/action, or calculator. The frontend uses `type` + `default` to render a sensible input.","properties":{"key":{"type":"string"},"type":{"type":"string","description":"string | text | password | integer | decimal | boolean | array | hash"},"default":{"description":"Default value (any JSON type), null when there is no default","nullable":true}},"required":["key","type"]},"PromotionActionCalculator":{"type":"object","description":"The action's nested calculator (when the action carries one — null for actions like `free_shipping`)","properties":{"type":{"type":"string","description":"Wire shorthand for the calculator subclass"},"label":{"type":"string"},"preferences":{"type":"object","additionalProperties":true},"preference_schema":{"type":"array","items":{"$ref":"#/components/schemas/PreferenceField"}}},"required":["type","label","preferences","preference_schema"]},"PromotionActionLineItem":{"type":"object","description":"One row in a `create_line_items` action — the variant added to the order and how many","properties":{"variant_id":{"type":"string"},"quantity":{"type":"integer"}},"required":["variant_id","quantity"]},"Address":{"type":"object","properties":{"id":{"type":"string"},"first_name":{"type":"string","nullable":true},"last_name":{"type":"string","nullable":true},"full_name":{"type":"string"},"address1":{"type":"string","nullable":true},"address2":{"type":"string","nullable":true},"postal_code":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"country_name":{"type":"string"},"country_code":{"type":"string"},"state_text":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true},"quick_checkout":{"type":"boolean"},"is_default_billing":{"type":"boolean"},"is_default_shipping":{"type":"boolean"},"state_abbr":{"type":"string","nullable":true},"country_iso":{"type":"string"},"state_name":{"type":"string","nullable":true},"label":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"customer_id":{"type":"string","nullable":true}},"required":["id","first_name","last_name","full_name","address1","address2","postal_code","city","phone","company","country_name","country_code","state_text","state_code","quick_checkout","is_default_billing","is_default_shipping","state_abbr","country_iso","state_name","label","metadata","created_at","updated_at","customer_id"],"x-typelizer":true},"AdminUser":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"first_name":{"type":"string","nullable":true},"last_name":{"type":"string","nullable":true},"full_name":{"type":"string","nullable":true},"selected_locale":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"avatar_url":{"type":"string","nullable":true},"roles":{"type":"array","items":{"$ref":"#/components/schemas/AdminUserRoleAssignment"}},"stores":{"type":"array","items":{"$ref":"#/components/schemas/AdminUserStore"}}},"required":["id","email","first_name","last_name","full_name","selected_locale","created_at","updated_at","avatar_url","roles","stores"],"x-typelizer":true},"AllowedOrigin":{"type":"object","properties":{"id":{"type":"string"},"origin":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","origin","created_at","updated_at"],"x-typelizer":true},"ApiKey":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"key_type":{"type":"string"},"token_prefix":{"type":"string","nullable":true},"scopes":{"type":"array","items":{"type":"string"}},"created_at":{"type":"string"},"updated_at":{"type":"string"},"revoked_at":{"type":"string","nullable":true},"last_used_at":{"type":"string","nullable":true},"channel_id":{"type":"string","nullable":true},"plaintext_token":{"type":"string","nullable":true},"created_by_email":{"type":"string","nullable":true}},"required":["id","name","key_type","token_prefix","scopes","created_at","updated_at","revoked_at","last_used_at","channel_id","plaintext_token","created_by_email"],"x-typelizer":true},"AppliedPromotion":{"type":"object","properties":{"id":{"type":"string"},"promotion_id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"code":{"type":"string","nullable":true},"amount":{"type":"string"},"display_amount":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","promotion_id","name","description","code","amount","display_amount","created_at","updated_at"],"x-typelizer":true},"Cart":{"type":"object","properties":{"id":{"type":"string"},"market_id":{"type":"string","nullable":true},"channel_id":{"type":"string","nullable":true},"preferred_stock_location_id":{"type":"string","nullable":true},"number":{"type":"string"},"token":{"type":"string"},"email":{"type":"string","nullable":true},"customer_note":{"type":"string","nullable":true},"currency":{"type":"string"},"locale":{"type":"string","nullable":true},"total_quantity":{"type":"number"},"warnings":{"type":"array","items":{"$ref":"#/components/schemas/CartWarning"}},"coupon_code":{"type":"string","nullable":true},"item_total":{"type":"string","nullable":true},"display_item_total":{"type":"string","nullable":true},"adjustment_total":{"type":"string","nullable":true},"display_adjustment_total":{"type":"string","nullable":true},"discount_total":{"type":"string","nullable":true},"display_discount_total":{"type":"string","nullable":true},"tax_total":{"type":"string","nullable":true},"display_tax_total":{"type":"string","nullable":true},"included_tax_total":{"type":"string","nullable":true},"display_included_tax_total":{"type":"string","nullable":true},"additional_tax_total":{"type":"string","nullable":true},"display_additional_tax_total":{"type":"string","nullable":true},"total":{"type":"string","nullable":true},"display_total":{"type":"string","nullable":true},"gift_card_total":{"type":"string","nullable":true},"display_gift_card_total":{"type":"string","nullable":true},"amount_due":{"type":"string","nullable":true},"display_amount_due":{"type":"string","nullable":true},"delivery_total":{"type":"string","nullable":true},"display_delivery_total":{"type":"string","nullable":true},"fee_total":{"type":"string","nullable":true},"display_fee_total":{"type":"string","nullable":true},"store_credit_total":{"type":"string","nullable":true},"display_store_credit_total":{"type":"string","nullable":true},"covered_by_store_credit":{"type":"boolean"},"current_step":{"type":"string"},"completed_steps":{"type":"array","items":{"type":"string"}},"requirements":{"type":"array","items":{"$ref":"#/components/schemas/CheckoutRequirement"}},"shipping_eq_billing_address":{"type":"boolean"},"items":{"type":"array","items":{"$ref":"#/components/schemas/LineItem"}},"billing_address":{"allOf":[{"$ref":"#/components/schemas/Address"}],"nullable":true},"shipping_address":{"allOf":[{"$ref":"#/components/schemas/Address"}],"nullable":true},"market":{"allOf":[{"$ref":"#/components/schemas/Market"}],"nullable":true},"completed_at":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"applied_promotions":{"type":"array","items":{"$ref":"#/components/schemas/AppliedPromotion"}}},"required":["id","market_id","channel_id","preferred_stock_location_id","number","token","email","customer_note","currency","locale","total_quantity","warnings","coupon_code","item_total","display_item_total","adjustment_total","display_adjustment_total","discount_total","display_discount_total","tax_total","display_tax_total","included_tax_total","display_included_tax_total","additional_tax_total","display_additional_tax_total","total","display_total","gift_card_total","display_gift_card_total","amount_due","display_amount_due","delivery_total","display_delivery_total","fee_total","display_fee_total","store_credit_total","display_store_credit_total","covered_by_store_credit","current_step","completed_steps","requirements","shipping_eq_billing_address","items","billing_address","shipping_address","market","completed_at","created_at","updated_at","applied_promotions"],"x-typelizer":true},"Category":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"permalink":{"type":"string"},"position":{"type":"number"},"depth":{"type":"number"},"meta_title":{"type":"string","nullable":true},"meta_description":{"type":"string","nullable":true},"meta_keywords":{"type":"string","nullable":true},"children_count":{"type":"number"},"parent_id":{"type":"string","nullable":true},"description":{"type":"string"},"description_html":{"type":"string"},"image_url":{"type":"string","nullable":true},"square_image_url":{"type":"string","nullable":true},"is_root":{"type":"boolean"},"is_child":{"type":"boolean"},"is_leaf":{"type":"boolean"},"parent":{"$ref":"#/components/schemas/Category"},"children":{"type":"array","items":{"$ref":"#/components/schemas/Category"}},"ancestors":{"type":"array","items":{"$ref":"#/components/schemas/Category"}},"custom_fields":{"type":"array","items":{"$ref":"#/components/schemas/CustomField"}},"translations":{"type":"object"},"metadata":{"type":"object"},"pretty_name":{"type":"string"},"lft":{"type":"number"},"rgt":{"type":"number"},"products_count":{"type":"number"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","name","permalink","position","depth","meta_title","meta_description","meta_keywords","children_count","parent_id","description","description_html","image_url","square_image_url","is_root","is_child","is_leaf","metadata","pretty_name","lft","rgt","products_count","created_at","updated_at"],"x-typelizer":true},"Channel":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"code":{"type":"string"},"active":{"type":"boolean"},"default":{"type":"boolean"},"storefront_access":{"type":"string"},"guest_checkout":{"type":"boolean"},"preferred_order_routing_strategy":{"type":"string","nullable":true},"preferred_storefront_access":{"type":"string","nullable":true},"preferred_guest_checkout":{"type":"boolean","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"stock_location_ids":{"type":"array","items":{"type":"string"}}},"required":["id","name","code","active","default","storefront_access","guest_checkout","preferred_order_routing_strategy","preferred_storefront_access","preferred_guest_checkout","created_at","updated_at","stock_location_ids"],"x-typelizer":true},"ClaimLineItem":{"type":"object","properties":{"id":{"type":"string"},"quantity":{"type":"number"},"send_replacement":{"type":"boolean"},"description":{"type":"string","nullable":true},"refund_amount":{"type":"string"},"paid_amount":{"type":"string"},"display_refund_amount":{"type":"string"},"variant_id":{"type":"string","nullable":true},"replacement_variant_id":{"type":"string","nullable":true},"line_item_id":{"type":"string","nullable":true},"variant":{"$ref":"#/components/schemas/Variant"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"replacement_variant":{"$ref":"#/components/schemas/Variant"}},"required":["id","quantity","send_replacement","description","refund_amount","paid_amount","display_refund_amount","variant_id","replacement_variant_id","line_item_id","created_at","updated_at"],"x-typelizer":true},"ClaimReason":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"active":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"can_be_deleted":{"type":"boolean"}},"required":["id","name","active","created_at","updated_at","can_be_deleted"],"x-typelizer":true},"Claim":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"status":{"type":"string"},"resolution":{"type":"string","nullable":true},"order_id":{"type":"string","nullable":true},"reason_id":{"type":"string","nullable":true},"refund_total":{"type":"string"},"display_refund_total":{"type":"string"},"approved_at":{"type":"string","nullable":true},"resolved_at":{"type":"string","nullable":true},"denied_at":{"type":"string","nullable":true},"canceled_at":{"type":"string","nullable":true},"reason":{"$ref":"#/components/schemas/ClaimReason"},"claim_line_items":{"type":"array","items":{"$ref":"#/components/schemas/ClaimLineItem"}},"memo":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"created_by_id":{"type":"string","nullable":true},"order":{"$ref":"#/components/schemas/Order"},"refunds":{"type":"array","items":{"$ref":"#/components/schemas/Refund"}}},"required":["id","number","status","resolution","order_id","reason_id","refund_total","display_refund_total","approved_at","resolved_at","denied_at","canceled_at","memo","metadata","created_at","updated_at","created_by_id"],"x-typelizer":true},"CollectionRule":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"value":{"type":"string","nullable":true},"match_policy":{"type":"string"}},"required":["id","type","value","match_policy"],"x-typelizer":true},"Collection":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"permalink":{"type":"string"},"position":{"type":"number"},"sort_order":{"type":"string"},"meta_title":{"type":"string","nullable":true},"meta_description":{"type":"string","nullable":true},"meta_keywords":{"type":"string","nullable":true},"products_count":{"type":"number"},"description":{"type":"string"},"description_html":{"type":"string"},"image_url":{"type":"string","nullable":true},"square_image_url":{"type":"string","nullable":true},"custom_fields":{"type":"array","items":{"$ref":"#/components/schemas/CustomField"}},"translations":{"type":"object"},"automatic":{"type":"boolean"},"rules_match_policy":{"type":"string"},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"rules":{"type":"array","items":{"$ref":"#/components/schemas/CollectionRule"}}},"required":["id","name","permalink","position","sort_order","meta_title","meta_description","meta_keywords","products_count","description","description_html","image_url","square_image_url","automatic","rules_match_policy","metadata","created_at","updated_at"],"x-typelizer":true},"CommissionLine":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string"},"currency":{"type":"string"},"taxability_reason":{"type":"string","nullable":true},"country_code":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"rate":{"type":"string"},"tax_rate":{"type":"string"},"amount":{"type":"string"},"tax_amount":{"type":"string"},"total":{"type":"string"},"display_amount":{"type":"string"},"display_tax_amount":{"type":"string"},"display_total":{"type":"string"},"order_id":{"type":"string"},"seller_id":{"type":"string"},"line_item_id":{"type":"string","nullable":true},"fulfillment_id":{"type":"string","nullable":true},"commission_rate_id":{"type":"string","nullable":true},"seller_name":{"type":"string","nullable":true}},"required":["id","kind","currency","taxability_reason","country_code","state_code","created_at","updated_at","rate","tax_rate","amount","tax_amount","total","display_amount","display_tax_amount","display_total","order_id","seller_id","line_item_id","fulfillment_id","commission_rate_id","seller_name"],"x-typelizer":true},"CommissionRate":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"code":{"type":"string","nullable":true},"enabled":{"type":"boolean"},"position":{"type":"number"},"kind":{"type":"string"},"tax_inclusive":{"type":"boolean"},"include_shipping":{"type":"boolean"},"metadata":{"type":"object","nullable":true},"deleted_at":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"value":{"type":"string"},"commission_tax_rate":{"type":"string","nullable":true},"amounts":{"type":"object"},"bounds":{"type":"object"},"global":{"type":"boolean"},"rules":{"type":"array","items":{"$ref":"#/components/schemas/CommissionRule"}}},"required":["id","name","code","enabled","position","kind","tax_inclusive","include_shipping","metadata","deleted_at","created_at","updated_at","value","commission_tax_rate","amounts","bounds","global","rules"],"x-typelizer":true},"CommissionRule":{"type":"object","properties":{"id":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string"},"commission_rate_id":{"type":"string"},"preferences":{"type":"object"},"preference_schema":{"type":"object"},"label":{"type":"string"},"description":{"type":"string","nullable":true},"product_ids":{"type":"array","items":{"type":"string"}}},"required":["id","created_at","updated_at","type","commission_rate_id","preferences","preference_schema","label","description"],"x-typelizer":true},"CompanyContact":{"type":"object","properties":{"id":{"type":"string"},"role":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"company_location_id":{"type":"string"},"customer_id":{"type":"string"},"email":{"type":"string","nullable":true}},"required":["id","role","created_at","updated_at","company_location_id","customer_id","email"],"x-typelizer":true},"CompanyLocation":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"external_id":{"type":"string","nullable":true},"metadata":{"type":"object","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"company_id":{"type":"string"},"contacts_count":{"type":"number"},"billing_address":{"$ref":"#/components/schemas/Address"},"shipping_address":{"$ref":"#/components/schemas/Address"},"company_contacts":{"type":"array","items":{"$ref":"#/components/schemas/CompanyContact"}}},"required":["id","name","external_id","metadata","created_at","updated_at","company_id","contacts_count","billing_address","shipping_address"],"x-typelizer":true},"Company":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"external_id":{"type":"string","nullable":true},"metadata":{"type":"object","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"locations_count":{"type":"number"},"company_locations":{"type":"array","items":{"$ref":"#/components/schemas/CompanyLocation"}}},"required":["id","name","external_id","metadata","created_at","updated_at","locations_count"],"x-typelizer":true},"Country":{"type":"object","properties":{"iso":{"type":"string"},"iso3":{"type":"string"},"name":{"type":"string"},"states_required":{"type":"boolean"},"zipcode_required":{"type":"boolean"},"states":{"type":"array","items":{"$ref":"#/components/schemas/State"}},"market":{"allOf":[{"$ref":"#/components/schemas/Market"}],"nullable":true}},"required":["iso","iso3","name","states_required","zipcode_required"],"x-typelizer":true},"CouponCode":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"state":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"promotion_id":{"type":"string"},"order_id":{"type":"string","nullable":true}},"required":["id","code","state","created_at","updated_at","promotion_id","order_id"],"x-typelizer":true},"CreditCard":{"type":"object","properties":{"id":{"type":"string"},"brand":{"type":"string"},"last4":{"type":"string"},"month":{"type":"number"},"year":{"type":"number"},"name":{"type":"string","nullable":true},"default":{"type":"boolean"},"gateway_payment_profile_id":{"type":"string","nullable":true},"customer_id":{"type":"string","nullable":true},"payment_method_id":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","brand","last4","month","year","name","default","gateway_payment_profile_id","customer_id","payment_method_id","metadata","created_at","updated_at"],"x-typelizer":true},"CustomFieldDefinition":{"type":"object","properties":{"id":{"type":"string"},"namespace":{"type":"string"},"key":{"type":"string"},"label":{"type":"string"},"field_type":{"type":"string","enum":["short_text","long_text","rich_text","number","boolean","json"]},"resource_type":{"type":"string"},"storefront_visible":{"type":"boolean"},"searchable":{"type":"boolean"},"sortable":{"type":"boolean"},"filter_key":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","namespace","key","label","field_type","resource_type","storefront_visible","searchable","sortable","filter_key","created_at","updated_at"],"x-typelizer":true},"CustomField":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"type":{"type":"string","deprecated":true},"field_type":{"type":"string","enum":["short_text","long_text","rich_text","number","boolean","json"]},"key":{"type":"string"},"value":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"storefront_visible":{"type":"boolean"},"custom_field_definition_id":{"type":"string"}},"required":["id","label","type","field_type","key","value","created_at","updated_at","storefront_visible","custom_field_definition_id"],"x-typelizer":true},"CustomerGroup":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"customers_count":{"type":"number"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"customers":{"type":"array","items":{"$ref":"#/components/schemas/Customer"}}},"required":["id","name","description","customers_count","created_at","updated_at"],"x-typelizer":true},"Customer":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"first_name":{"type":"string","nullable":true},"last_name":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"accepts_email_marketing":{"type":"boolean"},"full_name":{"type":"string"},"available_store_credit_total":{"type":"string"},"display_available_store_credit_total":{"type":"string"},"addresses":{"type":"array","items":{"$ref":"#/components/schemas/Address"}},"default_billing_address":{"allOf":[{"$ref":"#/components/schemas/Address"}],"nullable":true},"default_shipping_address":{"allOf":[{"$ref":"#/components/schemas/Address"}],"nullable":true},"newsletter_subscriber":{"allOf":[{"$ref":"#/components/schemas/NewsletterSubscriber"}],"nullable":true},"customer_groups":{"type":"array","items":{"$ref":"#/components/schemas/CustomerGroup"}},"failed_attempts":{"type":"number"},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"internal_note":{"type":"string","nullable":true},"internal_note_html":{"type":"string","nullable":true},"default_billing_address_id":{"type":"string","nullable":true},"default_shipping_address_id":{"type":"string","nullable":true},"orders_count":{"type":"number"},"total_spent":{"type":"string"},"display_total_spent":{"type":"string"},"last_order_completed_at":{"type":"string","nullable":true},"orders":{"type":"array","items":{"$ref":"#/components/schemas/Order"}},"store_credits":{"type":"array","items":{"$ref":"#/components/schemas/StoreCredit"}},"customer_group_ids":{"type":"array","items":{"type":"string"}}},"required":["id","email","first_name","last_name","phone","accepts_email_marketing","full_name","available_store_credit_total","display_available_store_credit_total","failed_attempts","metadata","created_at","updated_at","tags","internal_note","internal_note_html","default_billing_address_id","default_shipping_address_id","orders_count","total_spent","display_total_spent","last_order_completed_at","customer_group_ids"],"x-typelizer":true},"DeliveryMethodRule":{"type":"object","properties":{"id":{"type":"string"},"active":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"preferences":{"type":"object"},"preference_schema":{"type":"object"},"product_ids":{"type":"array","items":{"type":"string"}}},"required":["id","active","created_at","updated_at","type","name","description","preferences","preference_schema","product_ids"],"x-typelizer":true},"DeliveryMethod":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"code":{"type":"string","nullable":true},"estimated_transit_business_days_min":{"type":"number","nullable":true},"estimated_transit_business_days_max":{"type":"number","nullable":true},"digital":{"type":"boolean"},"pickup":{"type":"boolean"},"pickup_point":{"type":"boolean"},"admin_name":{"type":"string","nullable":true},"fulfillment_provider":{"type":"string"},"pickup_point_provider":{"type":"string","nullable":true},"rate_provider":{"type":"string","nullable":true},"storefront_visible":{"type":"boolean"},"tracking_url":{"type":"string","nullable":true},"markup_flat":{"type":"string","nullable":true},"markup_percent":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"deleted_at":{"type":"string"},"services":{"type":"array","items":{"$ref":"#/components/schemas/DeliveryMethodService"}},"rules":{"type":"array","items":{"$ref":"#/components/schemas/DeliveryMethodRule"}},"tax_category_id":{"type":"string","nullable":true},"delivery_profile_id":{"type":"string"},"delivery_origin_group_id":{"type":"string","nullable":true},"delivery_zone_id":{"type":"string","nullable":true},"stock_location_ids":{"type":"array","items":{"type":"string"}},"calculator_type":{"type":"string","nullable":true},"calculator_preferences":{"type":"object","nullable":true}},"required":["id","name","code","estimated_transit_business_days_min","estimated_transit_business_days_max","digital","pickup","pickup_point","admin_name","fulfillment_provider","pickup_point_provider","rate_provider","storefront_visible","tracking_url","markup_flat","markup_percent","created_at","updated_at","deleted_at","services","rules","tax_category_id","delivery_profile_id","delivery_origin_group_id","delivery_zone_id","stock_location_ids","calculator_type","calculator_preferences"],"x-typelizer":true},"DeliveryMethodService":{"type":"object","properties":{"id":{"type":"string"},"carrier":{"type":"string"},"service":{"type":"string"},"label":{"type":"string","nullable":true},"markup_flat":{"type":"string","nullable":true},"markup_percent":{"type":"string","nullable":true},"position":{"type":"number"}},"required":["id","carrier","service","label","markup_flat","markup_percent","position"],"x-typelizer":true},"DeliveryOriginGroup":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string","nullable":true},"position":{"type":"number","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"delivery_profile_id":{"type":"string"},"stock_location_ids":{"type":"array","items":{"type":"string"}},"delivery_zones_count":{"type":"number"},"delivery_methods_count":{"type":"number"}},"required":["id","name","position","created_at","updated_at","delivery_profile_id","stock_location_ids","delivery_zones_count","delivery_methods_count"],"x-typelizer":true},"DeliveryProfile":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"default":{"type":"boolean"},"position":{"type":"number","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"kind":{"type":"string"},"digital":{"type":"boolean"},"offers_pickup":{"type":"boolean"},"offers_shipping":{"type":"boolean"},"stock_location_ids":{"type":"array","items":{"type":"string"}},"origin_groups":{"type":"object"},"products_count":{"type":"number"},"delivery_methods_count":{"type":"number"},"delivery_zones_count":{"type":"number"}},"required":["id","name","default","position","created_at","updated_at","kind","digital","offers_pickup","offers_shipping","stock_location_ids","origin_groups","products_count","delivery_methods_count","delivery_zones_count"],"x-typelizer":true},"DeliveryRate":{"type":"object","properties":{"id":{"type":"string"},"delivery_method_id":{"type":"string"},"name":{"type":"string"},"selected":{"type":"boolean"},"cost":{"type":"string"},"total":{"type":"string"},"additional_tax_total":{"type":"string"},"included_tax_total":{"type":"string"},"tax_total":{"type":"string"},"carrier":{"type":"string","nullable":true},"service_level":{"type":"string","nullable":true},"estimated_delivery_date":{"type":"string","nullable":true},"display_cost":{"type":"string"},"display_total":{"type":"string"},"display_additional_tax_total":{"type":"string"},"display_included_tax_total":{"type":"string"},"display_tax_total":{"type":"string"},"delivery_method":{"$ref":"#/components/schemas/DeliveryMethod"},"metadata":{"type":"object","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","delivery_method_id","name","selected","cost","total","additional_tax_total","included_tax_total","tax_total","carrier","service_level","estimated_delivery_date","display_cost","display_total","display_additional_tax_total","display_included_tax_total","display_tax_total","metadata","created_at","updated_at"],"x-typelizer":true},"DeliveryZoneMember":{"type":"object","properties":{"id":{"type":"string"},"member_type":{"type":"string"},"country_code":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true},"postal_code_prefix":{"type":"string","nullable":true},"postal_code_from":{"type":"string","nullable":true},"postal_code_to":{"type":"string","nullable":true},"country_name":{"type":"string","nullable":true},"state_name":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","member_type","country_code","state_code","postal_code_prefix","postal_code_from","postal_code_to","country_name","state_name","created_at","updated_at"],"x-typelizer":true},"DeliveryZone":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"members":{"type":"array","items":{"$ref":"#/components/schemas/DeliveryZoneMember"}},"created_at":{"type":"string"},"updated_at":{"type":"string"},"delivery_profile_id":{"type":"string"},"delivery_origin_group_id":{"type":"string","nullable":true},"delivery_method_ids":{"type":"array","items":{"type":"string"}}},"required":["id","name","description","created_at","updated_at","delivery_profile_id","delivery_origin_group_id","delivery_method_ids"],"x-typelizer":true},"DigitalLink":{"type":"object","properties":{"id":{"type":"string"},"access_counter":{"type":"number"},"filename":{"type":"string"},"content_type":{"type":"string"},"download_url":{"type":"string"},"authorizable":{"type":"boolean"},"expired":{"type":"boolean"},"access_limit_exceeded":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","access_counter","filename","content_type","download_url","authorizable","expired","access_limit_exceeded","created_at","updated_at"],"x-typelizer":true},"Discount":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"kind":{"type":"string"},"code":{"type":"string","nullable":true},"value_type":{"type":"string","nullable":true},"value":{"type":"string","nullable":true},"promotion_id":{"type":"string","nullable":true},"line_item_id":{"type":"string","nullable":true},"fulfillment_id":{"type":"string","nullable":true},"amount":{"type":"string"},"display_amount":{"type":"string"},"metadata":{"type":"object","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","label","kind","code","value_type","value","promotion_id","line_item_id","fulfillment_id","amount","display_amount","metadata","created_at","updated_at"],"x-typelizer":true},"ExchangeLineItem":{"type":"object","properties":{"id":{"type":"string"},"quantity":{"type":"number"},"received_quantity":{"type":"number"},"resellable":{"type":"boolean"},"original_price":{"type":"string"},"new_variant_price":{"type":"string"},"price_difference":{"type":"string"},"original_variant_id":{"type":"string","nullable":true},"new_variant_id":{"type":"string","nullable":true},"line_item_id":{"type":"string","nullable":true},"fulfillment_item_id":{"type":"string","nullable":true},"original_variant":{"$ref":"#/components/schemas/Variant"},"new_variant":{"$ref":"#/components/schemas/Variant"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","quantity","received_quantity","resellable","original_price","new_variant_price","price_difference","original_variant_id","new_variant_id","line_item_id","fulfillment_item_id","created_at","updated_at"],"x-typelizer":true},"Exchange":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"status":{"type":"string"},"order_id":{"type":"string","nullable":true},"reason_id":{"type":"string","nullable":true},"price_difference":{"type":"string"},"display_price_difference":{"type":"string"},"approved_at":{"type":"string","nullable":true},"received_at":{"type":"string","nullable":true},"fulfilled_at":{"type":"string","nullable":true},"canceled_at":{"type":"string","nullable":true},"reason":{"$ref":"#/components/schemas/ReturnReason"},"exchange_line_items":{"type":"array","items":{"$ref":"#/components/schemas/ExchangeLineItem"}},"memo":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"stock_location_id":{"type":"string","nullable":true},"created_by_id":{"type":"string","nullable":true},"order":{"$ref":"#/components/schemas/Order"},"stock_location":{"$ref":"#/components/schemas/StockLocation"},"refunds":{"type":"array","items":{"$ref":"#/components/schemas/Refund"}}},"required":["id","number","status","order_id","reason_id","price_difference","display_price_difference","approved_at","received_at","fulfilled_at","canceled_at","memo","metadata","created_at","updated_at","stock_location_id","created_by_id"],"x-typelizer":true},"Export":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"format":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string","nullable":true},"user_id":{"type":"string","nullable":true},"done":{"type":"boolean"},"filename":{"type":"string","nullable":true},"byte_size":{"type":"number","nullable":true},"download_url":{"type":"string","nullable":true}},"required":["id","number","format","created_at","updated_at","type","user_id","done","filename","byte_size","download_url"],"x-typelizer":true},"Fee":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"kind":{"type":"string"},"line_item_id":{"type":"string","nullable":true},"fulfillment_id":{"type":"string","nullable":true},"amount":{"type":"string"},"display_amount":{"type":"string"},"metadata":{"type":"object","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","label","kind","line_item_id","fulfillment_id","amount","display_amount","metadata","created_at","updated_at"],"x-typelizer":true},"FulfillmentItem":{"type":"object","properties":{"id":{"type":"string"},"quantity":{"type":"number"},"status":{"type":"string"},"variant_id":{"type":"string","nullable":true},"line_item_id":{"type":"string","nullable":true},"name":{"type":"string","nullable":true},"options_text":{"type":"string","nullable":true}},"required":["id","quantity","status","variant_id","line_item_id","name","options_text"],"x-typelizer":true},"Fulfillment":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"tracking":{"type":"string","nullable":true},"tracking_url":{"type":"string","nullable":true},"tracking_carrier":{"type":"string","nullable":true},"tracking_carrier_name":{"type":"string","nullable":true},"pickup_point_data":{"type":"object","nullable":true},"selected_delivery_rate_id":{"type":"string","nullable":true},"cost":{"type":"string"},"display_cost":{"type":"string"},"total":{"type":"string"},"display_total":{"type":"string"},"discount_total":{"type":"string"},"display_discount_total":{"type":"string"},"additional_tax_total":{"type":"string"},"display_additional_tax_total":{"type":"string"},"included_tax_total":{"type":"string"},"display_included_tax_total":{"type":"string"},"tax_total":{"type":"string"},"display_tax_total":{"type":"string"},"status":{"type":"string"},"fulfillment_type":{"type":"string"},"fulfilled_at":{"type":"string","nullable":true},"tracking_status":{"type":"string","nullable":true},"estimated_delivery_at":{"type":"string","nullable":true},"delivered_at":{"type":"string","nullable":true},"items":{"type":"array","items":{"$ref":"#/components/schemas/FulfillmentManifestItem"}},"delivery_method":{"$ref":"#/components/schemas/DeliveryMethod"},"stock_location":{"$ref":"#/components/schemas/StockLocation"},"delivery_rates":{"type":"array","items":{"$ref":"#/components/schemas/DeliveryRate"}},"tax_lines":{"type":"array","items":{"$ref":"#/components/schemas/TaxLine"}},"metadata":{"type":"object"},"tracking_details":{"type":"object","nullable":true},"adjustment_total":{"type":"string"},"pre_tax_amount":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"order_id":{"type":"string","nullable":true},"stock_location_id":{"type":"string","nullable":true},"documents":{"type":"object"},"provider_generates_labels":{"type":"boolean"},"fulfillment_items":{"type":"array","items":{"$ref":"#/components/schemas/FulfillmentItem"}},"order":{"$ref":"#/components/schemas/Order"}},"required":["id","number","tracking","tracking_url","tracking_carrier","tracking_carrier_name","pickup_point_data","selected_delivery_rate_id","cost","display_cost","total","display_total","discount_total","display_discount_total","additional_tax_total","display_additional_tax_total","included_tax_total","display_included_tax_total","tax_total","display_tax_total","status","fulfillment_type","fulfilled_at","tracking_status","estimated_delivery_at","delivered_at","items","metadata","tracking_details","adjustment_total","pre_tax_amount","created_at","updated_at","order_id","stock_location_id","documents","provider_generates_labels"],"x-typelizer":true},"GiftCardBatch":{"type":"object","properties":{"id":{"type":"string"},"codes_count":{"type":"number"},"currency":{"type":"string","nullable":true},"prefix":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"amount":{"type":"string","nullable":true},"expires_at":{"type":"string","nullable":true},"created_by_id":{"type":"string","nullable":true}},"required":["id","codes_count","currency","prefix","created_at","updated_at","amount","expires_at","created_by_id"],"x-typelizer":true},"GiftCard":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"status":{"type":"string"},"currency":{"type":"string"},"amount":{"type":"string"},"amount_used":{"type":"string"},"amount_authorized":{"type":"string"},"amount_remaining":{"type":"string"},"display_amount":{"type":"string"},"display_amount_used":{"type":"string"},"display_amount_remaining":{"type":"string"},"expires_at":{"type":"string","nullable":true},"redeemed_at":{"type":"string","nullable":true},"expired":{"type":"boolean"},"active":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"customer_id":{"type":"string","nullable":true},"created_by_id":{"type":"string","nullable":true},"customer":{"$ref":"#/components/schemas/Customer"},"created_by":{"$ref":"#/components/schemas/AdminUser"},"gift_card_batch":{"$ref":"#/components/schemas/GiftCardBatch"},"orders":{"type":"array","items":{"$ref":"#/components/schemas/Order"}}},"required":["id","code","status","currency","amount","amount_used","amount_authorized","amount_remaining","display_amount","display_amount_used","display_amount_remaining","expires_at","redeemed_at","expired","active","created_at","updated_at","customer_id","created_by_id"],"x-typelizer":true},"ImportMapping":{"type":"object","properties":{"id":{"type":"string"},"schema_field":{"type":"string"},"file_column":{"type":"string","nullable":true},"required":{"type":"boolean"}},"required":["id","schema_field","file_column","required"],"x-typelizer":true},"ImportRow":{"type":"object","properties":{"id":{"type":"string"},"row_number":{"type":"number"},"status":{"type":"string"},"validation_errors":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"import_id":{"type":"string","nullable":true},"item_type":{"type":"string","nullable":true},"item_id":{"type":"string","nullable":true},"data":{"type":"object"}},"required":["id","row_number","status","validation_errors","created_at","updated_at","import_id","item_type","item_id","data"],"x-typelizer":true},"Import":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"rows_count":{"type":"number"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string","nullable":true},"status":{"type":"string"},"owner_type":{"type":"string","nullable":true},"owner_id":{"type":"string","nullable":true},"user_id":{"type":"string","nullable":true},"processing_errors":{"type":"string","nullable":true},"preferred_delimiter":{"type":"string"},"original_filename":{"type":"string","nullable":true},"original_byte_size":{"type":"number","nullable":true},"original_file_url":{"type":"string","nullable":true},"completed_rows_count":{"type":"number"},"failed_rows_count":{"type":"number"},"schema_fields":{"type":"array","items":{"$ref":"#/components/schemas/ImportSchemaField"}},"csv_headers":{"type":"array","items":{"type":"string"}},"sample_row":{"type":"object"},"mappings":{"type":"array","items":{"$ref":"#/components/schemas/ImportMapping"}}},"required":["id","number","rows_count","created_at","updated_at","type","status","owner_type","owner_id","user_id","processing_errors","preferred_delimiter","original_filename","original_byte_size","original_file_url","completed_rows_count","failed_rows_count","schema_fields","csv_headers","sample_row","mappings"],"x-typelizer":true},"Integration":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"active":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string"},"group":{"type":"string","nullable":true},"preferences":{"type":"object"},"preference_schema":{"type":"object"}},"required":["id","name","active","created_at","updated_at","type","group","preferences","preference_schema"],"x-typelizer":true},"Invitation":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"status":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"expires_at":{"type":"string"},"role_id":{"type":"string"},"role_name":{"type":"string"},"inviter_email":{"type":"string"},"acceptance_url":{"type":"string"},"invitee_exists":{"type":"boolean"},"store":{"type":"object"}},"required":["id","email","status","created_at","updated_at","expires_at","role_id","role_name","inviter_email","acceptance_url","invitee_exists","store"],"x-typelizer":true},"LineItem":{"type":"object","properties":{"id":{"type":"string"},"variant_id":{"type":"string"},"seller_id":{"type":"string","nullable":true},"preorder":{"type":"boolean"},"preorder_ships_at":{"type":"string","nullable":true},"quantity":{"type":"number"},"currency":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"options_text":{"type":"string"},"price":{"type":"string"},"display_price":{"type":"string"},"total":{"type":"string"},"display_total":{"type":"string"},"adjustment_total":{"type":"string"},"display_adjustment_total":{"type":"string"},"additional_tax_total":{"type":"string"},"display_additional_tax_total":{"type":"string"},"included_tax_total":{"type":"string"},"display_included_tax_total":{"type":"string"},"discount_total":{"type":"string"},"display_discount_total":{"type":"string"},"pre_tax_amount":{"type":"string"},"display_pre_tax_amount":{"type":"string"},"discounted_amount":{"type":"string"},"display_discounted_amount":{"type":"string"},"display_compare_at_amount":{"type":"string","nullable":true},"compare_at_amount":{"type":"string","nullable":true},"thumbnail_url":{"type":"string","nullable":true},"seller":{"$ref":"#/components/schemas/Seller"},"option_values":{"type":"array","items":{"$ref":"#/components/schemas/OptionValue"}},"digital_links":{"type":"array","items":{"$ref":"#/components/schemas/DigitalLink"}},"tax_lines":{"type":"array","items":{"$ref":"#/components/schemas/TaxLine"}},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"cost_price":{"type":"string","nullable":true},"tax_category_id":{"type":"string","nullable":true},"variant":{"$ref":"#/components/schemas/Variant"},"tax_category":{"$ref":"#/components/schemas/TaxCategory"}},"required":["id","variant_id","seller_id","preorder","preorder_ships_at","quantity","currency","name","slug","options_text","price","display_price","total","display_total","adjustment_total","display_adjustment_total","additional_tax_total","display_additional_tax_total","included_tax_total","display_included_tax_total","discount_total","display_discount_total","pre_tax_amount","display_pre_tax_amount","discounted_amount","display_discounted_amount","display_compare_at_amount","compare_at_amount","thumbnail_url","option_values","digital_links","metadata","created_at","updated_at","cost_price","tax_category_id"],"x-typelizer":true},"Market":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"currency":{"type":"string"},"default_locale":{"type":"string"},"tax_inclusive":{"type":"boolean"},"default":{"type":"boolean"},"country_codes":{"type":"array","items":{"type":"string"}},"supported_locales":{"type":"array","items":{"type":"string"}},"countries":{"type":"array","items":{"$ref":"#/components/schemas/Country"}},"tax_provider":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","name","currency","default_locale","tax_inclusive","default","country_codes","supported_locales","tax_provider","created_at","updated_at"],"x-typelizer":true},"Media":{"type":"object","properties":{"id":{"type":"string"},"product_id":{"type":"string","nullable":true},"variant_ids":{"type":"array","items":{"type":"string"}},"position":{"type":"number"},"alt":{"type":"string","nullable":true},"media_type":{"type":"string"},"focal_point_x":{"type":"number","nullable":true},"focal_point_y":{"type":"number","nullable":true},"external_video_url":{"type":"string","nullable":true},"original_url":{"type":"string","nullable":true},"mini_url":{"type":"string","nullable":true},"small_url":{"type":"string","nullable":true},"medium_url":{"type":"string","nullable":true},"large_url":{"type":"string","nullable":true},"xlarge_url":{"type":"string","nullable":true},"og_image_url":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"viewable_id":{"type":"string"},"download_url":{"type":"string","nullable":true},"metadata":{"type":"object"},"viewable_type":{"type":"string"}},"required":["id","product_id","variant_ids","position","alt","media_type","focal_point_x","focal_point_y","external_video_url","original_url","mini_url","small_url","medium_url","large_url","xlarge_url","og_image_url","created_at","updated_at","viewable_id","download_url","metadata","viewable_type"],"x-typelizer":true},"NewsletterSubscriber":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"verified":{"type":"boolean"},"verified_at":{"type":"string","nullable":true},"customer_id":{"type":"string","nullable":true}},"required":["id","email","created_at","updated_at","verified","verified_at","customer_id"],"x-typelizer":true},"OptionType":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"label":{"type":"string"},"position":{"type":"number"},"kind":{"type":"string"},"translations":{"type":"object"},"metadata":{"type":"object"},"filterable":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"option_values":{"type":"array","items":{"$ref":"#/components/schemas/OptionValue"}}},"required":["id","name","label","position","kind","metadata","filterable","created_at","updated_at"],"x-typelizer":true},"OptionValue":{"type":"object","properties":{"id":{"type":"string"},"option_type_id":{"type":"string"},"name":{"type":"string"},"label":{"type":"string"},"position":{"type":"number"},"color_code":{"type":"string","nullable":true},"option_type_name":{"type":"string"},"option_type_label":{"type":"string"},"image_url":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"option_type":{"$ref":"#/components/schemas/OptionType"}},"required":["id","option_type_id","name","label","position","color_code","option_type_name","option_type_label","image_url","metadata","created_at","updated_at"],"x-typelizer":true},"OrderRoutingRule":{"type":"object","properties":{"id":{"type":"string"},"position":{"type":"number"},"active":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string"},"channel_id":{"type":"string"},"preferences":{"type":"object"},"preference_schema":{"type":"object"},"label":{"type":"string"},"description":{"type":"string"}},"required":["id","position","active","created_at","updated_at","type","channel_id","preferences","preference_schema","label","description"],"x-typelizer":true},"Order":{"type":"object","properties":{"id":{"type":"string"},"market_id":{"type":"string","nullable":true},"cart_id":{"type":"string","nullable":true},"channel_id":{"type":"string","nullable":true},"number":{"type":"string"},"email":{"type":"string"},"customer_note":{"type":"string","nullable":true},"currency":{"type":"string"},"locale":{"type":"string","nullable":true},"total_quantity":{"type":"number"},"coupon_code":{"type":"string","nullable":true},"fulfillment_status":{"type":"string","nullable":true},"payment_status":{"type":"string","nullable":true},"completed_at":{"type":"string","nullable":true},"item_total":{"type":"string"},"display_item_total":{"type":"string"},"adjustment_total":{"type":"string"},"display_adjustment_total":{"type":"string"},"discount_total":{"type":"string"},"display_discount_total":{"type":"string"},"tax_total":{"type":"string"},"display_tax_total":{"type":"string"},"included_tax_total":{"type":"string"},"display_included_tax_total":{"type":"string"},"additional_tax_total":{"type":"string"},"display_additional_tax_total":{"type":"string"},"total":{"type":"string"},"display_total":{"type":"string"},"gift_card_total":{"type":"string"},"display_gift_card_total":{"type":"string"},"amount_due":{"type":"string"},"display_amount_due":{"type":"string"},"delivery_total":{"type":"string"},"display_delivery_total":{"type":"string"},"fee_total":{"type":"string"},"display_fee_total":{"type":"string"},"store_credit_total":{"type":"string"},"display_store_credit_total":{"type":"string"},"covered_by_store_credit":{"type":"boolean"},"items":{"type":"array","items":{"$ref":"#/components/schemas/LineItem"}},"fulfillments":{"type":"array","items":{"$ref":"#/components/schemas/Fulfillment"}},"payments":{"type":"array","items":{"$ref":"#/components/schemas/Payment"}},"billing_address":{"allOf":[{"$ref":"#/components/schemas/Address"}],"nullable":true},"shipping_address":{"allOf":[{"$ref":"#/components/schemas/Address"}],"nullable":true},"gift_card":{"allOf":[{"$ref":"#/components/schemas/GiftCard"}],"nullable":true},"market":{"allOf":[{"$ref":"#/components/schemas/Market"}],"nullable":true},"status":{"type":"string"},"last_ip_address":{"type":"string","nullable":true},"considered_risky":{"type":"boolean"},"confirmation_delivered":{"type":"boolean"},"store_owner_notification_delivered":{"type":"boolean"},"payment_total":{"type":"string"},"display_payment_total":{"type":"string"},"metadata":{"type":"object"},"canceled_at":{"type":"string","nullable":true},"approved_at":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"preferred_stock_location_id":{"type":"string","nullable":true},"company_location_id":{"type":"string","nullable":true},"company_id":{"type":"string","nullable":true},"tags":{"type":"array","items":{"type":"string"}},"internal_note":{"type":"string","nullable":true},"internal_note_html":{"type":"string","nullable":true},"approver_id":{"type":"string","nullable":true},"canceler_id":{"type":"string","nullable":true},"created_by_id":{"type":"string","nullable":true},"customer_id":{"type":"string","nullable":true},"applied_promotions":{"type":"array","items":{"$ref":"#/components/schemas/AppliedPromotion"}},"cart":{"$ref":"#/components/schemas/Cart"},"channel":{"$ref":"#/components/schemas/Channel"},"preferred_stock_location":{"$ref":"#/components/schemas/StockLocation"},"payment_methods":{"type":"array","items":{"$ref":"#/components/schemas/PaymentMethod"}},"customer":{"$ref":"#/components/schemas/Customer"},"approver":{"$ref":"#/components/schemas/Customer"},"canceler":{"$ref":"#/components/schemas/Customer"},"created_by":{"$ref":"#/components/schemas/Customer"},"returns":{"type":"array","items":{"$ref":"#/components/schemas/Return"}},"exchanges":{"type":"array","items":{"$ref":"#/components/schemas/Exchange"}},"claims":{"type":"array","items":{"$ref":"#/components/schemas/Claim"}}},"required":["id","market_id","cart_id","channel_id","number","email","customer_note","currency","locale","total_quantity","coupon_code","fulfillment_status","payment_status","completed_at","item_total","display_item_total","adjustment_total","display_adjustment_total","discount_total","display_discount_total","tax_total","display_tax_total","included_tax_total","display_included_tax_total","additional_tax_total","display_additional_tax_total","total","display_total","gift_card_total","display_gift_card_total","amount_due","display_amount_due","delivery_total","display_delivery_total","fee_total","display_fee_total","store_credit_total","display_store_credit_total","covered_by_store_credit","gift_card","market","status","last_ip_address","considered_risky","confirmation_delivered","store_owner_notification_delivered","payment_total","display_payment_total","metadata","canceled_at","approved_at","created_at","updated_at","preferred_stock_location_id","company_location_id","company_id","tags","internal_note","internal_note_html","approver_id","canceler_id","created_by_id","customer_id"],"x-typelizer":true},"PaymentMethod":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"type":{"type":"string"},"session_required":{"type":"boolean"},"source_required":{"type":"boolean"},"metadata":{"type":"object"},"active":{"type":"boolean"},"auto_capture":{"type":"boolean","nullable":true},"capture_method":{"type":"string","enum":["checkout","on_dispatch","manual"],"nullable":true},"resolved_capture_method":{"type":"string","enum":["checkout","on_dispatch","manual"]},"storefront_visible":{"type":"boolean"},"position":{"type":"number"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"preferences":{"type":"object"},"preference_schema":{"type":"object"}},"required":["id","name","description","type","session_required","source_required","metadata","active","auto_capture","capture_method","resolved_capture_method","storefront_visible","position","created_at","updated_at","preferences","preference_schema"],"x-typelizer":true},"Payment":{"type":"object","properties":{"id":{"type":"string"},"payment_method_id":{"type":"string"},"response_code":{"type":"string","nullable":true},"number":{"type":"string"},"amount":{"type":"string"},"display_amount":{"type":"string"},"status":{"type":"string"},"source_type":{"type":"string","nullable":true,"enum":["credit_card","store_credit","payment_source"]},"source_id":{"type":"string","nullable":true},"source":{"anyOf":[{"$ref":"#/components/schemas/CreditCard"},{"$ref":"#/components/schemas/StoreCredit"},{"$ref":"#/components/schemas/PaymentSource"}],"nullable":true},"payment_method":{"$ref":"#/components/schemas/PaymentMethod"},"metadata":{"type":"object"},"avs_response":{"type":"string","nullable":true},"cvv_response_code":{"type":"string","nullable":true},"cvv_response_message":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"captured_amount":{"type":"string"},"order_id":{"type":"string","nullable":true},"order":{"$ref":"#/components/schemas/Order"},"refunds":{"type":"array","items":{"$ref":"#/components/schemas/Refund"}}},"required":["id","payment_method_id","response_code","number","amount","display_amount","status","source_type","source_id","source","metadata","avs_response","cvv_response_code","cvv_response_message","created_at","updated_at","captured_amount","order_id"],"x-typelizer":true},"PaymentSource":{"type":"object","properties":{"id":{"type":"string"},"gateway_payment_profile_id":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","gateway_payment_profile_id","metadata","created_at","updated_at"],"x-typelizer":true},"Permission":{"type":"object","properties":{"key":{"type":"string"},"resource":{"type":"string"},"kind":{"type":"string"},"group":{"type":"string"},"group_label":{"type":"string"},"label":{"type":"string"},"description":{"type":"string"}},"required":["key","resource","kind","group","group_label","label","description"],"x-typelizer":true},"PriceHistory":{"type":"object","properties":{"id":{"type":"string"},"amount":{"type":"string"},"amount_in_cents":{"type":"number"},"currency":{"type":"string"},"display_amount":{"type":"string"},"recorded_at":{"type":"string"},"variant_id":{"type":"string"},"price_id":{"type":"string"},"compare_at_amount":{"type":"string","nullable":true},"created_at":{"type":"string"}},"required":["id","amount","amount_in_cents","currency","display_amount","recorded_at","variant_id","price_id","compare_at_amount","created_at"],"x-typelizer":true},"PriceList":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string"},"position":{"type":"number"},"match_policy":{"type":"string"},"starts_at":{"type":"string","nullable":true},"ends_at":{"type":"string","nullable":true},"deleted_at":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"currently_active":{"type":"boolean"},"products_count":{"type":"number"},"prices_count":{"type":"number"},"product_ids":{"type":"array","items":{"type":"string"}},"price_rules":{"type":"array","items":{"$ref":"#/components/schemas/PriceRule"}}},"required":["id","name","description","status","position","match_policy","starts_at","ends_at","deleted_at","created_at","updated_at","currently_active","products_count","prices_count","product_ids"],"x-typelizer":true},"PriceRule":{"type":"object","properties":{"id":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string"},"price_list_id":{"type":"string"},"preferences":{"type":"object"},"preference_schema":{"type":"array","items":{"$ref":"#/components/schemas/PreferenceField"}},"label":{"type":"string"},"description":{"type":"string","nullable":true},"markets":{"type":"array","items":{"$ref":"#/components/schemas/Market"}},"customer_groups":{"type":"array","items":{"$ref":"#/components/schemas/CustomerGroup"}},"channels":{"type":"array","items":{"$ref":"#/components/schemas/Channel"}},"customers":{"type":"array","items":{"$ref":"#/components/schemas/Customer"}}},"required":["id","created_at","updated_at","type","price_list_id","preferences","preference_schema","label","description"],"x-typelizer":true},"Price":{"type":"object","properties":{"id":{"type":"string"},"amount":{"type":"string","nullable":true},"amount_in_cents":{"type":"number","nullable":true},"compare_at_amount":{"type":"string","nullable":true},"compare_at_amount_in_cents":{"type":"number","nullable":true},"currency":{"type":"string","nullable":true},"display_amount":{"type":"string","nullable":true},"display_compare_at_amount":{"type":"string","nullable":true},"price_list_id":{"type":"string","nullable":true},"variant_id":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"variant":{"$ref":"#/components/schemas/Variant"}},"required":["id","amount","amount_in_cents","compare_at_amount","compare_at_amount_in_cents","currency","display_amount","display_compare_at_amount","price_list_id","variant_id","created_at","updated_at"],"x-typelizer":true},"ProductPublication":{"type":"object","properties":{"id":{"type":"string"},"published_at":{"type":"string","nullable":true},"unpublished_at":{"type":"string","nullable":true},"product_id":{"type":"string"},"channel_id":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","published_at","unpublished_at","product_id","channel_id","created_at","updated_at"],"x-typelizer":true},"Product":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"meta_title":{"type":"string","nullable":true},"meta_description":{"type":"string","nullable":true},"meta_keywords":{"type":"string","nullable":true},"variant_count":{"type":"number"},"available_on":{"type":"string","nullable":true},"preorder_ships_at":{"type":"string","nullable":true},"purchasable":{"type":"boolean"},"preorder":{"type":"boolean"},"in_stock":{"type":"boolean"},"backorderable":{"type":"boolean"},"available":{"type":"boolean"},"description":{"type":"string","nullable":true},"description_html":{"type":"string","nullable":true},"default_variant_id":{"type":"string"},"thumbnail_url":{"type":"string","nullable":true},"tags":{"type":"array","items":{"type":"string"}},"price":{"allOf":[{"$ref":"#/components/schemas/Price"}],"nullable":true},"original_price":{"allOf":[{"$ref":"#/components/schemas/Price"}],"nullable":true},"seller_id":{"type":"string","nullable":true},"seller":{"$ref":"#/components/schemas/Seller"},"primary_media":{"$ref":"#/components/schemas/Media"},"media":{"type":"array","items":{"$ref":"#/components/schemas/Media"}},"variants":{"type":"array","items":{"$ref":"#/components/schemas/Variant"}},"default_variant":{"$ref":"#/components/schemas/Variant"},"option_types":{"type":"array","items":{"$ref":"#/components/schemas/OptionType"}},"option_values":{"type":"array","items":{"$ref":"#/components/schemas/OptionValue"}},"categories":{"type":"array","items":{"$ref":"#/components/schemas/Category"}},"custom_fields":{"type":"array","items":{"$ref":"#/components/schemas/CustomField"}},"prior_price":{"allOf":[{"$ref":"#/components/schemas/PriceHistory"}],"nullable":true},"translations":{"type":"object"},"status":{"type":"string"},"metadata":{"type":"object"},"deleted_at":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"delivery_profile_id":{"type":"string","nullable":true},"seller_name":{"type":"string","nullable":true},"product_type_id":{"type":"string","nullable":true},"tax_category_id":{"type":"string","nullable":true},"collections":{"type":"array","items":{"$ref":"#/components/schemas/Collection"}},"product_publications":{"type":"array","items":{"$ref":"#/components/schemas/ProductPublication"}},"channels":{"type":"array","items":{"$ref":"#/components/schemas/Channel"}},"product_type":{"$ref":"#/components/schemas/ProductType"}},"required":["id","name","slug","meta_title","meta_description","meta_keywords","variant_count","available_on","preorder_ships_at","purchasable","preorder","in_stock","backorderable","available","description","description_html","default_variant_id","thumbnail_url","tags","price","original_price","seller_id","status","metadata","deleted_at","created_at","updated_at","delivery_profile_id","seller_name","product_type_id","tax_category_id"],"x-typelizer":true},"ProductTypeCustomFieldDefinition":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"namespace":{"type":"string"},"label":{"type":"string"},"field_type":{"type":"string","enum":["short_text","long_text","rich_text","number","boolean","json"]},"required":{"type":"boolean"},"sort_order":{"type":"number"}},"required":["id","key","namespace","label","field_type","required","sort_order"],"x-typelizer":true},"ProductType":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"translations":{"type":"object"},"products_count":{"type":"number"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"delivery_profile_id":{"type":"string","nullable":true},"option_type_ids":{"type":"array","items":{"type":"string"}},"category_ids":{"type":"array","items":{"type":"string"}},"custom_field_definitions":{"type":"array","items":{"$ref":"#/components/schemas/ProductTypeCustomFieldDefinition"}}},"required":["id","name","products_count","created_at","updated_at","delivery_profile_id","option_type_ids","category_ids","custom_field_definitions"],"x-typelizer":true},"PromotionAction":{"type":"object","properties":{"id":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string"},"promotion_id":{"type":"string"},"preferences":{"type":"object"},"preference_schema":{"type":"array","items":{"$ref":"#/components/schemas/PreferenceField"}},"label":{"type":"string"},"calculator":{"allOf":[{"$ref":"#/components/schemas/PromotionActionCalculator"}],"nullable":true},"line_items":{"type":"array","items":{"$ref":"#/components/schemas/PromotionActionLineItem"},"nullable":true}},"required":["id","created_at","updated_at","type","promotion_id","preferences","preference_schema","label","calculator","line_items"],"x-typelizer":true},"PromotionRule":{"type":"object","properties":{"id":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string"},"promotion_id":{"type":"string"},"preferences":{"type":"object"},"preference_schema":{"type":"array","items":{"$ref":"#/components/schemas/PreferenceField"}},"label":{"type":"string"},"product_ids":{"type":"array","items":{"type":"string"},"nullable":true},"category_ids":{"type":"array","items":{"type":"string"},"nullable":true},"customer_ids":{"type":"array","items":{"type":"string"},"nullable":true},"products":{"type":"array","items":{"$ref":"#/components/schemas/Product"}},"categories":{"type":"array","items":{"$ref":"#/components/schemas/Category"}},"customers":{"type":"array","items":{"$ref":"#/components/schemas/Customer"}},"customer_groups":{"type":"array","items":{"$ref":"#/components/schemas/CustomerGroup"}},"countries":{"type":"array","items":{"$ref":"#/components/schemas/Country"}},"channels":{"type":"array","items":{"$ref":"#/components/schemas/Channel"}},"markets":{"type":"array","items":{"$ref":"#/components/schemas/Market"}}},"required":["id","created_at","updated_at","type","promotion_id","preferences","preference_schema","label","product_ids","category_ids","customer_ids"],"x-typelizer":true},"Promotion":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"code":{"type":"string","nullable":true},"starts_at":{"type":"string","nullable":true},"expires_at":{"type":"string","nullable":true},"usage_limit":{"type":"number","nullable":true},"match_policy":{"type":"string","enum":["all","any"]},"path":{"type":"string","nullable":true},"kind":{"type":"string","enum":["coupon_code","automatic"]},"multi_codes":{"type":"boolean"},"number_of_codes":{"type":"number","nullable":true},"code_prefix":{"type":"string","nullable":true},"promotion_category_id":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"action_ids":{"type":"array","items":{"type":"string"}},"rule_ids":{"type":"array","items":{"type":"string"}}},"required":["id","name","description","code","starts_at","expires_at","usage_limit","match_policy","path","kind","multi_codes","number_of_codes","code_prefix","promotion_category_id","metadata","created_at","updated_at","action_ids","rule_ids"],"x-typelizer":true},"RefundReason":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"active":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"can_be_deleted":{"type":"boolean"}},"required":["id","name","active","created_at","updated_at","can_be_deleted"],"x-typelizer":true},"Refund":{"type":"object","properties":{"id":{"type":"string"},"transaction_id":{"type":"string","nullable":true},"amount":{"type":"string","nullable":true},"payment_id":{"type":"string","nullable":true},"refund_reason_id":{"type":"string","nullable":true},"originator_id":{"type":"string","nullable":true},"originator_type":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"payment":{"$ref":"#/components/schemas/Payment"}},"required":["id","transaction_id","amount","payment_id","refund_reason_id","originator_id","originator_type","metadata","created_at","updated_at"],"x-typelizer":true},"ReturnLineItem":{"type":"object","properties":{"id":{"type":"string"},"quantity":{"type":"number"},"received_quantity":{"type":"number"},"resellable":{"type":"boolean"},"pre_tax_amount":{"type":"string"},"display_pre_tax_amount":{"type":"string"},"variant_id":{"type":"string","nullable":true},"line_item_id":{"type":"string","nullable":true},"fulfillment_item_id":{"type":"string","nullable":true},"variant":{"$ref":"#/components/schemas/Variant"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"line_item":{"$ref":"#/components/schemas/LineItem"}},"required":["id","quantity","received_quantity","resellable","pre_tax_amount","display_pre_tax_amount","variant_id","line_item_id","fulfillment_item_id","created_at","updated_at"],"x-typelizer":true},"ReturnReason":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"active":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"can_be_deleted":{"type":"boolean"}},"required":["id","name","active","created_at","updated_at","can_be_deleted"],"x-typelizer":true},"Return":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"status":{"type":"string"},"order_id":{"type":"string","nullable":true},"reason_id":{"type":"string","nullable":true},"refund_total":{"type":"string"},"display_refund_total":{"type":"string"},"approved_at":{"type":"string","nullable":true},"received_at":{"type":"string","nullable":true},"refunded_at":{"type":"string","nullable":true},"canceled_at":{"type":"string","nullable":true},"reason":{"$ref":"#/components/schemas/ReturnReason"},"return_line_items":{"type":"array","items":{"$ref":"#/components/schemas/ReturnLineItem"}},"memo":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"stock_location_id":{"type":"string","nullable":true},"created_by_id":{"type":"string","nullable":true},"refunded_total":{"type":"string"},"refundable_total":{"type":"string"},"order":{"$ref":"#/components/schemas/Order"},"stock_location":{"$ref":"#/components/schemas/StockLocation"},"refunds":{"type":"array","items":{"$ref":"#/components/schemas/Refund"}}},"required":["id","number","status","order_id","reason_id","refund_total","display_refund_total","approved_at","received_at","refunded_at","canceled_at","memo","metadata","created_at","updated_at","stock_location_id","created_by_id","refunded_total","refundable_total"],"x-typelizer":true},"Role":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"permissions":{"type":"array","items":{"type":"string"}},"mutable":{"type":"boolean"},"users_count":{"type":"number"}},"required":["id","name","description","created_at","updated_at","permissions","mutable","users_count"],"x-typelizer":true},"Seller":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"about":{"type":"string"},"about_html":{"type":"string"},"logo_url":{"type":"string","nullable":true},"square_logo_url":{"type":"string","nullable":true},"cover_photo_url":{"type":"string","nullable":true},"status":{"type":"string"},"contact_email":{"type":"string","nullable":true},"billing_email":{"type":"string","nullable":true},"tax_remittance":{"type":"string"},"payouts_schedule_interval":{"type":"string","nullable":true},"metadata":{"type":"object","nullable":true},"holiday_mode_until":{"type":"string","nullable":true},"terms_accepted_at":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"deleted_at":{"type":"string","nullable":true},"minimum_payout_amount":{"type":"string","nullable":true},"on_holiday":{"type":"boolean"},"sellable":{"type":"boolean"},"products_count":{"type":"number"},"users_count":{"type":"number"},"billing_address":{"$ref":"#/components/schemas/Address"},"returns_address":{"$ref":"#/components/schemas/Address"}},"required":["id","name","slug","about","about_html","logo_url","square_logo_url","cover_photo_url","status","contact_email","billing_email","tax_remittance","payouts_schedule_interval","metadata","holiday_mode_until","terms_accepted_at","created_at","updated_at","deleted_at","minimum_payout_amount","on_holiday","sellable","products_count","users_count"],"x-typelizer":true},"SetupTask":{"type":"object","properties":{"name":{"type":"string"},"done":{"type":"boolean"}},"required":["name","done"],"x-typelizer":true},"State":{"type":"object","properties":{"abbr":{"type":"string"},"name":{"type":"string"}},"required":["abbr","name"],"x-typelizer":true},"StockItem":{"type":"object","properties":{"id":{"type":"string"},"count_on_hand":{"type":"number"},"backorderable":{"type":"boolean"},"stock_location_id":{"type":"string","nullable":true},"variant_id":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"allocated_count":{"type":"number"},"available_count":{"type":"number"},"stock_location":{"$ref":"#/components/schemas/StockLocation"},"variant":{"$ref":"#/components/schemas/Variant"}},"required":["id","count_on_hand","backorderable","stock_location_id","variant_id","metadata","created_at","updated_at","allocated_count","available_count"],"x-typelizer":true},"StockLocation":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"address1":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"zipcode":{"type":"string","nullable":true},"country_code":{"type":"string","nullable":true},"country_name":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true},"state_text":{"type":"string","nullable":true},"pickup_ready_in_minutes":{"type":"number","nullable":true},"pickup_instructions":{"type":"string","nullable":true},"admin_name":{"type":"string","nullable":true},"address2":{"type":"string","nullable":true},"state_name":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"active":{"type":"boolean"},"default":{"type":"boolean"},"backorderable_default":{"type":"boolean"},"propagate_all_variants":{"type":"boolean"},"kind":{"type":"string"},"pickup_enabled":{"type":"boolean"},"pickup_stock_policy":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","name","address1","city","zipcode","country_code","country_name","state_code","state_text","pickup_ready_in_minutes","pickup_instructions","admin_name","address2","state_name","phone","company","active","default","backorderable_default","propagate_all_variants","kind","pickup_enabled","pickup_stock_policy","created_at","updated_at"],"x-typelizer":true},"StockReservation":{"type":"object","properties":{"id":{"type":"string"},"stock_item_id":{"type":"string"},"line_item_id":{"type":"string"},"order_id":{"type":"string"},"variant_id":{"type":"string","nullable":true},"stock_location_id":{"type":"string","nullable":true},"quantity":{"type":"number"},"expires_at":{"type":"string"},"active":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","stock_item_id","line_item_id","order_id","variant_id","stock_location_id","quantity","expires_at","active","created_at","updated_at"],"x-typelizer":true},"StockTransfer":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"reference":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"source_location_id":{"type":"string","nullable":true},"destination_location_id":{"type":"string","nullable":true},"source_location":{"$ref":"#/components/schemas/StockLocation"},"destination_location":{"$ref":"#/components/schemas/StockLocation"}},"required":["id","number","reference","metadata","created_at","updated_at","source_location_id","destination_location_id"],"x-typelizer":true},"StoreCreditCategory":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"non_expiring":{"type":"boolean"}},"required":["id","name","created_at","updated_at","non_expiring"],"x-typelizer":true},"StoreCredit":{"type":"object","properties":{"id":{"type":"string"},"amount":{"type":"string"},"amount_used":{"type":"string"},"amount_remaining":{"type":"string"},"display_amount":{"type":"string"},"display_amount_used":{"type":"string"},"display_amount_remaining":{"type":"string"},"currency":{"type":"string"},"memo":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"customer_id":{"type":"string","nullable":true},"created_by_id":{"type":"string","nullable":true},"category_id":{"type":"string","nullable":true},"category_name":{"type":"string","nullable":true}},"required":["id","amount","amount_used","amount_remaining","display_amount","display_amount_used","display_amount_remaining","currency","memo","metadata","created_at","updated_at","customer_id","created_by_id","category_id","category_name"],"x-typelizer":true},"Store":{"type":"object","properties":{"id":{"type":"string"},"metadata":{"type":"object"},"name":{"type":"string"},"code":{"type":"string"},"preferred_storefront_url":{"type":"string","nullable":true},"default_currency":{"type":"string"},"default_locale":{"type":"string"},"mail_from_address":{"type":"string","nullable":true},"customer_support_email":{"type":"string","nullable":true},"new_order_notifications_email":{"type":"string","nullable":true},"preferred_send_consumer_transactional_emails":{"type":"boolean"},"preferred_admin_locale":{"type":"string","nullable":true},"preferred_timezone":{"type":"string"},"preferred_weight_unit":{"type":"string"},"preferred_default_package_weight":{"type":"number"},"preferred_default_package_length":{"type":"number"},"preferred_default_package_width":{"type":"number"},"preferred_default_package_height":{"type":"number"},"preferred_unit_system":{"type":"string"},"preferred_storefront_access":{"type":"string"},"preferred_guest_checkout":{"type":"boolean"},"preferred_company_field_enabled":{"type":"boolean"},"preferred_address_requires_company":{"type":"boolean"},"preferred_address_requires_phone":{"type":"boolean"},"preferred_capture_method":{"type":"string"},"preferred_track_inventory_levels":{"type":"boolean"},"preferred_stock_reservations_enabled":{"type":"boolean"},"preferred_track_price_history":{"type":"boolean"},"preferred_show_products_without_price":{"type":"boolean"},"preferred_disable_sku_validation":{"type":"boolean"},"preferred_order_routing_strategy":{"type":"string"},"preferred_document_number_format":{"type":"string"},"preferred_order_number_prefix":{"type":"string"},"preferred_order_number_suffix":{"type":"string"},"preferred_order_number_sequence_start":{"type":"number"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"order_number_sequence_started":{"type":"boolean"},"url":{"type":"string"},"api_url":{"type":"string"},"setup_tasks":{"type":"array","items":{"$ref":"#/components/schemas/SetupTask"}},"supported_currencies":{"type":"array","items":{"type":"string"}},"supported_locales":{"type":"array","items":{"type":"string"}},"available_locales":{"type":"array","items":{"type":"string"}},"logo_url":{"type":"string","nullable":true},"mailer_logo_url":{"type":"string","nullable":true}},"required":["id","metadata","name","code","preferred_storefront_url","default_currency","default_locale","mail_from_address","customer_support_email","new_order_notifications_email","preferred_send_consumer_transactional_emails","preferred_admin_locale","preferred_timezone","preferred_weight_unit","preferred_default_package_weight","preferred_default_package_length","preferred_default_package_width","preferred_default_package_height","preferred_unit_system","preferred_storefront_access","preferred_guest_checkout","preferred_company_field_enabled","preferred_address_requires_company","preferred_address_requires_phone","preferred_capture_method","preferred_track_inventory_levels","preferred_stock_reservations_enabled","preferred_track_price_history","preferred_show_products_without_price","preferred_disable_sku_validation","preferred_order_routing_strategy","preferred_document_number_format","preferred_order_number_prefix","preferred_order_number_suffix","preferred_order_number_sequence_start","created_at","updated_at","order_number_sequence_started","url","api_url","setup_tasks","supported_currencies","supported_locales","available_locales","logo_url","mailer_logo_url"],"x-typelizer":true},"TaxCategory":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"tax_code":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"is_default":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","name","tax_code","description","is_default","created_at","updated_at"],"x-typelizer":true},"TaxExemptionCertificate":{"type":"object","properties":{"id":{"type":"string"},"certificate_number":{"type":"string"},"reason_code":{"type":"string"},"status":{"type":"string"},"issuing_authority":{"type":"string","nullable":true},"metadata":{"type":"object","nullable":true},"issued_at":{"type":"string"},"expires_at":{"type":"string"},"verified_at":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"company_id":{"type":"string"},"country_code":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true},"active":{"type":"boolean"},"lapsed":{"type":"boolean"},"can_be_deleted":{"type":"boolean"},"document_filename":{"type":"string","nullable":true},"document_byte_size":{"type":"number","nullable":true},"document_url":{"type":"string","nullable":true}},"required":["id","certificate_number","reason_code","status","issuing_authority","metadata","issued_at","expires_at","verified_at","created_at","updated_at","company_id","country_code","state_code","active","lapsed","can_be_deleted","document_filename","document_byte_size","document_url"],"x-typelizer":true},"TaxIdentifier":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string"},"value":{"type":"string"},"validation_status":{"type":"string","nullable":true},"validation_evidence":{"type":"object","nullable":true},"source":{"type":"string","nullable":true},"validated_at":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"validatable":{"type":"boolean"},"customer_id":{"type":"string","nullable":true},"cart_id":{"type":"string","nullable":true},"order_id":{"type":"string","nullable":true}},"required":["id","kind","value","validation_status","validation_evidence","source","validated_at","created_at","updated_at","validatable","customer_id","cart_id","order_id"],"x-typelizer":true},"TaxLine":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"included":{"type":"boolean"},"rate":{"type":"string"},"tax_rate_id":{"type":"string","nullable":true},"line_item_id":{"type":"string","nullable":true},"fulfillment_id":{"type":"string","nullable":true},"fee_id":{"type":"string","nullable":true},"amount":{"type":"string"},"display_amount":{"type":"string"},"provider_id":{"type":"string","nullable":true},"metadata":{"type":"object","nullable":true},"taxability_reason":{"type":"string","nullable":true},"country_code":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true},"data":{"type":"object","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","label","included","rate","tax_rate_id","line_item_id","fulfillment_id","fee_id","amount","display_amount","provider_id","metadata","taxability_reason","country_code","state_code","data","created_at","updated_at"],"x-typelizer":true},"TaxRate":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"included_in_price":{"type":"boolean"},"show_rate_in_label":{"type":"boolean"},"metadata":{"type":"object","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"deleted_at":{"type":"string","nullable":true},"amount":{"type":"string"},"amount_percentage":{"type":"number","nullable":true},"tax_category_id":{"type":"string","nullable":true},"store_id":{"type":"string","nullable":true},"country_code":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true}},"required":["id","name","included_in_price","show_rate_in_label","metadata","created_at","updated_at","deleted_at","amount","amount_percentage","tax_category_id","store_id","country_code","state_code"],"x-typelizer":true},"Variant":{"type":"object","properties":{"id":{"type":"string"},"product_id":{"type":"string"},"sku":{"type":"string","nullable":true},"options_text":{"type":"string"},"track_inventory":{"type":"boolean"},"media_count":{"type":"number"},"preorder_ships_at":{"type":"string","nullable":true},"thumbnail_url":{"type":"string","nullable":true},"purchasable":{"type":"boolean"},"in_stock":{"type":"boolean"},"backorderable":{"type":"boolean"},"preorder":{"type":"boolean"},"weight":{"type":"number","nullable":true},"height":{"type":"number","nullable":true},"width":{"type":"number","nullable":true},"depth":{"type":"number","nullable":true},"price":{"$ref":"#/components/schemas/Price"},"original_price":{"allOf":[{"$ref":"#/components/schemas/Price"}],"nullable":true},"primary_media":{"$ref":"#/components/schemas/Media"},"media":{"type":"array","items":{"$ref":"#/components/schemas/Media"}},"option_values":{"type":"array","items":{"$ref":"#/components/schemas/OptionValue"}},"custom_fields":{"type":"array","items":{"$ref":"#/components/schemas/CustomField"}},"prior_price":{"allOf":[{"$ref":"#/components/schemas/PriceHistory"}],"nullable":true},"metadata":{"type":"object"},"position":{"type":"number"},"cost_price":{"type":"string","nullable":true},"cost_currency":{"type":"string","nullable":true},"barcode":{"type":"string","nullable":true},"weight_unit":{"type":"string","nullable":true},"dimensions_unit":{"type":"string","nullable":true},"backorder_limit":{"type":"number","nullable":true},"hs_code":{"type":"string","nullable":true},"country_of_origin":{"type":"string","nullable":true},"customs_description":{"type":"string","nullable":true},"deleted_at":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"preorderable":{"type":"boolean"},"tax_category_id":{"type":"string","nullable":true},"available_stock":{"type":"number","nullable":true},"reserved_quantity":{"type":"number"},"total_on_hand":{"type":"number","nullable":true},"product_name":{"type":"string"},"prices":{"type":"array","items":{"$ref":"#/components/schemas/Price"}},"stock_items":{"type":"array","items":{"$ref":"#/components/schemas/StockItem"}}},"required":["id","product_id","sku","options_text","track_inventory","media_count","preorder_ships_at","thumbnail_url","purchasable","in_stock","backorderable","preorder","weight","height","width","depth","price","original_price","option_values","metadata","position","cost_price","cost_currency","barcode","weight_unit","dimensions_unit","backorder_limit","hs_code","country_of_origin","customs_description","deleted_at","created_at","updated_at","preorderable","tax_category_id","available_stock","reserved_quantity","total_on_hand","product_name"],"x-typelizer":true},"WebhookDelivery":{"type":"object","properties":{"id":{"type":"string"},"event_name":{"type":"string"},"event_id":{"type":"string","nullable":true},"response_code":{"type":"number","nullable":true},"execution_time":{"type":"number","nullable":true},"error_type":{"type":"string","nullable":true},"request_errors":{"type":"string","nullable":true},"response_body":{"type":"string","nullable":true},"success":{"type":"boolean","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"delivered_at":{"type":"string","nullable":true},"payload":{"type":"object"},"webhook_endpoint_id":{"type":"string"},"webhook_endpoint_url":{"type":"string"}},"required":["id","event_name","event_id","response_code","execution_time","error_type","request_errors","response_body","success","created_at","updated_at","delivered_at","payload","webhook_endpoint_id","webhook_endpoint_url"],"x-typelizer":true},"WebhookEndpoint":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string","nullable":true},"url":{"type":"string"},"active":{"type":"boolean"},"subscriptions":{"type":"array","items":{"type":"string"}},"disabled_reason":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"disabled_at":{"type":"string","nullable":true},"secret_key":{"type":"string","nullable":true},"last_delivery_at":{"type":"string","nullable":true},"recent_delivery_count":{"type":"number"},"recent_failure_count":{"type":"number"},"total_delivery_count":{"type":"number"},"successful_delivery_count":{"type":"number"},"failed_delivery_count":{"type":"number"}},"required":["id","name","url","active","subscriptions","disabled_reason","created_at","updated_at","disabled_at","secret_key","last_delivery_at","recent_delivery_count","recent_failure_count","total_delivery_count","successful_delivery_count","failed_delivery_count"],"x-typelizer":true}}}}
\ No newline at end of file
diff --git a/packages/cli/src/generated/resource-paths.json b/packages/cli/src/generated/resource-paths.json
index c0ae1673a0..ac43d26ca7 100644
--- a/packages/cli/src/generated/resource-paths.json
+++ b/packages/cli/src/generated/resource-paths.json
@@ -1 +1 @@
-["/admin_users","/allowed_origins","/api_keys","/auth","/categories","/channels","/collection_rules","/collections","/commission_lines","/commission_rates","/companies","/company_contacts","/company_locations","/custom_field_definitions","/customer_groups","/customers","/delivery_methods","/delivery_profiles","/delivery_zones","/exports","/gift_card_batches","/gift_cards","/imports","/integrations","/invitations","/locales","/markets","/me","/option_types","/order_routing_rules","/orders","/payment_methods","/permissions","/price_lists","/prices","/product_types","/products","/promotion_actions","/promotion_rules","/promotions","/roles","/stock_locations","/store","/store_credit_categories","/tags","/tax_rates","/translatable_resources","/translations","/vendors","/webhook_endpoints"]
\ No newline at end of file
+["/admin_users","/allowed_origins","/api_keys","/auth","/categories","/channels","/collection_rules","/collections","/commission_lines","/commission_rates","/companies","/company_contacts","/company_locations","/custom_field_definitions","/customer_groups","/customers","/delivery_methods","/delivery_profiles","/delivery_zones","/exports","/gift_card_batches","/gift_cards","/imports","/integrations","/invitations","/locales","/markets","/me","/option_types","/order_routing_rules","/orders","/payment_methods","/permissions","/price_lists","/prices","/product_types","/products","/promotion_actions","/promotion_rules","/promotions","/roles","/sellers","/stock_locations","/store","/store_credit_categories","/tags","/tax_rates","/translatable_resources","/translations","/webhook_endpoints"]
\ No newline at end of file
diff --git a/packages/dashboard-core/src/lib/permissions.ts b/packages/dashboard-core/src/lib/permissions.ts
index e2bef77885..c047529f82 100644
--- a/packages/dashboard-core/src/lib/permissions.ts
+++ b/packages/dashboard-core/src/lib/permissions.ts
@@ -58,7 +58,7 @@ export const Subject = {
WebhookEndpoint: 'Spree::WebhookEndpoint',
WebhookDelivery: 'Spree::WebhookDelivery',
Wishlist: 'Spree::Wishlist',
- Vendor: 'Spree::Vendor',
+ Seller: 'Spree::Seller',
CommissionRate: 'Spree::CommissionRate',
CommissionRule: 'Spree::CommissionRule',
CommissionLine: 'Spree::CommissionLine',
diff --git a/packages/dashboard-core/src/vite/index.ts b/packages/dashboard-core/src/vite/index.ts
index 617e331d82..a8c2ea6a00 100644
--- a/packages/dashboard-core/src/vite/index.ts
+++ b/packages/dashboard-core/src/vite/index.ts
@@ -83,7 +83,7 @@ export interface SpreeDashboardPluginOptions {
*
* spreeDashboardPlugin({
* cssEntry: './src/admin.css',
- * plugins: ['@my-store/vendor-portal-plugin'], // explicit whitelist opt-out
+ * plugins: ['@my-store/seller-portal-plugin'], // explicit whitelist opt-out
* })
*/
export function spreeDashboardPlugin(options: SpreeDashboardPluginOptions = {}): PluginOption[] {
diff --git a/packages/dashboard-starter/src/routeTree.gen.ts b/packages/dashboard-starter/src/routeTree.gen.ts
index 314509fe7f..ce5f4ea481 100644
--- a/packages/dashboard-starter/src/routeTree.gen.ts
+++ b/packages/dashboard-starter/src/routeTree.gen.ts
@@ -24,15 +24,14 @@ import { Route as GettingStartedRouteImport } from './../../dashboard/src/routes
import { Route as ExchangesRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/exchanges'
import { Route as ClaimsRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/claims'
import { Route as SplatRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/$'
-import { Route as VendorsIndexRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/vendors/index'
import { Route as SettingsIndexRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/index'
+import { Route as SellersIndexRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/sellers/index'
import { Route as PromotionsIndexRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/promotions/index'
import { Route as ProductsIndexRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/products/index'
import { Route as OrdersIndexRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/orders/index'
import { Route as CustomersIndexRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/customers/index'
import { Route as CompaniesIndexRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/companies/index'
import { Route as BrandsDotindexRouteImport } from './../../dashboard-plugin-example/src/routes/brands.index'
-import { Route as VendorsVendorIdRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/vendors/$vendorId'
import { Route as SettingsTaxRatesRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/tax-rates'
import { Route as SettingsTaxCategoriesRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/tax-categories'
import { Route as SettingsStoreRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/store'
@@ -50,6 +49,7 @@ import { Route as SettingsCommissionRatesRouteImport } from './../../dashboard/s
import { Route as SettingsChannelsRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/channels'
import { Route as SettingsApiKeysRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/api-keys'
import { Route as SettingsAllowedOriginsRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/allowed-origins'
+import { Route as SellersSellerIdRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/sellers/$sellerId'
import { Route as PromotionsNewRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/promotions/new'
import { Route as PromotionsGiftCardsRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/promotions/gift-cards'
import { Route as PromotionsPromotionIdRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/promotions/$promotionId'
@@ -158,16 +158,16 @@ const SplatRoute = SplatRouteImport.update({
path: '/$',
getParentRoute: () => authenticatedStoreIdRoute,
} as any)
-const VendorsIndexRoute = VendorsIndexRouteImport.update({
- id: '/vendors/',
- path: '/vendors/',
- getParentRoute: () => authenticatedStoreIdRoute,
-} as any)
const SettingsIndexRoute = SettingsIndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => SettingsRoute,
} as any)
+const SellersIndexRoute = SellersIndexRouteImport.update({
+ id: '/sellers/',
+ path: '/sellers/',
+ getParentRoute: () => authenticatedStoreIdRoute,
+} as any)
const PromotionsIndexRoute = PromotionsIndexRouteImport.update({
id: '/promotions/',
path: '/promotions/',
@@ -198,11 +198,6 @@ const BrandsDotindexRoute = BrandsDotindexRouteImport.update({
path: '/brands/',
getParentRoute: () => authenticatedStoreIdRoute,
} as any)
-const VendorsVendorIdRoute = VendorsVendorIdRouteImport.update({
- id: '/vendors/$vendorId',
- path: '/vendors/$vendorId',
- getParentRoute: () => authenticatedStoreIdRoute,
-} as any)
const SettingsTaxRatesRoute = SettingsTaxRatesRouteImport.update({
id: '/tax-rates',
path: '/tax-rates',
@@ -289,6 +284,11 @@ const SettingsAllowedOriginsRoute = SettingsAllowedOriginsRouteImport.update({
path: '/allowed-origins',
getParentRoute: () => SettingsRoute,
} as any)
+const SellersSellerIdRoute = SellersSellerIdRouteImport.update({
+ id: '/sellers/$sellerId',
+ path: '/sellers/$sellerId',
+ getParentRoute: () => authenticatedStoreIdRoute,
+} as any)
const PromotionsNewRoute = PromotionsNewRouteImport.update({
id: '/promotions/new',
path: '/promotions/new',
@@ -488,6 +488,7 @@ export interface FileRoutesByFullPath {
'/$storeId/promotions/$promotionId': typeof PromotionsPromotionIdRoute
'/$storeId/promotions/gift-cards': typeof PromotionsGiftCardsRoute
'/$storeId/promotions/new': typeof PromotionsNewRoute
+ '/$storeId/sellers/$sellerId': typeof SellersSellerIdRoute
'/$storeId/settings/allowed-origins': typeof SettingsAllowedOriginsRoute
'/$storeId/settings/api-keys': typeof SettingsApiKeysRoute
'/$storeId/settings/channels': typeof SettingsChannelsRoute
@@ -505,15 +506,14 @@ export interface FileRoutesByFullPath {
'/$storeId/settings/store': typeof SettingsStoreRoute
'/$storeId/settings/tax-categories': typeof SettingsTaxCategoriesRoute
'/$storeId/settings/tax-rates': typeof SettingsTaxRatesRoute
- '/$storeId/vendors/$vendorId': typeof VendorsVendorIdRoute
'/$storeId/brands/': typeof BrandsDotindexRoute
'/$storeId/companies/': typeof CompaniesIndexRoute
'/$storeId/customers/': typeof CustomersIndexRoute
'/$storeId/orders/': typeof OrdersIndexRoute
'/$storeId/products/': typeof ProductsIndexRoute
'/$storeId/promotions/': typeof PromotionsIndexRoute
+ '/$storeId/sellers/': typeof SellersIndexRoute
'/$storeId/settings/': typeof SettingsIndexRoute
- '/$storeId/vendors/': typeof VendorsIndexRoute
'/$storeId/companies/locations/$locationId': typeof CompaniesLocationsDotlocationIdRoute
'/$storeId/orders/$orderId/edit': typeof OrdersOrderIdEditRoute
'/$storeId/products/categories/$categoryId': typeof ProductsCategoriesCategoryIdRoute
@@ -560,6 +560,7 @@ export interface FileRoutesByTo {
'/$storeId/promotions/$promotionId': typeof PromotionsPromotionIdRoute
'/$storeId/promotions/gift-cards': typeof PromotionsGiftCardsRoute
'/$storeId/promotions/new': typeof PromotionsNewRoute
+ '/$storeId/sellers/$sellerId': typeof SellersSellerIdRoute
'/$storeId/settings/allowed-origins': typeof SettingsAllowedOriginsRoute
'/$storeId/settings/api-keys': typeof SettingsApiKeysRoute
'/$storeId/settings/channels': typeof SettingsChannelsRoute
@@ -577,15 +578,14 @@ export interface FileRoutesByTo {
'/$storeId/settings/store': typeof SettingsStoreRoute
'/$storeId/settings/tax-categories': typeof SettingsTaxCategoriesRoute
'/$storeId/settings/tax-rates': typeof SettingsTaxRatesRoute
- '/$storeId/vendors/$vendorId': typeof VendorsVendorIdRoute
'/$storeId/brands': typeof BrandsDotindexRoute
'/$storeId/companies': typeof CompaniesIndexRoute
'/$storeId/customers': typeof CustomersIndexRoute
'/$storeId/orders': typeof OrdersIndexRoute
'/$storeId/products': typeof ProductsIndexRoute
'/$storeId/promotions': typeof PromotionsIndexRoute
+ '/$storeId/sellers': typeof SellersIndexRoute
'/$storeId/settings': typeof SettingsIndexRoute
- '/$storeId/vendors': typeof VendorsIndexRoute
'/$storeId/companies/locations/$locationId': typeof CompaniesLocationsDotlocationIdRoute
'/$storeId/orders/$orderId/edit': typeof OrdersOrderIdEditRoute
'/$storeId/products/categories/$categoryId': typeof ProductsCategoriesCategoryIdRoute
@@ -636,6 +636,7 @@ export interface FileRoutesById {
'/_authenticated/$storeId/promotions/$promotionId': typeof PromotionsPromotionIdRoute
'/_authenticated/$storeId/promotions/gift-cards': typeof PromotionsGiftCardsRoute
'/_authenticated/$storeId/promotions/new': typeof PromotionsNewRoute
+ '/_authenticated/$storeId/sellers/$sellerId': typeof SellersSellerIdRoute
'/_authenticated/$storeId/settings/allowed-origins': typeof SettingsAllowedOriginsRoute
'/_authenticated/$storeId/settings/api-keys': typeof SettingsApiKeysRoute
'/_authenticated/$storeId/settings/channels': typeof SettingsChannelsRoute
@@ -653,15 +654,14 @@ export interface FileRoutesById {
'/_authenticated/$storeId/settings/store': typeof SettingsStoreRoute
'/_authenticated/$storeId/settings/tax-categories': typeof SettingsTaxCategoriesRoute
'/_authenticated/$storeId/settings/tax-rates': typeof SettingsTaxRatesRoute
- '/_authenticated/$storeId/vendors/$vendorId': typeof VendorsVendorIdRoute
'/_authenticated/$storeId/brands/': typeof BrandsDotindexRoute
'/_authenticated/$storeId/companies/': typeof CompaniesIndexRoute
'/_authenticated/$storeId/customers/': typeof CustomersIndexRoute
'/_authenticated/$storeId/orders/': typeof OrdersIndexRoute
'/_authenticated/$storeId/products/': typeof ProductsIndexRoute
'/_authenticated/$storeId/promotions/': typeof PromotionsIndexRoute
+ '/_authenticated/$storeId/sellers/': typeof SellersIndexRoute
'/_authenticated/$storeId/settings/': typeof SettingsIndexRoute
- '/_authenticated/$storeId/vendors/': typeof VendorsIndexRoute
'/_authenticated/$storeId/companies/locations/$locationId': typeof CompaniesLocationsDotlocationIdRoute
'/_authenticated/$storeId/orders/$orderId/edit': typeof OrdersOrderIdEditRoute
'/_authenticated/$storeId/products/categories/$categoryId': typeof ProductsCategoriesCategoryIdRoute
@@ -712,6 +712,7 @@ export interface FileRouteTypes {
| '/$storeId/promotions/$promotionId'
| '/$storeId/promotions/gift-cards'
| '/$storeId/promotions/new'
+ | '/$storeId/sellers/$sellerId'
| '/$storeId/settings/allowed-origins'
| '/$storeId/settings/api-keys'
| '/$storeId/settings/channels'
@@ -729,15 +730,14 @@ export interface FileRouteTypes {
| '/$storeId/settings/store'
| '/$storeId/settings/tax-categories'
| '/$storeId/settings/tax-rates'
- | '/$storeId/vendors/$vendorId'
| '/$storeId/brands/'
| '/$storeId/companies/'
| '/$storeId/customers/'
| '/$storeId/orders/'
| '/$storeId/products/'
| '/$storeId/promotions/'
+ | '/$storeId/sellers/'
| '/$storeId/settings/'
- | '/$storeId/vendors/'
| '/$storeId/companies/locations/$locationId'
| '/$storeId/orders/$orderId/edit'
| '/$storeId/products/categories/$categoryId'
@@ -784,6 +784,7 @@ export interface FileRouteTypes {
| '/$storeId/promotions/$promotionId'
| '/$storeId/promotions/gift-cards'
| '/$storeId/promotions/new'
+ | '/$storeId/sellers/$sellerId'
| '/$storeId/settings/allowed-origins'
| '/$storeId/settings/api-keys'
| '/$storeId/settings/channels'
@@ -801,15 +802,14 @@ export interface FileRouteTypes {
| '/$storeId/settings/store'
| '/$storeId/settings/tax-categories'
| '/$storeId/settings/tax-rates'
- | '/$storeId/vendors/$vendorId'
| '/$storeId/brands'
| '/$storeId/companies'
| '/$storeId/customers'
| '/$storeId/orders'
| '/$storeId/products'
| '/$storeId/promotions'
+ | '/$storeId/sellers'
| '/$storeId/settings'
- | '/$storeId/vendors'
| '/$storeId/companies/locations/$locationId'
| '/$storeId/orders/$orderId/edit'
| '/$storeId/products/categories/$categoryId'
@@ -859,6 +859,7 @@ export interface FileRouteTypes {
| '/_authenticated/$storeId/promotions/$promotionId'
| '/_authenticated/$storeId/promotions/gift-cards'
| '/_authenticated/$storeId/promotions/new'
+ | '/_authenticated/$storeId/sellers/$sellerId'
| '/_authenticated/$storeId/settings/allowed-origins'
| '/_authenticated/$storeId/settings/api-keys'
| '/_authenticated/$storeId/settings/channels'
@@ -876,15 +877,14 @@ export interface FileRouteTypes {
| '/_authenticated/$storeId/settings/store'
| '/_authenticated/$storeId/settings/tax-categories'
| '/_authenticated/$storeId/settings/tax-rates'
- | '/_authenticated/$storeId/vendors/$vendorId'
| '/_authenticated/$storeId/brands/'
| '/_authenticated/$storeId/companies/'
| '/_authenticated/$storeId/customers/'
| '/_authenticated/$storeId/orders/'
| '/_authenticated/$storeId/products/'
| '/_authenticated/$storeId/promotions/'
+ | '/_authenticated/$storeId/sellers/'
| '/_authenticated/$storeId/settings/'
- | '/_authenticated/$storeId/vendors/'
| '/_authenticated/$storeId/companies/locations/$locationId'
| '/_authenticated/$storeId/orders/$orderId/edit'
| '/_authenticated/$storeId/products/categories/$categoryId'
@@ -1022,13 +1022,6 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof SplatRouteImport
parentRoute: typeof authenticatedStoreIdRoute
}
- '/_authenticated/$storeId/vendors/': {
- id: '/_authenticated/$storeId/vendors/'
- path: '/vendors'
- fullPath: '/$storeId/vendors/'
- preLoaderRoute: typeof VendorsIndexRouteImport
- parentRoute: typeof authenticatedStoreIdRoute
- }
'/_authenticated/$storeId/settings/': {
id: '/_authenticated/$storeId/settings/'
path: '/'
@@ -1036,6 +1029,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof SettingsIndexRouteImport
parentRoute: typeof SettingsRoute
}
+ '/_authenticated/$storeId/sellers/': {
+ id: '/_authenticated/$storeId/sellers/'
+ path: '/sellers'
+ fullPath: '/$storeId/sellers/'
+ preLoaderRoute: typeof SellersIndexRouteImport
+ parentRoute: typeof authenticatedStoreIdRoute
+ }
'/_authenticated/$storeId/promotions/': {
id: '/_authenticated/$storeId/promotions/'
path: '/promotions'
@@ -1078,13 +1078,6 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof BrandsDotindexRouteImport
parentRoute: typeof authenticatedStoreIdRoute
}
- '/_authenticated/$storeId/vendors/$vendorId': {
- id: '/_authenticated/$storeId/vendors/$vendorId'
- path: '/vendors/$vendorId'
- fullPath: '/$storeId/vendors/$vendorId'
- preLoaderRoute: typeof VendorsVendorIdRouteImport
- parentRoute: typeof authenticatedStoreIdRoute
- }
'/_authenticated/$storeId/settings/tax-rates': {
id: '/_authenticated/$storeId/settings/tax-rates'
path: '/tax-rates'
@@ -1204,6 +1197,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof SettingsAllowedOriginsRouteImport
parentRoute: typeof SettingsRoute
}
+ '/_authenticated/$storeId/sellers/$sellerId': {
+ id: '/_authenticated/$storeId/sellers/$sellerId'
+ path: '/sellers/$sellerId'
+ fullPath: '/$storeId/sellers/$sellerId'
+ preLoaderRoute: typeof SellersSellerIdRouteImport
+ parentRoute: typeof authenticatedStoreIdRoute
+ }
'/_authenticated/$storeId/promotions/new': {
id: '/_authenticated/$storeId/promotions/new'
path: '/promotions/new'
@@ -1516,14 +1516,14 @@ interface authenticatedStoreIdRouteChildren {
PromotionsPromotionIdRoute: typeof PromotionsPromotionIdRoute
PromotionsGiftCardsRoute: typeof PromotionsGiftCardsRoute
PromotionsNewRoute: typeof PromotionsNewRoute
- VendorsVendorIdRoute: typeof VendorsVendorIdRoute
+ SellersSellerIdRoute: typeof SellersSellerIdRoute
BrandsDotindexRoute: typeof BrandsDotindexRoute
CompaniesIndexRoute: typeof CompaniesIndexRoute
CustomersIndexRoute: typeof CustomersIndexRoute
OrdersIndexRoute: typeof OrdersIndexRoute
ProductsIndexRoute: typeof ProductsIndexRoute
PromotionsIndexRoute: typeof PromotionsIndexRoute
- VendorsIndexRoute: typeof VendorsIndexRoute
+ SellersIndexRoute: typeof SellersIndexRoute
CompaniesLocationsDotlocationIdRoute: typeof CompaniesLocationsDotlocationIdRoute
OrdersOrderIdEditRoute: typeof OrdersOrderIdEditRoute
ProductsCategoriesCategoryIdRoute: typeof ProductsCategoriesCategoryIdRoute
@@ -1559,14 +1559,14 @@ const authenticatedStoreIdRouteChildren: authenticatedStoreIdRouteChildren = {
PromotionsPromotionIdRoute: PromotionsPromotionIdRoute,
PromotionsGiftCardsRoute: PromotionsGiftCardsRoute,
PromotionsNewRoute: PromotionsNewRoute,
- VendorsVendorIdRoute: VendorsVendorIdRoute,
+ SellersSellerIdRoute: SellersSellerIdRoute,
BrandsDotindexRoute: BrandsDotindexRoute,
CompaniesIndexRoute: CompaniesIndexRoute,
CustomersIndexRoute: CustomersIndexRoute,
OrdersIndexRoute: OrdersIndexRoute,
ProductsIndexRoute: ProductsIndexRoute,
PromotionsIndexRoute: PromotionsIndexRoute,
- VendorsIndexRoute: VendorsIndexRoute,
+ SellersIndexRoute: SellersIndexRoute,
CompaniesLocationsDotlocationIdRoute: CompaniesLocationsDotlocationIdRoute,
OrdersOrderIdEditRoute: OrdersOrderIdEditRoute,
ProductsCategoriesCategoryIdRoute: ProductsCategoriesCategoryIdRoute,
diff --git a/packages/dashboard-ui/README.md b/packages/dashboard-ui/README.md
index c83d36745e..ff55e40be6 100644
--- a/packages/dashboard-ui/README.md
+++ b/packages/dashboard-ui/README.md
@@ -11,7 +11,7 @@ Spree Dashboard design system. Shadcn primitives + headless composed components
- `src/styles.css` — design tokens + Tailwind theme. Import once from your Vite app.
- `src/lib/` — generic helpers (`cn`, formatters, …).
-The headless rule is what makes the components composable from outside `@spree/dashboard` — a plugin author, an app developer building a vendor panel, or a third-party using just `@spree/dashboard-ui` can all instantiate the same components with their own data sources.
+The headless rule is what makes the components composable from outside `@spree/dashboard` — a plugin author, an app developer building a seller panel, or a third-party using just `@spree/dashboard-ui` can all instantiate the same components with their own data sources.
## Source-only package
diff --git a/packages/dashboard/e2e/vendors.spec.ts b/packages/dashboard/e2e/sellers.spec.ts
similarity index 73%
rename from packages/dashboard/e2e/vendors.spec.ts
rename to packages/dashboard/e2e/sellers.spec.ts
index 30fce59015..efcf26c207 100644
--- a/packages/dashboard/e2e/vendors.spec.ts
+++ b/packages/dashboard/e2e/sellers.spec.ts
@@ -1,10 +1,10 @@
import { expect, type Page, test } from '@playwright/test'
import { escapeRegex, gotoIndex, login, openRowMenu } from './helpers'
-const VENDORS_PATH = (storeId: string) => `/${storeId}/vendors`
+const SELLERS_PATH = (storeId: string) => `/${storeId}/sellers`
const CTA = /add seller/i
-/** The vendor name cell is a link to the detail page, not a sheet trigger. */
+/** The seller name cell is a link to the detail page, not a sheet trigger. */
function rowLink(page: Page, name: string) {
return page.getByRole('link', { name: new RegExp(`^${escapeRegex(name)}$`) })
}
@@ -17,8 +17,8 @@ function cardEdit(page: Page, title: RegExp) {
.getByRole('button', { name: /^edit$/i })
}
-/** Creating a vendor lands on its profile page. */
-async function createVendor(page: Page, name: string) {
+/** Creating a seller lands on its profile page. */
+async function createSeller(page: Page, name: string) {
await page.getByRole('button', { name: CTA }).click()
await expect(page.getByRole('heading', { name: /new seller/i })).toBeVisible()
@@ -28,24 +28,24 @@ async function createVendor(page: Page, name: string) {
await expect(page.getByRole('heading', { name })).toBeVisible({ timeout: 15_000 })
}
-test.describe('vendors', () => {
- test('lists vendors', async ({ page }) => {
+test.describe('sellers', () => {
+ test('lists sellers', async ({ page }) => {
const creds = await login(page)
- await gotoIndex(page, VENDORS_PATH(creds.store_id), CTA)
+ await gotoIndex(page, SELLERS_PATH(creds.store_id), CTA)
})
// The page is a profile you read, not a form you land in.
test('shows the profile without dropping into an edit form', async ({ page }) => {
const creds = await login(page)
- await gotoIndex(page, VENDORS_PATH(creds.store_id), CTA)
+ await gotoIndex(page, SELLERS_PATH(creds.store_id), CTA)
- const name = `E2E Vendor ${Date.now()}`
- await createVendor(page, name)
+ const name = `E2E Seller ${Date.now()}`
+ await createSeller(page, name)
await expect(page.getByText(/^pending$/i).first()).toBeVisible()
await expect(page.getByText(/at a glance/i)).toBeVisible()
// Nothing is editable until an Edit button is pressed.
- await expect(page.locator('#vendor-name')).toHaveCount(0)
+ await expect(page.locator('#seller-name')).toHaveCount(0)
await expect(page.locator('#minimum_payout_amount')).toHaveCount(0)
// Nobody has been invited yet, so inviting is the only move offered.
@@ -53,22 +53,22 @@ test.describe('vendors', () => {
await expect(page.getByRole('button', { name: /^approve$/i })).toHaveCount(0)
})
- test('shows placeholders for details the vendor has not filled in', async ({ page }) => {
+ test('shows placeholders for details the seller has not filled in', async ({ page }) => {
const creds = await login(page)
- await gotoIndex(page, VENDORS_PATH(creds.store_id), CTA)
+ await gotoIndex(page, SELLERS_PATH(creds.store_id), CTA)
- await createVendor(page, `E2E Blank Vendor ${Date.now()}`)
+ await createSeller(page, `E2E Blank Seller ${Date.now()}`)
await expect(page.getByText(/has not written a description/i)).toBeVisible()
await expect(page.getByText(/not provided/i).first()).toBeVisible()
})
- test('invites someone to run the vendor', async ({ page }) => {
+ test('invites someone to run the seller', async ({ page }) => {
const creds = await login(page)
- await gotoIndex(page, VENDORS_PATH(creds.store_id), CTA)
+ await gotoIndex(page, SELLERS_PATH(creds.store_id), CTA)
- const name = `E2E Invite Vendor ${Date.now()}`
- await createVendor(page, name)
+ const name = `E2E Invite Seller ${Date.now()}`
+ await createSeller(page, name)
await page.getByRole('button', { name: /^invite$/i }).click()
await expect(page.getByRole('heading', { name: /invite seller/i })).toBeVisible()
@@ -77,16 +77,16 @@ test.describe('vendors', () => {
await page.getByRole('button', { name: /send invitation/i }).click()
await expect(page.getByText(/^invited$/i).first()).toBeVisible({ timeout: 15_000 })
- // Re-inviting stays available; a vendor waiting to accept can be chased.
+ // Re-inviting stays available; a seller waiting to accept can be chased.
await expect(page.getByRole('button', { name: /send again/i })).toBeVisible()
})
test('edits the profile through its sheet', async ({ page }) => {
const creds = await login(page)
- await gotoIndex(page, VENDORS_PATH(creds.store_id), CTA)
+ await gotoIndex(page, SELLERS_PATH(creds.store_id), CTA)
- const name = `E2E Profile Vendor ${Date.now()}`
- await createVendor(page, name)
+ const name = `E2E Profile Seller ${Date.now()}`
+ await createSeller(page, name)
await page
.getByRole('button', { name: /^edit$/i })
@@ -94,7 +94,7 @@ test.describe('vendors', () => {
.click()
await expect(page.getByRole('heading', { name: /edit profile/i })).toBeVisible()
- await page.locator('#vendor-contact-email').fill('[email protected]')
+ await page.locator('#seller-contact-email').fill('[email protected]')
await page.getByRole('button', { name: /^save$/i }).click()
// Back to the read view, showing the new value.
@@ -106,10 +106,10 @@ test.describe('vendors', () => {
test('edits the payout settings through their own sheet', async ({ page }) => {
const creds = await login(page)
- await gotoIndex(page, VENDORS_PATH(creds.store_id), CTA)
+ await gotoIndex(page, SELLERS_PATH(creds.store_id), CTA)
- const name = `E2E Payout Vendor ${Date.now()}`
- await createVendor(page, name)
+ const name = `E2E Payout Seller ${Date.now()}`
+ await createSeller(page, name)
await cardEdit(page, /payouts and tax/i).click()
await expect(page.getByRole('heading', { name: /edit payouts and tax/i })).toBeVisible()
@@ -130,10 +130,10 @@ test.describe('vendors', () => {
// what the other just wrote.
test('saving the profile leaves the payout settings alone', async ({ page }) => {
const creds = await login(page)
- await gotoIndex(page, VENDORS_PATH(creds.store_id), CTA)
+ await gotoIndex(page, SELLERS_PATH(creds.store_id), CTA)
- const name = `E2E Isolation Vendor ${Date.now()}`
- await createVendor(page, name)
+ const name = `E2E Isolation Seller ${Date.now()}`
+ await createSeller(page, name)
await cardEdit(page, /payouts and tax/i).click()
await page.locator('#minimum_payout_amount').fill('40.0')
@@ -144,7 +144,7 @@ test.describe('vendors', () => {
.getByRole('button', { name: /^edit$/i })
.first()
.click()
- await page.locator('#vendor-billing-email').fill('[email protected]')
+ await page.locator('#seller-billing-email').fill('[email protected]')
await page.getByRole('button', { name: /^save$/i }).click()
await page.reload()
@@ -152,14 +152,14 @@ test.describe('vendors', () => {
await expect(page.getByText('40.0')).toBeVisible()
})
- test('deletes a vendor from the list', async ({ page }) => {
+ test('deletes a seller from the list', async ({ page }) => {
const creds = await login(page)
- await gotoIndex(page, VENDORS_PATH(creds.store_id), CTA)
+ await gotoIndex(page, SELLERS_PATH(creds.store_id), CTA)
- const name = `E2E Delete Vendor ${Date.now()}`
- await createVendor(page, name)
+ const name = `E2E Delete Seller ${Date.now()}`
+ await createSeller(page, name)
- await page.goto(VENDORS_PATH(creds.store_id))
+ await page.goto(SELLERS_PATH(creds.store_id))
await expect(rowLink(page, name)).toBeVisible({ timeout: 15_000 })
await openRowMenu(page, name)
diff --git a/packages/dashboard/src/components/spree/commission-rule-subjects.ts b/packages/dashboard/src/components/spree/commission-rule-subjects.ts
index 03a8ee6cf7..de11a8eb31 100644
--- a/packages/dashboard/src/components/spree/commission-rule-subjects.ts
+++ b/packages/dashboard/src/components/spree/commission-rule-subjects.ts
@@ -1,7 +1,7 @@
import type { ResourceFilterConfig } from '@spree/dashboard-core'
import { categoryAutocompleteProps } from '../../hooks/use-categories'
import { productAutocompleteProps } from '../../hooks/use-products'
-import { vendorAutocompleteProps } from '../../hooks/use-vendors'
+import { sellerAutocompleteProps } from '../../hooks/use-sellers'
/**
* How to pick records for a commission rule that names them.
@@ -27,7 +27,7 @@ export type CommissionRuleSubjectPicker = (queryKey: string) => ResourceFilterCo
// Keyed by rule kind, matching the `type` the discovery endpoint reports.
const PICKERS: Record<string, CommissionRuleSubjectPicker> = {
- vendor_rule: vendorAutocompleteProps,
+ seller_rule: sellerAutocompleteProps,
product_rule: productAutocompleteProps,
category_rule: categoryAutocompleteProps,
}
@@ -36,7 +36,7 @@ const PICKERS: Record<string, CommissionRuleSubjectPicker> = {
* The picker for a rule kind, or undefined when the kind names no records —
* a value band configures itself through its preference schema instead.
*
- * @param ruleType e.g. `vendor_rule`
+ * @param ruleType e.g. `seller_rule`
*/
export function commissionRuleSubjectPicker(
ruleType: string,
diff --git a/packages/dashboard/src/components/spree/integrations/configure-integration-sheet.tsx b/packages/dashboard/src/components/spree/integrations/configure-integration-sheet.tsx
index fa07f9fe0d..d06a2269e2 100644
--- a/packages/dashboard/src/components/spree/integrations/configure-integration-sheet.tsx
+++ b/packages/dashboard/src/components/spree/integrations/configure-integration-sheet.tsx
@@ -66,7 +66,7 @@ export function ConfigureIntegrationSheet({
}
onOpenChange(false)
} catch (err) {
- // Activation failures come back as a 422 on `active` with the vendor's
+ // Activation failures come back as a 422 on `active` with the seller's
// message — surface it inline, where the admin can act on it.
setSubmitError(err instanceof Error ? err.message : String(err))
}
diff --git a/packages/dashboard/src/components/spree/resource-image-field.tsx b/packages/dashboard/src/components/spree/resource-image-field.tsx
index aef9af19d1..bc1828307b 100644
--- a/packages/dashboard/src/components/spree/resource-image-field.tsx
+++ b/packages/dashboard/src/components/spree/resource-image-field.tsx
@@ -35,7 +35,7 @@ interface ConcreteImageFields {
/**
* Form adapter over the reusable {@link ImageUploadField}, shared by every
* resource whose form carries the image triple (categories, collections,
- * vendors). Maps the triple onto the generic controlled `ImageUploadValue`
+ * sellers). Maps the triple onto the generic controlled `ImageUploadValue`
* and resolves labels from the owning resource's locale namespace.
*/
export function ResourceImageField<Name extends string, T extends ImageFieldsFor<Name>>({
diff --git a/packages/dashboard/src/hooks/use-sellers.ts b/packages/dashboard/src/hooks/use-sellers.ts
new file mode 100644
index 0000000000..95ca895b7a
--- /dev/null
+++ b/packages/dashboard/src/hooks/use-sellers.ts
@@ -0,0 +1,118 @@
+import type {
+ ListParams,
+ Seller,
+ SellerCreateParams,
+ SellerInviteParams,
+ SellerRejectParams,
+ SellerSuspendParams,
+ SellerUpdateParams,
+} from '@spree/admin-sdk'
+import {
+ adminClient,
+ useResourceKey,
+ useResourceKeyBuilder,
+ useResourceMutation,
+} from '@spree/dashboard-core'
+import { useQuery, useQueryClient } from '@tanstack/react-query'
+import i18n from 'i18next'
+
+export function useSellers(params?: ListParams & Record<string, unknown>) {
+ return useQuery({
+ queryKey: useResourceKey('sellers', params ? JSON.stringify(params) : 'all'),
+ queryFn: () => adminClient.sellers.list(params),
+ })
+}
+
+/**
+ * Shared config for any `<ResourceMultiAutocomplete>` picking sellers (today
+ * the products table filter). Pass a unique `queryKey` per instance so
+ * independent caches don't collide.
+ */
+export function sellerAutocompleteProps(queryKey: string) {
+ return {
+ queryKey,
+ search: (q: string) => adminClient.sellers.list({ name_cont: q, limit: 20, sort: 'name' }),
+ hydrate: (ids: string[]) => adminClient.sellers.list({ id_in: ids, limit: ids.length }),
+ getOptionLabel: (seller: Seller) => seller.name ?? seller.id,
+ placeholder: i18n.t('admin.sellers.autocomplete.placeholder'),
+ emptyText: i18n.t('admin.sellers.autocomplete.empty'),
+ }
+}
+
+export function useSeller(id: string | undefined) {
+ const key = useResourceKey('sellers', id ?? 'noop')
+ return useQuery({
+ queryKey: key,
+ queryFn: () => adminClient.sellers.get(id as string),
+ enabled: !!id,
+ })
+}
+
+export function useCreateSeller() {
+ return useResourceMutation<Seller, Error, SellerCreateParams>({
+ mutationFn: (params) => adminClient.sellers.create(params),
+ invalidate: [['sellers']],
+ successMessage: i18n.t('admin.sellers.messages.created'),
+ errorMessage: i18n.t('admin.sellers.messages.create_failed'),
+ })
+}
+
+export function useUpdateSeller(id: string) {
+ return useResourceMutation<Seller, Error, SellerUpdateParams>({
+ mutationFn: (params) => adminClient.sellers.update(id, params),
+ invalidate: [['sellers'], ['sellers', id]],
+ successMessage: i18n.t('admin.sellers.messages.updated'),
+ errorMessage: i18n.t('admin.sellers.messages.update_failed'),
+ })
+}
+
+export function useDeleteSeller() {
+ const queryClient = useQueryClient()
+ const buildKey = useResourceKeyBuilder()
+
+ return useResourceMutation<void, Error, string>({
+ mutationFn: (id) => adminClient.sellers.delete(id),
+ invalidate: [['sellers']],
+ successMessage: i18n.t('admin.sellers.messages.deleted'),
+ errorMessage: i18n.t('admin.sellers.messages.delete_failed'),
+ onSuccess: (_data, id) => {
+ queryClient.removeQueries({ queryKey: buildKey('sellers', id) })
+ },
+ })
+}
+
+export function useInviteSeller(id: string) {
+ return useResourceMutation<Seller, Error, SellerInviteParams>({
+ mutationFn: (params) => adminClient.sellers.invite(id, params),
+ invalidate: [['sellers'], ['sellers', id]],
+ successMessage: i18n.t('admin.sellers.messages.invited'),
+ errorMessage: i18n.t('admin.sellers.messages.invite_failed'),
+ })
+}
+
+export function useApproveSeller(id: string) {
+ return useResourceMutation<Seller, Error, void>({
+ mutationFn: () => adminClient.sellers.approve(id),
+ invalidate: [['sellers'], ['sellers', id]],
+ successMessage: i18n.t('admin.sellers.messages.approved'),
+ errorMessage: i18n.t('admin.sellers.messages.approve_failed'),
+ })
+}
+
+export function useSuspendSeller(id: string) {
+ return useResourceMutation<Seller, Error, SellerSuspendParams | undefined>({
+ mutationFn: (params) => adminClient.sellers.suspend(id, params ?? undefined),
+ invalidate: [['sellers'], ['sellers', id]],
+ successMessage: i18n.t('admin.sellers.messages.suspended'),
+ errorMessage: i18n.t('admin.sellers.messages.suspend_failed'),
+ })
+}
+
+export function useRejectSeller(id: string) {
+ return useResourceMutation<Seller, Error, SellerRejectParams | undefined>({
+ mutationFn: (params) => adminClient.sellers.reject(id, params ?? undefined),
+ invalidate: [['sellers'], ['sellers', id]],
+ successMessage: i18n.t('admin.sellers.messages.rejected'),
+ errorMessage: i18n.t('admin.sellers.messages.reject_failed'),
+ })
+}
diff --git a/packages/dashboard/src/hooks/use-vendors.ts b/packages/dashboard/src/hooks/use-vendors.ts
deleted file mode 100644
index d49097674d..0000000000
--- a/packages/dashboard/src/hooks/use-vendors.ts
+++ /dev/null
@@ -1,118 +0,0 @@
-import type {
- ListParams,
- Vendor,
- VendorCreateParams,
- VendorInviteParams,
- VendorRejectParams,
- VendorSuspendParams,
- VendorUpdateParams,
-} from '@spree/admin-sdk'
-import {
- adminClient,
- useResourceKey,
- useResourceKeyBuilder,
- useResourceMutation,
-} from '@spree/dashboard-core'
-import { useQuery, useQueryClient } from '@tanstack/react-query'
-import i18n from 'i18next'
-
-export function useVendors(params?: ListParams & Record<string, unknown>) {
- return useQuery({
- queryKey: useResourceKey('vendors', params ? JSON.stringify(params) : 'all'),
- queryFn: () => adminClient.vendors.list(params),
- })
-}
-
-/**
- * Shared config for any `<ResourceMultiAutocomplete>` picking vendors (today
- * the products table filter). Pass a unique `queryKey` per instance so
- * independent caches don't collide.
- */
-export function vendorAutocompleteProps(queryKey: string) {
- return {
- queryKey,
- search: (q: string) => adminClient.vendors.list({ name_cont: q, limit: 20, sort: 'name' }),
- hydrate: (ids: string[]) => adminClient.vendors.list({ id_in: ids, limit: ids.length }),
- getOptionLabel: (vendor: Vendor) => vendor.name ?? vendor.id,
- placeholder: i18n.t('admin.vendors.autocomplete.placeholder'),
- emptyText: i18n.t('admin.vendors.autocomplete.empty'),
- }
-}
-
-export function useVendor(id: string | undefined) {
- const key = useResourceKey('vendors', id ?? 'noop')
- return useQuery({
- queryKey: key,
- queryFn: () => adminClient.vendors.get(id as string),
- enabled: !!id,
- })
-}
-
-export function useCreateVendor() {
- return useResourceMutation<Vendor, Error, VendorCreateParams>({
- mutationFn: (params) => adminClient.vendors.create(params),
- invalidate: [['vendors']],
- successMessage: i18n.t('admin.vendors.messages.created'),
- errorMessage: i18n.t('admin.vendors.messages.create_failed'),
- })
-}
-
-export function useUpdateVendor(id: string) {
- return useResourceMutation<Vendor, Error, VendorUpdateParams>({
- mutationFn: (params) => adminClient.vendors.update(id, params),
- invalidate: [['vendors'], ['vendors', id]],
- successMessage: i18n.t('admin.vendors.messages.updated'),
- errorMessage: i18n.t('admin.vendors.messages.update_failed'),
- })
-}
-
-export function useDeleteVendor() {
- const queryClient = useQueryClient()
- const buildKey = useResourceKeyBuilder()
-
- return useResourceMutation<void, Error, string>({
- mutationFn: (id) => adminClient.vendors.delete(id),
- invalidate: [['vendors']],
- successMessage: i18n.t('admin.vendors.messages.deleted'),
- errorMessage: i18n.t('admin.vendors.messages.delete_failed'),
- onSuccess: (_data, id) => {
- queryClient.removeQueries({ queryKey: buildKey('vendors', id) })
- },
- })
-}
-
-export function useInviteVendor(id: string) {
- return useResourceMutation<Vendor, Error, VendorInviteParams>({
- mutationFn: (params) => adminClient.vendors.invite(id, params),
- invalidate: [['vendors'], ['vendors', id]],
- successMessage: i18n.t('admin.vendors.messages.invited'),
- errorMessage: i18n.t('admin.vendors.messages.invite_failed'),
- })
-}
-
-export function useApproveVendor(id: string) {
- return useResourceMutation<Vendor, Error, void>({
- mutationFn: () => adminClient.vendors.approve(id),
- invalidate: [['vendors'], ['vendors', id]],
- successMessage: i18n.t('admin.vendors.messages.approved'),
- errorMessage: i18n.t('admin.vendors.messages.approve_failed'),
- })
-}
-
-export function useSuspendVendor(id: string) {
- return useResourceMutation<Vendor, Error, VendorSuspendParams | undefined>({
- mutationFn: (params) => adminClient.vendors.suspend(id, params ?? undefined),
- invalidate: [['vendors'], ['vendors', id]],
- successMessage: i18n.t('admin.vendors.messages.suspended'),
- errorMessage: i18n.t('admin.vendors.messages.suspend_failed'),
- })
-}
-
-export function useRejectVendor(id: string) {
- return useResourceMutation<Vendor, Error, VendorRejectParams | undefined>({
- mutationFn: (params) => adminClient.vendors.reject(id, params ?? undefined),
- invalidate: [['vendors'], ['vendors', id]],
- successMessage: i18n.t('admin.vendors.messages.rejected'),
- errorMessage: i18n.t('admin.vendors.messages.reject_failed'),
- })
-}
diff --git a/packages/dashboard/src/locales/ar.json b/packages/dashboard/src/locales/ar.json
index 0a639cb302..b7e3976760 100644
--- a/packages/dashboard/src/locales/ar.json
+++ b/packages/dashboard/src/locales/ar.json
@@ -1095,7 +1095,7 @@
"tags": {
"label": "Tags"
},
- "vendor": {
+ "seller": {
"label": "البائع",
"first_party": "تبيعه بنفسك"
}
@@ -1627,7 +1627,7 @@
"help": "اتركه فارغاً لشهادة بلا تاريخ انتهاء."
}
},
- "vendor": {
+ "seller": {
"name": {
"placeholder": "Sparks Audio"
},
@@ -1990,7 +1990,7 @@
"returns": "المرتجعات",
"settings": "الإعدادات",
"transfers": "التحويلات",
- "vendors": "البائعون"
+ "sellers": "البائعون"
},
"option_types": {
"columns": {
@@ -4190,7 +4190,7 @@
"enterprise": {
"learn_more": "تعرّف على Spree Enterprise"
},
- "vendors": {
+ "sellers": {
"add_cta": "إضافة بائع",
"add_sheet_title": "بائع جديد",
"create_description": "أنشئ سجل البائع أولاً، ثم ادعُه ووافق عليه واضبط الدفعات من صفحته.",
@@ -4260,7 +4260,7 @@
"canceled": "انسحب قبل الانضمام."
},
"tax_remittance": {
- "vendor": "البائع يورّد الضريبة",
+ "seller": "البائع يورّد الضريبة",
"platform": "السوق يورّد الضريبة"
},
"payout_interval": {
diff --git a/packages/dashboard/src/locales/de.json b/packages/dashboard/src/locales/de.json
index 11f020682a..36bb89645c 100644
--- a/packages/dashboard/src/locales/de.json
+++ b/packages/dashboard/src/locales/de.json
@@ -1084,7 +1084,7 @@
"tags": {
"label": "Tags"
},
- "vendor": {
+ "seller": {
"label": "Verkäufer",
"first_party": "Eigener Verkauf"
}
@@ -1616,7 +1616,7 @@
"help": "Leer lassen für eine Bescheinigung ohne Ablaufdatum."
}
},
- "vendor": {
+ "seller": {
"name": {
"placeholder": "Sparks Audio"
},
@@ -1979,7 +1979,7 @@
"returns": "Retouren",
"settings": "Einstellungen",
"transfers": "Umlagerungen",
- "vendors": "Verkäufer"
+ "sellers": "Verkäufer"
},
"option_types": {
"columns": {
@@ -4170,7 +4170,7 @@
"enterprise": {
"learn_more": "Mehr über Spree Enterprise erfahren"
},
- "vendors": {
+ "sellers": {
"add_cta": "Verkäufer hinzufügen",
"add_sheet_title": "Neuer Verkäufer",
"create_description": "Legen Sie zuerst den Verkäufer an. Einladung, Freigabe und Auszahlungen richten Sie danach auf seiner Seite ein.",
@@ -4240,7 +4240,7 @@
"canceled": "Hat vor dem Beitritt zurückgezogen."
},
"tax_remittance": {
- "vendor": "Verkäufer führt ab",
+ "seller": "Verkäufer führt ab",
"platform": "Marktplatz führt ab"
},
"payout_interval": {
diff --git a/packages/dashboard/src/locales/en.json b/packages/dashboard/src/locales/en.json
index 9ac9d43255..b688612e3d 100644
--- a/packages/dashboard/src/locales/en.json
+++ b/packages/dashboard/src/locales/en.json
@@ -1084,7 +1084,7 @@
"tags": {
"label": "Tags"
},
- "vendor": {
+ "seller": {
"label": "Seller",
"first_party": "Sold by you"
}
@@ -1616,7 +1616,7 @@
"help": "Leave empty for a certificate that does not expire."
}
},
- "vendor": {
+ "seller": {
"name": {
"placeholder": "Sparks Audio"
},
@@ -1979,7 +1979,7 @@
"returns": "Returns",
"settings": "Settings",
"transfers": "Transfers",
- "vendors": "Sellers"
+ "sellers": "Sellers"
},
"option_types": {
"columns": {
@@ -4170,7 +4170,7 @@
"enterprise": {
"learn_more": "Learn about Spree Enterprise"
},
- "vendors": {
+ "sellers": {
"add_cta": "Add seller",
"add_sheet_title": "New seller",
"create_description": "Create the seller record first. You can invite them, approve them and set up payouts from their page.",
@@ -4240,7 +4240,7 @@
"canceled": "They withdrew before joining."
},
"tax_remittance": {
- "vendor": "Seller remits",
+ "seller": "Seller remits",
"platform": "Marketplace remits"
},
"payout_interval": {
diff --git a/packages/dashboard/src/locales/fr.json b/packages/dashboard/src/locales/fr.json
index 43e529eff8..2b6e3fb779 100644
--- a/packages/dashboard/src/locales/fr.json
+++ b/packages/dashboard/src/locales/fr.json
@@ -1084,7 +1084,7 @@
"tags": {
"label": "Étiquettes"
},
- "vendor": {
+ "seller": {
"label": "Vendeur",
"first_party": "Vendu par vous"
}
@@ -1616,7 +1616,7 @@
"help": "Laissez vide pour une attestation sans date d'expiration."
}
},
- "vendor": {
+ "seller": {
"name": {
"placeholder": "Sparks Audio"
},
@@ -1979,7 +1979,7 @@
"returns": "Retours",
"settings": "Paramètres",
"transfers": "Transferts",
- "vendors": "Vendeurs"
+ "sellers": "Vendeurs"
},
"option_types": {
"columns": {
@@ -4170,7 +4170,7 @@
"enterprise": {
"learn_more": "En savoir plus sur Spree Enterprise"
},
- "vendors": {
+ "sellers": {
"add_cta": "Ajouter un vendeur",
"add_sheet_title": "Nouveau vendeur",
"create_description": "Créez d'abord la fiche du vendeur. Vous pourrez l'inviter, l'approuver et configurer ses versements depuis sa page.",
@@ -4240,7 +4240,7 @@
"canceled": "S'est retiré avant de rejoindre."
},
"tax_remittance": {
- "vendor": "Le vendeur reverse",
+ "seller": "Le vendeur reverse",
"platform": "La place de marché reverse"
},
"payout_interval": {
diff --git a/packages/dashboard/src/locales/pl.json b/packages/dashboard/src/locales/pl.json
index 19777c2d77..11006b2085 100644
--- a/packages/dashboard/src/locales/pl.json
+++ b/packages/dashboard/src/locales/pl.json
@@ -1098,7 +1098,7 @@
"tags": {
"label": "Tagi"
},
- "vendor": {
+ "seller": {
"label": "Sprzedawca",
"first_party": "Sprzedajesz Ty"
}
@@ -1630,7 +1630,7 @@
"help": "Zostaw puste, aby certyfikat nie wygasał."
}
},
- "vendor": {
+ "seller": {
"name": {
"placeholder": "Sparks Audio"
},
@@ -1993,7 +1993,7 @@
"returns": "Zwroty",
"settings": "Ustawienia",
"transfers": "Transfery",
- "vendors": "Sprzedawcy"
+ "sellers": "Sprzedawcy"
},
"option_types": {
"columns": {
@@ -4226,7 +4226,7 @@
"enterprise": {
"learn_more": "Dowiedz się więcej o Spree Enterprise"
},
- "vendors": {
+ "sellers": {
"add_cta": "Dodaj sprzedawcę",
"add_sheet_title": "Nowy sprzedawca",
"create_description": "Najpierw utwórz sprzedawcę. Zaproszenie, akceptację i wypłaty ustawisz na jego stronie.",
@@ -4296,7 +4296,7 @@
"canceled": "Wycofał się przed dołączeniem."
},
"tax_remittance": {
- "vendor": "Rozlicza sprzedawca",
+ "seller": "Rozlicza sprzedawca",
"platform": "Rozlicza marketplace"
},
"payout_interval": {
diff --git a/packages/dashboard/src/locales/zh-CN.json b/packages/dashboard/src/locales/zh-CN.json
index 7c9cbf7524..2ba5ef9752 100644
--- a/packages/dashboard/src/locales/zh-CN.json
+++ b/packages/dashboard/src/locales/zh-CN.json
@@ -1081,7 +1081,7 @@
"tags": {
"label": "标签"
},
- "vendor": {
+ "seller": {
"label": "卖家",
"first_party": "自营"
}
@@ -1613,7 +1613,7 @@
"help": "留空表示该证明长期有效。"
}
},
- "vendor": {
+ "seller": {
"name": {
"placeholder": "Sparks Audio"
},
@@ -1976,7 +1976,7 @@
"returns": "退货",
"settings": "设置",
"transfers": "调拨",
- "vendors": "卖家"
+ "sellers": "卖家"
},
"option_types": {
"columns": {
@@ -4166,7 +4166,7 @@
"enterprise": {
"learn_more": "了解 Spree Enterprise"
},
- "vendors": {
+ "sellers": {
"add_cta": "添加卖家",
"add_sheet_title": "新建卖家",
"create_description": "先创建卖家记录,然后在卖家页面邀请、批准并设置结算。",
@@ -4236,7 +4236,7 @@
"canceled": "在加入前已退出。"
},
"tax_remittance": {
- "vendor": "卖家申报",
+ "seller": "卖家申报",
"platform": "市场申报"
},
"payout_interval": {
diff --git a/packages/dashboard/src/nav/default.ts b/packages/dashboard/src/nav/default.ts
index 3729510c7d..d9a667c841 100644
--- a/packages/dashboard/src/nav/default.ts
+++ b/packages/dashboard/src/nav/default.ts
@@ -158,13 +158,13 @@ nav.add({
})
// Only a marketplace has sellers, so the entry hides itself on a store whose
-// staff hold no vendor permission at all.
+// staff hold no seller permission at all.
nav.add({
- key: 'vendors',
- label: i18n.t('admin.nav.vendors'),
- path: '/vendors',
+ key: 'sellers',
+ label: i18n.t('admin.nav.sellers'),
+ path: '/sellers',
icon: StoreIcon,
- subject: Subject.Vendor,
+ subject: Subject.Seller,
position: 450,
})
diff --git a/packages/dashboard/src/routeTree.gen.ts b/packages/dashboard/src/routeTree.gen.ts
index f39c64e226..15669a5071 100644
--- a/packages/dashboard/src/routeTree.gen.ts
+++ b/packages/dashboard/src/routeTree.gen.ts
@@ -24,14 +24,13 @@ import { Route as GettingStartedRouteImport } from './routes/_authenticated/$sto
import { Route as ExchangesRouteImport } from './routes/_authenticated/$storeId/exchanges'
import { Route as ClaimsRouteImport } from './routes/_authenticated/$storeId/claims'
import { Route as SplatRouteImport } from './routes/_authenticated/$storeId/$'
-import { Route as VendorsIndexRouteImport } from './routes/_authenticated/$storeId/vendors/index'
import { Route as SettingsIndexRouteImport } from './routes/_authenticated/$storeId/settings/index'
+import { Route as SellersIndexRouteImport } from './routes/_authenticated/$storeId/sellers/index'
import { Route as PromotionsIndexRouteImport } from './routes/_authenticated/$storeId/promotions/index'
import { Route as ProductsIndexRouteImport } from './routes/_authenticated/$storeId/products/index'
import { Route as OrdersIndexRouteImport } from './routes/_authenticated/$storeId/orders/index'
import { Route as CustomersIndexRouteImport } from './routes/_authenticated/$storeId/customers/index'
import { Route as CompaniesIndexRouteImport } from './routes/_authenticated/$storeId/companies/index'
-import { Route as VendorsVendorIdRouteImport } from './routes/_authenticated/$storeId/vendors/$vendorId'
import { Route as SettingsTaxRatesRouteImport } from './routes/_authenticated/$storeId/settings/tax-rates'
import { Route as SettingsTaxCategoriesRouteImport } from './routes/_authenticated/$storeId/settings/tax-categories'
import { Route as SettingsStoreRouteImport } from './routes/_authenticated/$storeId/settings/store'
@@ -49,6 +48,7 @@ import { Route as SettingsCommissionRatesRouteImport } from './routes/_authentic
import { Route as SettingsChannelsRouteImport } from './routes/_authenticated/$storeId/settings/channels'
import { Route as SettingsApiKeysRouteImport } from './routes/_authenticated/$storeId/settings/api-keys'
import { Route as SettingsAllowedOriginsRouteImport } from './routes/_authenticated/$storeId/settings/allowed-origins'
+import { Route as SellersSellerIdRouteImport } from './routes/_authenticated/$storeId/sellers/$sellerId'
import { Route as PromotionsNewRouteImport } from './routes/_authenticated/$storeId/promotions/new'
import { Route as PromotionsGiftCardsRouteImport } from './routes/_authenticated/$storeId/promotions/gift-cards'
import { Route as PromotionsPromotionIdRouteImport } from './routes/_authenticated/$storeId/promotions/$promotionId'
@@ -156,16 +156,16 @@ const SplatRoute = SplatRouteImport.update({
path: '/$',
getParentRoute: () => authenticatedStoreIdRoute,
} as any)
-const VendorsIndexRoute = VendorsIndexRouteImport.update({
- id: '/vendors/',
- path: '/vendors/',
- getParentRoute: () => authenticatedStoreIdRoute,
-} as any)
const SettingsIndexRoute = SettingsIndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => SettingsRoute,
} as any)
+const SellersIndexRoute = SellersIndexRouteImport.update({
+ id: '/sellers/',
+ path: '/sellers/',
+ getParentRoute: () => authenticatedStoreIdRoute,
+} as any)
const PromotionsIndexRoute = PromotionsIndexRouteImport.update({
id: '/promotions/',
path: '/promotions/',
@@ -191,11 +191,6 @@ const CompaniesIndexRoute = CompaniesIndexRouteImport.update({
path: '/companies/',
getParentRoute: () => authenticatedStoreIdRoute,
} as any)
-const VendorsVendorIdRoute = VendorsVendorIdRouteImport.update({
- id: '/vendors/$vendorId',
- path: '/vendors/$vendorId',
- getParentRoute: () => authenticatedStoreIdRoute,
-} as any)
const SettingsTaxRatesRoute = SettingsTaxRatesRouteImport.update({
id: '/tax-rates',
path: '/tax-rates',
@@ -282,6 +277,11 @@ const SettingsAllowedOriginsRoute = SettingsAllowedOriginsRouteImport.update({
path: '/allowed-origins',
getParentRoute: () => SettingsRoute,
} as any)
+const SellersSellerIdRoute = SellersSellerIdRouteImport.update({
+ id: '/sellers/$sellerId',
+ path: '/sellers/$sellerId',
+ getParentRoute: () => authenticatedStoreIdRoute,
+} as any)
const PromotionsNewRoute = PromotionsNewRouteImport.update({
id: '/promotions/new',
path: '/promotions/new',
@@ -475,6 +475,7 @@ export interface FileRoutesByFullPath {
'/$storeId/promotions/$promotionId': typeof PromotionsPromotionIdRoute
'/$storeId/promotions/gift-cards': typeof PromotionsGiftCardsRoute
'/$storeId/promotions/new': typeof PromotionsNewRoute
+ '/$storeId/sellers/$sellerId': typeof SellersSellerIdRoute
'/$storeId/settings/allowed-origins': typeof SettingsAllowedOriginsRoute
'/$storeId/settings/api-keys': typeof SettingsApiKeysRoute
'/$storeId/settings/channels': typeof SettingsChannelsRoute
@@ -492,14 +493,13 @@ export interface FileRoutesByFullPath {
'/$storeId/settings/store': typeof SettingsStoreRoute
'/$storeId/settings/tax-categories': typeof SettingsTaxCategoriesRoute
'/$storeId/settings/tax-rates': typeof SettingsTaxRatesRoute
- '/$storeId/vendors/$vendorId': typeof VendorsVendorIdRoute
'/$storeId/companies/': typeof CompaniesIndexRoute
'/$storeId/customers/': typeof CustomersIndexRoute
'/$storeId/orders/': typeof OrdersIndexRoute
'/$storeId/products/': typeof ProductsIndexRoute
'/$storeId/promotions/': typeof PromotionsIndexRoute
+ '/$storeId/sellers/': typeof SellersIndexRoute
'/$storeId/settings/': typeof SettingsIndexRoute
- '/$storeId/vendors/': typeof VendorsIndexRoute
'/$storeId/companies/locations/$locationId': typeof CompaniesLocationsDotlocationIdRoute
'/$storeId/orders/$orderId/edit': typeof OrdersOrderIdEditRoute
'/$storeId/products/categories/$categoryId': typeof ProductsCategoriesCategoryIdRoute
@@ -545,6 +545,7 @@ export interface FileRoutesByTo {
'/$storeId/promotions/$promotionId': typeof PromotionsPromotionIdRoute
'/$storeId/promotions/gift-cards': typeof PromotionsGiftCardsRoute
'/$storeId/promotions/new': typeof PromotionsNewRoute
+ '/$storeId/sellers/$sellerId': typeof SellersSellerIdRoute
'/$storeId/settings/allowed-origins': typeof SettingsAllowedOriginsRoute
'/$storeId/settings/api-keys': typeof SettingsApiKeysRoute
'/$storeId/settings/channels': typeof SettingsChannelsRoute
@@ -562,14 +563,13 @@ export interface FileRoutesByTo {
'/$storeId/settings/store': typeof SettingsStoreRoute
'/$storeId/settings/tax-categories': typeof SettingsTaxCategoriesRoute
'/$storeId/settings/tax-rates': typeof SettingsTaxRatesRoute
- '/$storeId/vendors/$vendorId': typeof VendorsVendorIdRoute
'/$storeId/companies': typeof CompaniesIndexRoute
'/$storeId/customers': typeof CustomersIndexRoute
'/$storeId/orders': typeof OrdersIndexRoute
'/$storeId/products': typeof ProductsIndexRoute
'/$storeId/promotions': typeof PromotionsIndexRoute
+ '/$storeId/sellers': typeof SellersIndexRoute
'/$storeId/settings': typeof SettingsIndexRoute
- '/$storeId/vendors': typeof VendorsIndexRoute
'/$storeId/companies/locations/$locationId': typeof CompaniesLocationsDotlocationIdRoute
'/$storeId/orders/$orderId/edit': typeof OrdersOrderIdEditRoute
'/$storeId/products/categories/$categoryId': typeof ProductsCategoriesCategoryIdRoute
@@ -619,6 +619,7 @@ export interface FileRoutesById {
'/_authenticated/$storeId/promotions/$promotionId': typeof PromotionsPromotionIdRoute
'/_authenticated/$storeId/promotions/gift-cards': typeof PromotionsGiftCardsRoute
'/_authenticated/$storeId/promotions/new': typeof PromotionsNewRoute
+ '/_authenticated/$storeId/sellers/$sellerId': typeof SellersSellerIdRoute
'/_authenticated/$storeId/settings/allowed-origins': typeof SettingsAllowedOriginsRoute
'/_authenticated/$storeId/settings/api-keys': typeof SettingsApiKeysRoute
'/_authenticated/$storeId/settings/channels': typeof SettingsChannelsRoute
@@ -636,14 +637,13 @@ export interface FileRoutesById {
'/_authenticated/$storeId/settings/store': typeof SettingsStoreRoute
'/_authenticated/$storeId/settings/tax-categories': typeof SettingsTaxCategoriesRoute
'/_authenticated/$storeId/settings/tax-rates': typeof SettingsTaxRatesRoute
- '/_authenticated/$storeId/vendors/$vendorId': typeof VendorsVendorIdRoute
'/_authenticated/$storeId/companies/': typeof CompaniesIndexRoute
'/_authenticated/$storeId/customers/': typeof CustomersIndexRoute
'/_authenticated/$storeId/orders/': typeof OrdersIndexRoute
'/_authenticated/$storeId/products/': typeof ProductsIndexRoute
'/_authenticated/$storeId/promotions/': typeof PromotionsIndexRoute
+ '/_authenticated/$storeId/sellers/': typeof SellersIndexRoute
'/_authenticated/$storeId/settings/': typeof SettingsIndexRoute
- '/_authenticated/$storeId/vendors/': typeof VendorsIndexRoute
'/_authenticated/$storeId/companies/locations/$locationId': typeof CompaniesLocationsDotlocationIdRoute
'/_authenticated/$storeId/orders/$orderId/edit': typeof OrdersOrderIdEditRoute
'/_authenticated/$storeId/products/categories/$categoryId': typeof ProductsCategoriesCategoryIdRoute
@@ -693,6 +693,7 @@ export interface FileRouteTypes {
| '/$storeId/promotions/$promotionId'
| '/$storeId/promotions/gift-cards'
| '/$storeId/promotions/new'
+ | '/$storeId/sellers/$sellerId'
| '/$storeId/settings/allowed-origins'
| '/$storeId/settings/api-keys'
| '/$storeId/settings/channels'
@@ -710,14 +711,13 @@ export interface FileRouteTypes {
| '/$storeId/settings/store'
| '/$storeId/settings/tax-categories'
| '/$storeId/settings/tax-rates'
- | '/$storeId/vendors/$vendorId'
| '/$storeId/companies/'
| '/$storeId/customers/'
| '/$storeId/orders/'
| '/$storeId/products/'
| '/$storeId/promotions/'
+ | '/$storeId/sellers/'
| '/$storeId/settings/'
- | '/$storeId/vendors/'
| '/$storeId/companies/locations/$locationId'
| '/$storeId/orders/$orderId/edit'
| '/$storeId/products/categories/$categoryId'
@@ -763,6 +763,7 @@ export interface FileRouteTypes {
| '/$storeId/promotions/$promotionId'
| '/$storeId/promotions/gift-cards'
| '/$storeId/promotions/new'
+ | '/$storeId/sellers/$sellerId'
| '/$storeId/settings/allowed-origins'
| '/$storeId/settings/api-keys'
| '/$storeId/settings/channels'
@@ -780,14 +781,13 @@ export interface FileRouteTypes {
| '/$storeId/settings/store'
| '/$storeId/settings/tax-categories'
| '/$storeId/settings/tax-rates'
- | '/$storeId/vendors/$vendorId'
| '/$storeId/companies'
| '/$storeId/customers'
| '/$storeId/orders'
| '/$storeId/products'
| '/$storeId/promotions'
+ | '/$storeId/sellers'
| '/$storeId/settings'
- | '/$storeId/vendors'
| '/$storeId/companies/locations/$locationId'
| '/$storeId/orders/$orderId/edit'
| '/$storeId/products/categories/$categoryId'
@@ -836,6 +836,7 @@ export interface FileRouteTypes {
| '/_authenticated/$storeId/promotions/$promotionId'
| '/_authenticated/$storeId/promotions/gift-cards'
| '/_authenticated/$storeId/promotions/new'
+ | '/_authenticated/$storeId/sellers/$sellerId'
| '/_authenticated/$storeId/settings/allowed-origins'
| '/_authenticated/$storeId/settings/api-keys'
| '/_authenticated/$storeId/settings/channels'
@@ -853,14 +854,13 @@ export interface FileRouteTypes {
| '/_authenticated/$storeId/settings/store'
| '/_authenticated/$storeId/settings/tax-categories'
| '/_authenticated/$storeId/settings/tax-rates'
- | '/_authenticated/$storeId/vendors/$vendorId'
| '/_authenticated/$storeId/companies/'
| '/_authenticated/$storeId/customers/'
| '/_authenticated/$storeId/orders/'
| '/_authenticated/$storeId/products/'
| '/_authenticated/$storeId/promotions/'
+ | '/_authenticated/$storeId/sellers/'
| '/_authenticated/$storeId/settings/'
- | '/_authenticated/$storeId/vendors/'
| '/_authenticated/$storeId/companies/locations/$locationId'
| '/_authenticated/$storeId/orders/$orderId/edit'
| '/_authenticated/$storeId/products/categories/$categoryId'
@@ -998,13 +998,6 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof SplatRouteImport
parentRoute: typeof authenticatedStoreIdRoute
}
- '/_authenticated/$storeId/vendors/': {
- id: '/_authenticated/$storeId/vendors/'
- path: '/vendors'
- fullPath: '/$storeId/vendors/'
- preLoaderRoute: typeof VendorsIndexRouteImport
- parentRoute: typeof authenticatedStoreIdRoute
- }
'/_authenticated/$storeId/settings/': {
id: '/_authenticated/$storeId/settings/'
path: '/'
@@ -1012,6 +1005,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof SettingsIndexRouteImport
parentRoute: typeof SettingsRoute
}
+ '/_authenticated/$storeId/sellers/': {
+ id: '/_authenticated/$storeId/sellers/'
+ path: '/sellers'
+ fullPath: '/$storeId/sellers/'
+ preLoaderRoute: typeof SellersIndexRouteImport
+ parentRoute: typeof authenticatedStoreIdRoute
+ }
'/_authenticated/$storeId/promotions/': {
id: '/_authenticated/$storeId/promotions/'
path: '/promotions'
@@ -1047,13 +1047,6 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof CompaniesIndexRouteImport
parentRoute: typeof authenticatedStoreIdRoute
}
- '/_authenticated/$storeId/vendors/$vendorId': {
- id: '/_authenticated/$storeId/vendors/$vendorId'
- path: '/vendors/$vendorId'
- fullPath: '/$storeId/vendors/$vendorId'
- preLoaderRoute: typeof VendorsVendorIdRouteImport
- parentRoute: typeof authenticatedStoreIdRoute
- }
'/_authenticated/$storeId/settings/tax-rates': {
id: '/_authenticated/$storeId/settings/tax-rates'
path: '/tax-rates'
@@ -1173,6 +1166,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof SettingsAllowedOriginsRouteImport
parentRoute: typeof SettingsRoute
}
+ '/_authenticated/$storeId/sellers/$sellerId': {
+ id: '/_authenticated/$storeId/sellers/$sellerId'
+ path: '/sellers/$sellerId'
+ fullPath: '/$storeId/sellers/$sellerId'
+ preLoaderRoute: typeof SellersSellerIdRouteImport
+ parentRoute: typeof authenticatedStoreIdRoute
+ }
'/_authenticated/$storeId/promotions/new': {
id: '/_authenticated/$storeId/promotions/new'
path: '/promotions/new'
@@ -1477,13 +1477,13 @@ interface authenticatedStoreIdRouteChildren {
PromotionsPromotionIdRoute: typeof PromotionsPromotionIdRoute
PromotionsGiftCardsRoute: typeof PromotionsGiftCardsRoute
PromotionsNewRoute: typeof PromotionsNewRoute
- VendorsVendorIdRoute: typeof VendorsVendorIdRoute
+ SellersSellerIdRoute: typeof SellersSellerIdRoute
CompaniesIndexRoute: typeof CompaniesIndexRoute
CustomersIndexRoute: typeof CustomersIndexRoute
OrdersIndexRoute: typeof OrdersIndexRoute
ProductsIndexRoute: typeof ProductsIndexRoute
PromotionsIndexRoute: typeof PromotionsIndexRoute
- VendorsIndexRoute: typeof VendorsIndexRoute
+ SellersIndexRoute: typeof SellersIndexRoute
CompaniesLocationsDotlocationIdRoute: typeof CompaniesLocationsDotlocationIdRoute
OrdersOrderIdEditRoute: typeof OrdersOrderIdEditRoute
ProductsCategoriesCategoryIdRoute: typeof ProductsCategoriesCategoryIdRoute
@@ -1518,13 +1518,13 @@ const authenticatedStoreIdRouteChildren: authenticatedStoreIdRouteChildren = {
PromotionsPromotionIdRoute: PromotionsPromotionIdRoute,
PromotionsGiftCardsRoute: PromotionsGiftCardsRoute,
PromotionsNewRoute: PromotionsNewRoute,
- VendorsVendorIdRoute: VendorsVendorIdRoute,
+ SellersSellerIdRoute: SellersSellerIdRoute,
CompaniesIndexRoute: CompaniesIndexRoute,
CustomersIndexRoute: CustomersIndexRoute,
OrdersIndexRoute: OrdersIndexRoute,
ProductsIndexRoute: ProductsIndexRoute,
PromotionsIndexRoute: PromotionsIndexRoute,
- VendorsIndexRoute: VendorsIndexRoute,
+ SellersIndexRoute: SellersIndexRoute,
CompaniesLocationsDotlocationIdRoute: CompaniesLocationsDotlocationIdRoute,
OrdersOrderIdEditRoute: OrdersOrderIdEditRoute,
ProductsCategoriesCategoryIdRoute: ProductsCategoriesCategoryIdRoute,
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/vendors/$vendorId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/sellers/$sellerId.tsx
similarity index 70%
rename from packages/dashboard/src/routes/_authenticated/$storeId/vendors/$vendorId.tsx
rename to packages/dashboard/src/routes/_authenticated/$storeId/sellers/$sellerId.tsx
index 2e15031e2c..94e3731f92 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/vendors/$vendorId.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/sellers/$sellerId.tsx
@@ -1,5 +1,5 @@
import { zodResolver } from '@hookform/resolvers/zod'
-import type { Vendor } from '@spree/admin-sdk'
+import type { Seller } from '@spree/admin-sdk'
import {
mapSpreeErrorsToForm,
PageHeader,
@@ -55,73 +55,73 @@ import { Controller, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { ResourceImageField } from '../../../../components/spree/resource-image-field'
import {
- useApproveVendor,
- useDeleteVendor,
- useInviteVendor,
- useRejectVendor,
- useSuspendVendor,
- useUpdateVendor,
- useVendor,
-} from '../../../../hooks/use-vendors'
+ useApproveSeller,
+ useDeleteSeller,
+ useInviteSeller,
+ useRejectSeller,
+ useSeller,
+ useSuspendSeller,
+ useUpdateSeller,
+} from '../../../../hooks/use-sellers'
import {
PAYOUT_INTERVALS,
+ SELLER_DEFAULTS,
+ type SellerFormValues,
+ type SellerInviteValues,
+ sellerFormSchema,
+ sellerImageParams,
+ sellerInviteSchema,
+ sellerValuesToParams,
TAX_REMITTANCES,
- VENDOR_DEFAULTS,
- type VendorFormValues,
- type VendorInviteValues,
- vendorFormSchema,
- vendorImageParams,
- vendorInviteSchema,
- vendorValuesToParams,
-} from '../../../../schemas/vendor'
-
-export const Route = createFileRoute('/_authenticated/$storeId/vendors/$vendorId')({
- component: VendorDetailPage,
+} from '../../../../schemas/seller'
+
+export const Route = createFileRoute('/_authenticated/$storeId/sellers/$sellerId')({
+ component: SellerDetailPage,
})
-function VendorDetailPage() {
+function SellerDetailPage() {
const { t } = useTranslation()
- const { vendorId } = Route.useParams()
- const { data: vendor, isLoading, error, refetch } = useVendor(vendorId)
+ const { sellerId } = Route.useParams()
+ const { data: seller, isLoading, error, refetch } = useSeller(sellerId)
if (isLoading) return <p className="text-muted-foreground">{t('admin.common.loading')}</p>
- if (error || !vendor) {
+ if (error || !seller) {
return (
<ErrorState
- title={t('admin.vendors.detail.load_error')}
+ title={t('admin.sellers.detail.load_error')}
error={error as Error | undefined}
onRetry={() => refetch()}
/>
)
}
- return <VendorBody vendor={vendor} />
+ return <SellerBody seller={seller} />
}
/**
- * A vendor's page is something you read first. The lifecycle sits in the
+ * A seller's page is something you read first. The lifecycle sits in the
* header, the profile below it, and every editable section opens its own
* sheet — so arriving here shows you who the seller is rather than dropping
* you into a form.
*/
-function VendorBody({ vendor }: { vendor: Vendor }) {
+function SellerBody({ seller }: { seller: Seller }) {
const { t } = useTranslation()
const { storeId } = Route.useParams()
const navigate = useNavigate()
const { permissions } = usePermissions()
const confirm = useConfirm()
- const deleteMutation = useDeleteVendor()
+ const deleteMutation = useDeleteSeller()
const [editingProfile, setEditingProfile] = useState(false)
const [editingSettlement, setEditingSettlement] = useState(false)
const [inviting, setInviting] = useState(false)
- const approveMutation = useApproveVendor(vendor.id)
- const suspendMutation = useSuspendVendor(vendor.id)
- const rejectMutation = useRejectVendor(vendor.id)
+ const approveMutation = useApproveSeller(seller.id)
+ const suspendMutation = useSuspendSeller(seller.id)
+ const rejectMutation = useRejectSeller(seller.id)
- const canEdit = permissions.can('update', Subject.Vendor)
- const status = vendor.status
+ const canEdit = permissions.can('update', Subject.Seller)
+ const status = seller.status
// Mirrors the workflow guards, so the operator is never offered a move the
// server would refuse.
@@ -134,16 +134,16 @@ function VendorBody({ vendor }: { vendor: Vendor }) {
approveMutation.isPending || suspendMutation.isPending || rejectMutation.isPending || !canEdit
async function handleDelete() {
- await deleteMutation.mutateAsync(vendor.id)
- navigate({ to: '/$storeId/vendors', params: { storeId } })
+ await deleteMutation.mutateAsync(seller.id)
+ navigate({ to: '/$storeId/sellers', params: { storeId } })
}
async function handleSuspend() {
const ok = await confirm({
- title: t('admin.vendors.suspend_confirm.title'),
- message: t('admin.vendors.suspend_confirm.message', { name: vendor.name }),
+ title: t('admin.sellers.suspend_confirm.title'),
+ message: t('admin.sellers.suspend_confirm.message', { name: seller.name }),
variant: 'destructive',
- confirmLabel: t('admin.vendors.actions.suspend'),
+ confirmLabel: t('admin.sellers.actions.suspend'),
})
if (!ok) return
await suspendMutation.mutateAsync(undefined).catch(() => undefined)
@@ -151,10 +151,10 @@ function VendorBody({ vendor }: { vendor: Vendor }) {
async function handleReject() {
const ok = await confirm({
- title: t('admin.vendors.reject_confirm.title'),
- message: t('admin.vendors.reject_confirm.message', { name: vendor.name }),
+ title: t('admin.sellers.reject_confirm.title'),
+ message: t('admin.sellers.reject_confirm.message', { name: seller.name }),
variant: 'destructive',
- confirmLabel: t('admin.vendors.actions.reject'),
+ confirmLabel: t('admin.sellers.actions.reject'),
})
if (!ok) return
await rejectMutation.mutateAsync(undefined).catch(() => undefined)
@@ -174,8 +174,8 @@ function VendorBody({ vendor }: { vendor: Vendor }) {
onClick={() => approveMutation.mutateAsync().catch(() => undefined)}
>
{status === 'suspended'
- ? t('admin.vendors.actions.reinstate')
- : t('admin.vendors.actions.approve')}
+ ? t('admin.sellers.actions.reinstate')
+ : t('admin.sellers.actions.approve')}
</Button>
)}
{canInvite && (
@@ -187,8 +187,8 @@ function VendorBody({ vendor }: { vendor: Vendor }) {
>
<MailIcon className="size-4" />
{status === 'invited'
- ? t('admin.vendors.actions.reinvite')
- : t('admin.vendors.actions.invite')}
+ ? t('admin.sellers.actions.reinvite')
+ : t('admin.sellers.actions.invite')}
</Button>
)}
</>
@@ -199,13 +199,13 @@ function VendorBody({ vendor }: { vendor: Vendor }) {
{canSuspend && (
<DropdownMenuItem onClick={handleSuspend}>
<PauseIcon className="size-4" />
- {t('admin.vendors.actions.suspend')}
+ {t('admin.sellers.actions.suspend')}
</DropdownMenuItem>
)}
{canReject && (
<DropdownMenuItem onClick={handleReject}>
<BanIcon className="size-4" />
- {t('admin.vendors.actions.reject')}
+ {t('admin.sellers.actions.reject')}
</DropdownMenuItem>
)}
</>
@@ -216,49 +216,49 @@ function VendorBody({ vendor }: { vendor: Vendor }) {
<ResourceLayout
header={
<PageHeader
- title={vendor.name}
- subtitle={vendor.contact_email ?? undefined}
- backTo="vendors"
- badges={<StatusBadge status={status} label={t(`admin.vendors.status.${status}`)} />}
+ title={seller.name}
+ subtitle={seller.contact_email ?? undefined}
+ backTo="sellers"
+ badges={<StatusBadge status={status} label={t(`admin.sellers.status.${status}`)} />}
actions={primaryAction}
dropdownItems={dropdownItems}
- resource={{ id: vendor.id }}
- onDelete={permissions.can('destroy', Subject.Vendor) ? handleDelete : undefined}
- deleteLabel={t('admin.vendors.detail.delete_label')}
+ resource={{ id: seller.id }}
+ onDelete={permissions.can('destroy', Subject.Seller) ? handleDelete : undefined}
+ deleteLabel={t('admin.sellers.detail.delete_label')}
/>
}
main={
<>
- <VendorBrandCard
- vendor={vendor}
+ <SellerBrandCard
+ seller={seller}
canEdit={canEdit}
onEdit={() => setEditingProfile(true)}
/>
- <Slot name="vendor.form_main" context={{ vendor, canEdit }} />
+ <Slot name="seller.form_main" context={{ seller, canEdit }} />
</>
}
sidebar={
<>
- <VendorStatusCard vendor={vendor} />
- <VendorAtAGlanceCard vendor={vendor} />
- <VendorContactCard vendor={vendor} />
- <VendorSettlementCard
- vendor={vendor}
+ <SellerStatusCard seller={seller} />
+ <SellerAtAGlanceCard seller={seller} />
+ <SellerContactCard seller={seller} />
+ <SellerSettlementCard
+ seller={seller}
canEdit={canEdit}
onEdit={() => setEditingSettlement(true)}
/>
- <Slot name="vendor.form_sidebar" context={{ vendor, canEdit }} />
+ <Slot name="seller.form_sidebar" context={{ seller, canEdit }} />
</>
}
/>
- <EditProfileSheet vendor={vendor} open={editingProfile} onOpenChange={setEditingProfile} />
+ <EditProfileSheet seller={seller} open={editingProfile} onOpenChange={setEditingProfile} />
<EditSettlementSheet
- vendor={vendor}
+ seller={seller}
open={editingSettlement}
onOpenChange={setEditingSettlement}
/>
- {inviting && <InviteVendorSheet vendor={vendor} open onOpenChange={setInviting} />}
+ {inviting && <InviteSellerSheet seller={seller} open onOpenChange={setInviting} />}
</>
)
}
@@ -271,7 +271,7 @@ function ReadRow({ label, children }: { label: string; children: ReactNode }) {
<span className="text-muted-foreground">{label}</span>
<span className="text-right">
{children ?? (
- <span className="text-muted-foreground">{t('admin.vendors.not_provided')}</span>
+ <span className="text-muted-foreground">{t('admin.sellers.not_provided')}</span>
)}
</span>
</div>
@@ -279,12 +279,12 @@ function ReadRow({ label, children }: { label: string; children: ReactNode }) {
}
/** Cover photo, logo and the seller's own description — the storefront face. */
-function VendorBrandCard({
- vendor,
+function SellerBrandCard({
+ seller,
canEdit,
onEdit,
}: {
- vendor: Vendor
+ seller: Seller
canEdit: boolean
onEdit: () => void
}) {
@@ -292,13 +292,13 @@ function VendorBrandCard({
return (
<Card className="overflow-hidden">
- {/* A vendor with no cover gets a slim band rather than a tall empty
+ {/* A seller with no cover gets a slim band rather than a tall empty
block. It uses --accent rather than --muted: muted is a deliberate
"whisper" against white, which over a region this size disappears
entirely and leaves the logo looking unanchored. */}
<div className="relative">
- {vendor.cover_photo_url ? (
- <img src={vendor.cover_photo_url} alt="" className="h-40 w-full bg-accent object-cover" />
+ {seller.cover_photo_url ? (
+ <img src={seller.cover_photo_url} alt="" className="h-40 w-full bg-accent object-cover" />
) : (
<div className="h-20 w-full border-border border-b bg-accent" />
)}
@@ -320,10 +320,10 @@ function VendorBrandCard({
outside it, which over the band reads as a halo. */}
<div className="-mt-10 relative z-10 flex size-20 items-center justify-center overflow-hidden rounded-xl border border-border bg-card shadow-sm">
{/* The square logo is the one cropped for a tile like this; the main
- logo is the fallback, since a vendor may have set only one. */}
- {vendor.square_logo_url || vendor.logo_url ? (
+ logo is the fallback, since a seller may have set only one. */}
+ {seller.square_logo_url || seller.logo_url ? (
<img
- src={vendor.square_logo_url ?? vendor.logo_url ?? undefined}
+ src={seller.square_logo_url ?? seller.logo_url ?? undefined}
alt=""
className="size-full object-cover"
/>
@@ -334,44 +334,44 @@ function VendorBrandCard({
{/* The name already sits in the page header; repeating it here would
just be the same words twice. The handle is what the header lacks. */}
- <p className="text-muted-foreground text-sm">/{vendor.slug}</p>
+ <p className="text-muted-foreground text-sm">/{seller.slug}</p>
- {vendor.about_html ? (
+ {seller.about_html ? (
// Server-sanitized on every write path (Spree::RichTextSanitizer),
// which is what makes rendering it here safe.
<div
className="prose prose-sm max-w-none dark:prose-invert"
// biome-ignore lint/security/noDangerouslySetInnerHtml: sanitized server-side
- dangerouslySetInnerHTML={{ __html: vendor.about_html }}
+ dangerouslySetInnerHTML={{ __html: seller.about_html }}
/>
) : (
- <p className="text-muted-foreground text-sm">{t('admin.vendors.detail.no_about')}</p>
+ <p className="text-muted-foreground text-sm">{t('admin.sellers.detail.no_about')}</p>
)}
</CardContent>
</Card>
)
}
-/** Where the vendor is, and what that means in plain words. */
-function VendorStatusCard({ vendor }: { vendor: Vendor }) {
+/** Where the seller is, and what that means in plain words. */
+function SellerStatusCard({ seller }: { seller: Seller }) {
const { t } = useTranslation()
return (
<Card>
<CardHeader>
- <CardTitle>{t('admin.vendors.detail.status')}</CardTitle>
+ <CardTitle>{t('admin.sellers.detail.status')}</CardTitle>
<CardAction>
- <StatusBadge status={vendor.status} label={t(`admin.vendors.status.${vendor.status}`)} />
+ <StatusBadge status={seller.status} label={t(`admin.sellers.status.${seller.status}`)} />
</CardAction>
</CardHeader>
<CardContent className="flex flex-col gap-2">
<p className="text-muted-foreground text-sm">
- {t(`admin.vendors.status_help.${vendor.status}`, {
- defaultValue: t('admin.vendors.status_help.pending'),
+ {t(`admin.sellers.status_help.${seller.status}`, {
+ defaultValue: t('admin.sellers.status_help.pending'),
})}
</p>
- {vendor.on_holiday && (
- <p className="text-muted-foreground text-sm">{t('admin.vendors.on_holiday_notice')}</p>
+ {seller.on_holiday && (
+ <p className="text-muted-foreground text-sm">{t('admin.sellers.on_holiday_notice')}</p>
)}
</CardContent>
</Card>
@@ -379,54 +379,54 @@ function VendorStatusCard({ vendor }: { vendor: Vendor }) {
}
/** The counts an operator scans for before opening anything else. */
-function VendorAtAGlanceCard({ vendor }: { vendor: Vendor }) {
+function SellerAtAGlanceCard({ seller }: { seller: Seller }) {
const { t } = useTranslation()
return (
<Card>
<CardHeader>
- <CardTitle>{t('admin.vendors.detail.at_a_glance')}</CardTitle>
+ <CardTitle>{t('admin.sellers.detail.at_a_glance')}</CardTitle>
</CardHeader>
<CardContent className="flex flex-col gap-3">
<div className="flex items-center justify-between text-sm">
<span className="flex items-center gap-2 text-muted-foreground">
<PackageIcon className="size-4" />
- {t('admin.vendors.products_column')}
+ {t('admin.sellers.products_column')}
</span>
- <span>{vendor.products_count}</span>
+ <span>{seller.products_count}</span>
</div>
<div className="flex items-center justify-between text-sm">
<span className="flex items-center gap-2 text-muted-foreground">
<UsersIcon className="size-4" />
- {t('admin.vendors.team_column')}
+ {t('admin.sellers.team_column')}
</span>
- <span>{vendor.users_count}</span>
+ <span>{seller.users_count}</span>
</div>
<ReadRow label={t('admin.fields.created_at.label')}>
- <RelativeTime iso={vendor.created_at} />
+ <RelativeTime iso={seller.created_at} />
</ReadRow>
</CardContent>
</Card>
)
}
-function VendorContactCard({ vendor }: { vendor: Vendor }) {
+function SellerContactCard({ seller }: { seller: Seller }) {
const { t } = useTranslation()
return (
<Card>
<CardHeader>
- <CardTitle>{t('admin.vendors.detail.contact')}</CardTitle>
+ <CardTitle>{t('admin.sellers.detail.contact')}</CardTitle>
</CardHeader>
<CardContent className="flex flex-col gap-3">
<ReadRow label={t('admin.fields.contact_email.label')}>
- {vendor.contact_email ? (
- <a href={`mailto:${vendor.contact_email}`}>{vendor.contact_email}</a>
+ {seller.contact_email ? (
+ <a href={`mailto:${seller.contact_email}`}>{seller.contact_email}</a>
) : null}
</ReadRow>
- <ReadRow label={t('admin.fields.vendor.billing_email.label')}>
- {vendor.billing_email ? (
- <a href={`mailto:${vendor.billing_email}`}>{vendor.billing_email}</a>
+ <ReadRow label={t('admin.fields.seller.billing_email.label')}>
+ {seller.billing_email ? (
+ <a href={`mailto:${seller.billing_email}`}>{seller.billing_email}</a>
) : null}
</ReadRow>
</CardContent>
@@ -434,13 +434,13 @@ function VendorContactCard({ vendor }: { vendor: Vendor }) {
)
}
-/** Operator-only: how and when this vendor gets paid, and who remits tax. */
-function VendorSettlementCard({
- vendor,
+/** Operator-only: how and when this seller gets paid, and who remits tax. */
+function SellerSettlementCard({
+ seller,
canEdit,
onEdit,
}: {
- vendor: Vendor
+ seller: Seller
canEdit: boolean
onEdit: () => void
}) {
@@ -449,7 +449,7 @@ function VendorSettlementCard({
return (
<Card>
<CardHeader>
- <CardTitle>{t('admin.vendors.detail.settlement')}</CardTitle>
+ <CardTitle>{t('admin.sellers.detail.settlement')}</CardTitle>
{canEdit && (
<CardAction>
<Button size="sm" variant="outline" onClick={onEdit}>
@@ -460,44 +460,44 @@ function VendorSettlementCard({
)}
</CardHeader>
<CardContent className="flex flex-col gap-3">
- <ReadRow label={t('admin.fields.vendor.tax_remittance.label')}>
- {t(`admin.vendors.tax_remittance.${vendor.tax_remittance}`, {
- defaultValue: vendor.tax_remittance,
+ <ReadRow label={t('admin.fields.seller.tax_remittance.label')}>
+ {t(`admin.sellers.tax_remittance.${seller.tax_remittance}`, {
+ defaultValue: seller.tax_remittance,
})}
</ReadRow>
- <ReadRow label={t('admin.fields.vendor.payouts_schedule_interval.label')}>
- {vendor.payouts_schedule_interval
- ? t(`admin.vendors.payout_interval.${vendor.payouts_schedule_interval}`)
- : t('admin.vendors.payout_interval.inherit')}
+ <ReadRow label={t('admin.fields.seller.payouts_schedule_interval.label')}>
+ {seller.payouts_schedule_interval
+ ? t(`admin.sellers.payout_interval.${seller.payouts_schedule_interval}`)
+ : t('admin.sellers.payout_interval.inherit')}
</ReadRow>
- <ReadRow label={t('admin.fields.vendor.minimum_payout_amount.label')}>
- {vendor.minimum_payout_amount}
+ <ReadRow label={t('admin.fields.seller.minimum_payout_amount.label')}>
+ {seller.minimum_payout_amount}
</ReadRow>
- <ReadRow label={t('admin.fields.vendor.holiday_mode_until.label')}>
- {vendor.holiday_mode_until ? <RelativeTime iso={vendor.holiday_mode_until} /> : null}
+ <ReadRow label={t('admin.fields.seller.holiday_mode_until.label')}>
+ {seller.holiday_mode_until ? <RelativeTime iso={seller.holiday_mode_until} /> : null}
</ReadRow>
</CardContent>
</Card>
)
}
-/** The profile the vendor also maintains from their own panel. */
+/** The profile the seller also maintains from their own panel. */
function EditProfileSheet({
- vendor,
+ seller,
open,
onOpenChange,
}: {
- vendor: Vendor
+ seller: Seller
open: boolean
onOpenChange: (open: boolean) => void
}) {
const { t } = useTranslation()
- const updateMutation = useUpdateVendor(vendor.id)
+ const updateMutation = useUpdateSeller(seller.id)
- const form = useForm<VendorFormValues>({
+ const form = useForm<SellerFormValues>({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
- resolver: zodResolver(vendorFormSchema) as any,
- defaultValues: VENDOR_DEFAULTS,
+ resolver: zodResolver(sellerFormSchema) as any,
+ defaultValues: SELLER_DEFAULTS,
})
// The sheet stays mounted across opens, so re-seed from the latest record
@@ -509,22 +509,22 @@ function EditProfileSheet({
// field as `serverUrl`, and the triple only carries what the operator
// changes this time round.
form.reset({
- ...VENDOR_DEFAULTS,
- name: vendor.name,
- slug: vendor.slug,
- contact_email: vendor.contact_email ?? '',
- billing_email: vendor.billing_email ?? '',
- about: vendor.about_html ?? '',
+ ...SELLER_DEFAULTS,
+ name: seller.name,
+ slug: seller.slug,
+ contact_email: seller.contact_email ?? '',
+ billing_email: seller.billing_email ?? '',
+ about: seller.about_html ?? '',
})
- }, [open, vendor, form])
+ }, [open, seller, form])
- async function onSubmit(values: VendorFormValues) {
+ async function onSubmit(values: SellerFormValues) {
try {
// Only this sheet's own fields — the settlement sheet owns the rest, and
// sending them here would post this form's untouched defaults over them.
- const params = vendorValuesToParams(values)
+ const params = sellerValuesToParams(values)
await updateMutation.mutateAsync({
- ...vendorImageParams(values),
+ ...sellerImageParams(values),
name: params.name,
slug: params.slug,
contact_email: params.contact_email,
@@ -543,8 +543,8 @@ function EditProfileSheet({
<Sheet open={open} onOpenChange={onOpenChange}>
<SheetContent>
<SheetHeader>
- <SheetTitle>{t('admin.vendors.detail.edit_profile')}</SheetTitle>
- <SheetDescription>{t('admin.vendors.detail.edit_profile_description')}</SheetDescription>
+ <SheetTitle>{t('admin.sellers.detail.edit_profile')}</SheetTitle>
+ <SheetDescription>{t('admin.sellers.detail.edit_profile_description')}</SheetDescription>
</SheetHeader>
<form
onSubmit={(event) => {
@@ -563,34 +563,34 @@ function EditProfileSheet({
<ResourceImageField
form={form}
kind="logo"
- serverUrl={vendor.logo_url}
+ serverUrl={seller.logo_url}
square
- translationNamespace="admin.vendors"
+ translationNamespace="admin.sellers"
labelKey="logo_label"
helpKey="logo_help"
/>
<ResourceImageField
form={form}
kind="square_logo"
- serverUrl={vendor.square_logo_url}
+ serverUrl={seller.square_logo_url}
square
- translationNamespace="admin.vendors"
+ translationNamespace="admin.sellers"
labelKey="square_logo_label"
helpKey="square_logo_help"
/>
<ResourceImageField
form={form}
kind="cover_photo"
- serverUrl={vendor.cover_photo_url}
- translationNamespace="admin.vendors"
+ serverUrl={seller.cover_photo_url}
+ translationNamespace="admin.sellers"
labelKey="cover_photo_label"
helpKey="cover_photo_help"
/>
<Field>
- <FieldLabel htmlFor="vendor-name">{t('admin.fields.name.label')}</FieldLabel>
+ <FieldLabel htmlFor="seller-name">{t('admin.fields.name.label')}</FieldLabel>
<Input
- id="vendor-name"
+ id="seller-name"
aria-invalid={!!errors.name || undefined}
{...form.register('name')}
/>
@@ -598,61 +598,61 @@ function EditProfileSheet({
</Field>
<Field>
- <FieldLabel htmlFor="vendor-slug">{t('admin.fields.slug.label')}</FieldLabel>
+ <FieldLabel htmlFor="seller-slug">{t('admin.fields.slug.label')}</FieldLabel>
<Input
- id="vendor-slug"
+ id="seller-slug"
aria-invalid={!!errors.slug || undefined}
{...form.register('slug')}
/>
- <FieldDescription>{t('admin.fields.vendor.slug.help')}</FieldDescription>
+ <FieldDescription>{t('admin.fields.seller.slug.help')}</FieldDescription>
<FieldError errors={[errors.slug]} />
</Field>
<Field>
- <FieldLabel htmlFor="vendor-contact-email">
+ <FieldLabel htmlFor="seller-contact-email">
{t('admin.fields.contact_email.label')}
</FieldLabel>
<Input
- id="vendor-contact-email"
+ id="seller-contact-email"
type="email"
aria-invalid={!!errors.contact_email || undefined}
{...form.register('contact_email')}
/>
- <FieldDescription>{t('admin.fields.vendor.contact_email.help')}</FieldDescription>
+ <FieldDescription>{t('admin.fields.seller.contact_email.help')}</FieldDescription>
<FieldError errors={[errors.contact_email]} />
</Field>
<Field>
- <FieldLabel htmlFor="vendor-billing-email">
- {t('admin.fields.vendor.billing_email.label')}
+ <FieldLabel htmlFor="seller-billing-email">
+ {t('admin.fields.seller.billing_email.label')}
</FieldLabel>
<Input
- id="vendor-billing-email"
+ id="seller-billing-email"
type="email"
aria-invalid={!!errors.billing_email || undefined}
{...form.register('billing_email')}
/>
- <FieldDescription>{t('admin.fields.vendor.billing_email.help')}</FieldDescription>
+ <FieldDescription>{t('admin.fields.seller.billing_email.help')}</FieldDescription>
<FieldError errors={[errors.billing_email]} />
</Field>
<Field>
- <FieldLabel htmlFor="vendor-about">
- {t('admin.fields.vendor.about.label')}
+ <FieldLabel htmlFor="seller-about">
+ {t('admin.fields.seller.about.label')}
</FieldLabel>
<Controller
control={form.control}
name="about"
render={({ field }) => (
<RichTextEditor
- id="vendor-about"
- ariaLabel={t('admin.fields.vendor.about.label')}
+ id="seller-about"
+ ariaLabel={t('admin.fields.seller.about.label')}
value={field.value ?? ''}
onChange={field.onChange}
/>
)}
/>
- <FieldDescription>{t('admin.fields.vendor.about.help')}</FieldDescription>
+ <FieldDescription>{t('admin.fields.seller.about.help')}</FieldDescription>
</Field>
</FieldGroup>
</div>
@@ -677,42 +677,42 @@ function EditProfileSheet({
}
function EditSettlementSheet({
- vendor,
+ seller,
open,
onOpenChange,
}: {
- vendor: Vendor
+ seller: Seller
open: boolean
onOpenChange: (open: boolean) => void
}) {
const { t } = useTranslation()
- const updateMutation = useUpdateVendor(vendor.id)
+ const updateMutation = useUpdateSeller(seller.id)
- const form = useForm<VendorFormValues>({
+ const form = useForm<SellerFormValues>({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
- resolver: zodResolver(vendorFormSchema) as any,
- defaultValues: VENDOR_DEFAULTS,
+ resolver: zodResolver(sellerFormSchema) as any,
+ defaultValues: SELLER_DEFAULTS,
})
useEffect(() => {
if (!open) return
form.reset({
- ...VENDOR_DEFAULTS,
+ ...SELLER_DEFAULTS,
// Carried so the schema's required `name` still validates; the submit
// below sends only this sheet's own fields.
- name: vendor.name,
- tax_remittance: (vendor.tax_remittance ?? 'vendor') as VendorFormValues['tax_remittance'],
- payouts_schedule_interval: (vendor.payouts_schedule_interval ??
- '') as VendorFormValues['payouts_schedule_interval'],
- minimum_payout_amount: vendor.minimum_payout_amount ?? '',
- holiday_mode_until: vendor.holiday_mode_until ?? '',
+ name: seller.name,
+ tax_remittance: (seller.tax_remittance ?? 'seller') as SellerFormValues['tax_remittance'],
+ payouts_schedule_interval: (seller.payouts_schedule_interval ??
+ '') as SellerFormValues['payouts_schedule_interval'],
+ minimum_payout_amount: seller.minimum_payout_amount ?? '',
+ holiday_mode_until: seller.holiday_mode_until ?? '',
})
- }, [open, vendor, form])
+ }, [open, seller, form])
- async function onSubmit(values: VendorFormValues) {
+ async function onSubmit(values: SellerFormValues) {
try {
- const params = vendorValuesToParams(values)
+ const params = sellerValuesToParams(values)
await updateMutation.mutateAsync({
tax_remittance: params.tax_remittance,
payouts_schedule_interval: params.payouts_schedule_interval,
@@ -729,13 +729,13 @@ function EditSettlementSheet({
const remittanceOptions = TAX_REMITTANCES.map((value) => ({
value,
- label: t(`admin.vendors.tax_remittance.${value}`),
+ label: t(`admin.sellers.tax_remittance.${value}`),
}))
const intervalOptions = [
- { value: '', label: t('admin.vendors.payout_interval.inherit') },
+ { value: '', label: t('admin.sellers.payout_interval.inherit') },
...PAYOUT_INTERVALS.map((value) => ({
value,
- label: t(`admin.vendors.payout_interval.${value}`),
+ label: t(`admin.sellers.payout_interval.${value}`),
})),
]
@@ -743,9 +743,9 @@ function EditSettlementSheet({
<Sheet open={open} onOpenChange={onOpenChange}>
<SheetContent>
<SheetHeader>
- <SheetTitle>{t('admin.vendors.detail.edit_settlement')}</SheetTitle>
+ <SheetTitle>{t('admin.sellers.detail.edit_settlement')}</SheetTitle>
<SheetDescription>
- {t('admin.vendors.detail.edit_settlement_description')}
+ {t('admin.sellers.detail.edit_settlement_description')}
</SheetDescription>
</SheetHeader>
<form
@@ -765,7 +765,7 @@ function EditSettlementSheet({
<Field>
<FieldLabel htmlFor="tax_remittance">
- {t('admin.fields.vendor.tax_remittance.label')}
+ {t('admin.fields.seller.tax_remittance.label')}
</FieldLabel>
<Controller
name="tax_remittance"
@@ -773,7 +773,7 @@ function EditSettlementSheet({
render={({ field }) => (
<Select
items={remittanceOptions}
- value={field.value ?? 'vendor'}
+ value={field.value ?? 'seller'}
onValueChange={field.onChange}
>
<SelectTrigger id="tax_remittance" className="w-full">
@@ -789,12 +789,12 @@ function EditSettlementSheet({
</Select>
)}
/>
- <FieldDescription>{t('admin.fields.vendor.tax_remittance.help')}</FieldDescription>
+ <FieldDescription>{t('admin.fields.seller.tax_remittance.help')}</FieldDescription>
</Field>
<Field>
<FieldLabel htmlFor="payouts_schedule_interval">
- {t('admin.fields.vendor.payouts_schedule_interval.label')}
+ {t('admin.fields.seller.payouts_schedule_interval.label')}
</FieldLabel>
<Controller
name="payouts_schedule_interval"
@@ -819,13 +819,13 @@ function EditSettlementSheet({
)}
/>
<FieldDescription>
- {t('admin.fields.vendor.payouts_schedule_interval.help')}
+ {t('admin.fields.seller.payouts_schedule_interval.help')}
</FieldDescription>
</Field>
<Field>
<FieldLabel htmlFor="minimum_payout_amount">
- {t('admin.fields.vendor.minimum_payout_amount.label')}
+ {t('admin.fields.seller.minimum_payout_amount.label')}
</FieldLabel>
<Input
id="minimum_payout_amount"
@@ -834,13 +834,13 @@ function EditSettlementSheet({
{...form.register('minimum_payout_amount')}
/>
<FieldDescription>
- {t('admin.fields.vendor.minimum_payout_amount.help')}
+ {t('admin.fields.seller.minimum_payout_amount.help')}
</FieldDescription>
<FieldError errors={[errors.minimum_payout_amount]} />
</Field>
<Field>
- <FieldLabel>{t('admin.fields.vendor.holiday_mode_until.label')}</FieldLabel>
+ <FieldLabel>{t('admin.fields.seller.holiday_mode_until.label')}</FieldLabel>
<Controller
name="holiday_mode_until"
control={form.control}
@@ -848,14 +848,14 @@ function EditSettlementSheet({
<StoreDatePicker
value={field.value || null}
onChange={(next) => field.onChange(next ?? '')}
- placeholder={t('admin.fields.vendor.holiday_mode_until.placeholder')}
+ placeholder={t('admin.fields.seller.holiday_mode_until.placeholder')}
includeTime
inline
/>
)}
/>
<FieldDescription>
- {t('admin.fields.vendor.holiday_mode_until.help')}
+ {t('admin.fields.seller.holiday_mode_until.help')}
</FieldDescription>
</Field>
</FieldGroup>
@@ -880,24 +880,24 @@ function EditSettlementSheet({
)
}
-function InviteVendorSheet({
- vendor,
+function InviteSellerSheet({
+ seller,
open,
onOpenChange,
}: {
- vendor: Vendor
+ seller: Seller
open: boolean
onOpenChange: (open: boolean) => void
}) {
const { t } = useTranslation()
- const inviteMutation = useInviteVendor(vendor.id)
- const form = useForm<VendorInviteValues>({
+ const inviteMutation = useInviteSeller(seller.id)
+ const form = useForm<SellerInviteValues>({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
- resolver: zodResolver(vendorInviteSchema) as any,
- defaultValues: { email: vendor.contact_email ?? '' },
+ resolver: zodResolver(sellerInviteSchema) as any,
+ defaultValues: { email: seller.contact_email ?? '' },
})
- async function onSubmit(values: VendorInviteValues) {
+ async function onSubmit(values: SellerInviteValues) {
try {
await inviteMutation.mutateAsync(values)
onOpenChange(false)
@@ -912,8 +912,8 @@ function InviteVendorSheet({
<Sheet open={open} onOpenChange={onOpenChange}>
<SheetContent>
<SheetHeader>
- <SheetTitle>{t('admin.vendors.invite_sheet.title')}</SheetTitle>
- <SheetDescription>{t('admin.vendors.invite_sheet.description')}</SheetDescription>
+ <SheetTitle>{t('admin.sellers.invite_sheet.title')}</SheetTitle>
+ <SheetDescription>{t('admin.sellers.invite_sheet.description')}</SheetDescription>
</SheetHeader>
<form
onSubmit={(event) => {
@@ -940,7 +940,7 @@ function InviteVendorSheet({
aria-invalid={!!errors.email || undefined}
{...form.register('email')}
/>
- <FieldDescription>{t('admin.vendors.invite_sheet.email_help')}</FieldDescription>
+ <FieldDescription>{t('admin.sellers.invite_sheet.email_help')}</FieldDescription>
<FieldError errors={[errors.email]} />
</Field>
</FieldGroup>
@@ -958,7 +958,7 @@ function InviteVendorSheet({
<Button type="submit" size="sm" disabled={form.formState.isSubmitting}>
{form.formState.isSubmitting
? t('admin.actions.saving')
- : t('admin.vendors.actions.send_invitation')}
+ : t('admin.sellers.actions.send_invitation')}
</Button>
</SheetFooter>
</form>
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/vendors/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/sellers/index.tsx
similarity index 67%
rename from packages/dashboard/src/routes/_authenticated/$storeId/vendors/index.tsx
rename to packages/dashboard/src/routes/_authenticated/$storeId/sellers/index.tsx
index 5eabcdc6d3..547b78db4f 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/vendors/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/sellers/index.tsx
@@ -1,5 +1,5 @@
import { zodResolver } from '@hookform/resolvers/zod'
-import type { Vendor } from '@spree/admin-sdk'
+import type { Seller } from '@spree/admin-sdk'
import {
adminClient,
Can,
@@ -31,31 +31,31 @@ import { PlusIcon } from 'lucide-react'
import { useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { z } from 'zod/v4'
-import { useCreateVendor, useDeleteVendor } from '../../../../hooks/use-vendors'
+import { useCreateSeller, useDeleteSeller } from '../../../../hooks/use-sellers'
import {
- VENDOR_DEFAULTS,
- type VendorFormValues,
- vendorFormSchema,
- vendorValuesToParams,
-} from '../../../../schemas/vendor'
-import '../../../../tables/vendors'
+ SELLER_DEFAULTS,
+ type SellerFormValues,
+ sellerFormSchema,
+ sellerValuesToParams,
+} from '../../../../schemas/seller'
+import '../../../../tables/sellers'
-const vendorsSearchSchema = resourceSearchSchema.extend({
+const sellersSearchSchema = resourceSearchSchema.extend({
new: z.coerce.boolean().optional(),
})
-export const Route = createFileRoute('/_authenticated/$storeId/vendors/')({
- validateSearch: vendorsSearchSchema,
- component: VendorsPage,
+export const Route = createFileRoute('/_authenticated/$storeId/sellers/')({
+ validateSearch: sellersSearchSchema,
+ component: SellersPage,
})
-function VendorsPage() {
+function SellersPage() {
const { t } = useTranslation()
- const search = Route.useSearch() as z.infer<typeof vendorsSearchSchema>
+ const search = Route.useSearch() as z.infer<typeof sellersSearchSchema>
const { storeId } = Route.useParams()
const navigate = useNavigate()
const confirm = useConfirm()
- const deleteMutation = useDeleteVendor()
+ const deleteMutation = useDeleteSeller()
const { permissions } = usePermissions()
const isCreating = !!search.new
@@ -71,61 +71,61 @@ function VendorsPage() {
const openCreate = () =>
navigate({ search: (prev: Record<string, unknown>) => ({ ...prev, new: true }) as never })
- async function handleDelete(vendor: Vendor) {
+ async function handleDelete(seller: Seller) {
const ok = await confirm({
- title: t('admin.vendors.delete_confirm.title'),
- message: t('admin.vendors.delete_confirm.message', { name: vendor.name }),
+ title: t('admin.sellers.delete_confirm.title'),
+ message: t('admin.sellers.delete_confirm.message', { name: seller.name }),
variant: 'destructive',
confirmLabel: t('admin.actions.delete'),
})
if (!ok) return
- await deleteMutation.mutateAsync(vendor.id).catch(() => undefined)
+ await deleteMutation.mutateAsync(seller.id).catch(() => undefined)
}
return (
<>
- <ResourceTable<Vendor>
- tableKey="vendors"
- queryKey="vendors"
- queryFn={(params) => adminClient.vendors.list(params)}
+ <ResourceTable<Seller>
+ tableKey="sellers"
+ queryKey="sellers"
+ queryFn={(params) => adminClient.sellers.list(params)}
searchParams={search}
- rowActions={(vendor) => (
+ rowActions={(seller) => (
<RowActions
actions={[
{
key: 'edit',
onSelect: () =>
navigate({
- to: '/$storeId/vendors/$vendorId',
- params: { storeId, vendorId: vendor.id },
+ to: '/$storeId/sellers/$sellerId',
+ params: { storeId, sellerId: seller.id },
}),
},
{
key: 'delete',
destructive: true,
- visible: permissions.can('destroy', Subject.Vendor),
+ visible: permissions.can('destroy', Subject.Seller),
disabled: deleteMutation.isPending,
- onSelect: () => handleDelete(vendor),
+ onSelect: () => handleDelete(seller),
},
]}
/>
)}
actions={
- <Can I="create" a={Subject.Vendor}>
+ <Can I="create" a={Subject.Seller}>
<Button size="sm" className="h-[2.125rem]" onClick={openCreate}>
<PlusIcon className="size-4" />
- {t('admin.vendors.add_cta')}
+ {t('admin.sellers.add_cta')}
</Button>
</Can>
}
/>
- {isCreating && <CreateVendorSheet open onOpenChange={(o) => !o && closeSheet()} />}
+ {isCreating && <CreateSellerSheet open onOpenChange={(o) => !o && closeSheet()} />}
</>
)
}
-function CreateVendorSheet({
+function CreateSellerSheet({
open,
onOpenChange,
}: {
@@ -135,24 +135,24 @@ function CreateVendorSheet({
const { t } = useTranslation()
const { storeId } = Route.useParams()
const navigate = useNavigate()
- const createMutation = useCreateVendor()
- const form = useForm<VendorFormValues>({
+ const createMutation = useCreateSeller()
+ const form = useForm<SellerFormValues>({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
- resolver: zodResolver(vendorFormSchema) as any,
- defaultValues: VENDOR_DEFAULTS,
+ resolver: zodResolver(sellerFormSchema) as any,
+ defaultValues: SELLER_DEFAULTS,
})
- // A new vendor has no team, no catalog and no settlement setup yet, and all
+ // A new seller has no team, no catalog and no settlement setup yet, and all
// of that lives on the detail page — so that is where the operator is
// headed, most immediately to send the invitation.
- async function onSubmit(values: VendorFormValues) {
+ async function onSubmit(values: SellerFormValues) {
try {
- const vendor = await createMutation.mutateAsync(vendorValuesToParams(values))
- form.reset(VENDOR_DEFAULTS)
+ const seller = await createMutation.mutateAsync(sellerValuesToParams(values))
+ form.reset(SELLER_DEFAULTS)
onOpenChange(false)
navigate({
- to: '/$storeId/vendors/$vendorId',
- params: { storeId, vendorId: vendor.id },
+ to: '/$storeId/sellers/$sellerId',
+ params: { storeId, sellerId: seller.id },
})
} catch (err) {
if (!mapSpreeErrorsToForm(err, form.setError)) throw err
@@ -165,14 +165,14 @@ function CreateVendorSheet({
<Sheet
open={open}
onOpenChange={(next) => {
- if (!next) form.reset(VENDOR_DEFAULTS)
+ if (!next) form.reset(SELLER_DEFAULTS)
onOpenChange(next)
}}
>
<SheetContent>
<SheetHeader>
- <SheetTitle>{t('admin.vendors.add_sheet_title')}</SheetTitle>
- <SheetDescription>{t('admin.vendors.create_description')}</SheetDescription>
+ <SheetTitle>{t('admin.sellers.add_sheet_title')}</SheetTitle>
+ <SheetDescription>{t('admin.sellers.create_description')}</SheetDescription>
</SheetHeader>
<form onSubmit={form.handleSubmit(onSubmit)} className="flex min-h-0 flex-1 flex-col">
<div className="flex flex-1 flex-col gap-4 overflow-y-auto p-4">
@@ -187,7 +187,7 @@ function CreateVendorSheet({
<Input
id="name"
autoFocus
- placeholder={t('admin.fields.vendor.name.placeholder')}
+ placeholder={t('admin.fields.seller.name.placeholder')}
aria-invalid={!!errors.name || undefined}
{...form.register('name')}
/>
@@ -201,11 +201,11 @@ function CreateVendorSheet({
<Input
id="contact_email"
type="email"
- placeholder={t('admin.fields.vendor.contact_email.placeholder')}
+ placeholder={t('admin.fields.seller.contact_email.placeholder')}
aria-invalid={!!errors.contact_email || undefined}
{...form.register('contact_email')}
/>
- <FieldDescription>{t('admin.fields.vendor.contact_email.help')}</FieldDescription>
+ <FieldDescription>{t('admin.fields.seller.contact_email.help')}</FieldDescription>
<FieldError errors={[errors.contact_email]} />
</Field>
</FieldGroup>
@@ -223,7 +223,7 @@ function CreateVendorSheet({
<Button type="submit" size="sm" disabled={form.formState.isSubmitting}>
{form.formState.isSubmitting
? t('admin.actions.creating')
- : t('admin.vendors.create_label')}
+ : t('admin.sellers.create_label')}
</Button>
</SheetFooter>
</form>
diff --git a/packages/dashboard/src/schemas/vendor.ts b/packages/dashboard/src/schemas/seller.ts
similarity index 77%
rename from packages/dashboard/src/schemas/vendor.ts
rename to packages/dashboard/src/schemas/seller.ts
index 23492c6b87..71a884fadd 100644
--- a/packages/dashboard/src/schemas/vendor.ts
+++ b/packages/dashboard/src/schemas/seller.ts
@@ -1,14 +1,14 @@
-import type { VendorCreateParams } from '@spree/admin-sdk'
+import type { SellerCreateParams } from '@spree/admin-sdk'
import { blankToNull } from '@spree/dashboard-core'
import { requiredMessage } from '@spree/dashboard-ui'
import { z } from 'zod/v4'
/**
- * The lifecycle, in the order a vendor normally travels it. `status` is
+ * The lifecycle, in the order a seller normally travels it. `status` is
* never part of a form: each move is its own workflow on the server, so the
* list here is only for rendering labels and filters.
*/
-export const VENDOR_STATUSES = [
+export const SELLER_STATUSES = [
'pending',
'invited',
'onboarding',
@@ -19,12 +19,12 @@ export const VENDOR_STATUSES = [
'canceled',
] as const
-export type VendorStatus = (typeof VENDOR_STATUSES)[number]
+export type SellerStatus = (typeof SELLER_STATUSES)[number]
-export const TAX_REMITTANCES = ['vendor', 'platform'] as const
+export const TAX_REMITTANCES = ['seller', 'platform'] as const
export const PAYOUT_INTERVALS = ['daily', 'weekly', 'biweekly', 'monthly', 'manual'] as const
-export const vendorFormSchema = z.object({
+export const sellerFormSchema = z.object({
name: z
.string()
.trim()
@@ -49,15 +49,15 @@ export const vendorFormSchema = z.object({
cover_photo_cleared: z.boolean(),
})
-export type VendorFormValues = z.infer<typeof vendorFormSchema>
+export type SellerFormValues = z.infer<typeof sellerFormSchema>
-export const VENDOR_DEFAULTS: VendorFormValues = {
+export const SELLER_DEFAULTS: SellerFormValues = {
name: '',
slug: '',
contact_email: '',
billing_email: '',
about: '',
- tax_remittance: 'vendor',
+ tax_remittance: 'seller',
payouts_schedule_interval: '',
minimum_payout_amount: '',
holiday_mode_until: '',
@@ -72,7 +72,7 @@ export const VENDOR_DEFAULTS: VendorFormValues = {
cover_photo_cleared: false,
}
-export function vendorValuesToParams(values: VendorFormValues): VendorCreateParams {
+export function sellerValuesToParams(values: SellerFormValues): SellerCreateParams {
return {
name: values.name,
slug: blankToNull(values.slug) ?? undefined,
@@ -81,7 +81,7 @@ export function vendorValuesToParams(values: VendorFormValues): VendorCreatePara
about: blankToNull(values.about),
tax_remittance: values.tax_remittance,
payouts_schedule_interval: blankToNull(values.payouts_schedule_interval) as
- | VendorCreateParams['payouts_schedule_interval']
+ | SellerCreateParams['payouts_schedule_interval']
| null,
minimum_payout_amount: blankToNull(values.minimum_payout_amount),
holiday_mode_until: blankToNull(values.holiday_mode_until),
@@ -89,9 +89,9 @@ export function vendorValuesToParams(values: VendorFormValues): VendorCreatePara
}
/** The image params only, for the sheet that owns the branding. */
-export function vendorImageParams(
- values: VendorFormValues,
-): Pick<VendorCreateParams, 'logo' | 'square_logo' | 'cover_photo'> {
+export function sellerImageParams(
+ values: SellerFormValues,
+): Pick<SellerCreateParams, 'logo' | 'square_logo' | 'cover_photo'> {
return {
...imageParam('logo', values.logo_signed_id, values.logo_cleared),
...imageParam('square_logo', values.square_logo_signed_id, values.square_logo_cleared),
@@ -111,15 +111,15 @@ function imageParam(
return {}
}
-export const vendorInviteSchema = z.object({
+export const sellerInviteSchema = z.object({
email: z.email({ error: requiredMessage('email') }),
})
-export type VendorInviteValues = z.infer<typeof vendorInviteSchema>
+export type SellerInviteValues = z.infer<typeof sellerInviteSchema>
-/** Suspending and rejecting both take an optional note for the vendor. */
-export const vendorReasonSchema = z.object({
+/** Suspending and rejecting both take an optional note for the seller. */
+export const sellerReasonSchema = z.object({
reason: z.string().trim().optional(),
})
-export type VendorReasonValues = z.infer<typeof vendorReasonSchema>
+export type SellerReasonValues = z.infer<typeof sellerReasonSchema>
diff --git a/packages/dashboard/src/tables/products.tsx b/packages/dashboard/src/tables/products.tsx
index e488768bf4..c78e74e3d1 100644
--- a/packages/dashboard/src/tables/products.tsx
+++ b/packages/dashboard/src/tables/products.tsx
@@ -7,7 +7,7 @@ import { PackageIcon } from 'lucide-react'
import { categoryAutocompleteProps } from '../hooks/use-categories'
import { channelAutocompleteProps } from '../hooks/use-channels'
import { productTypeAutocompleteProps } from '../hooks/use-product-types'
-import { vendorAutocompleteProps } from '../hooks/use-vendors'
+import { sellerAutocompleteProps } from '../hooks/use-sellers'
defineTable('products', {
title: i18n.t('admin.nav.products'),
@@ -137,25 +137,25 @@ defineTable('products', {
// Only meaningful on a marketplace: a first-party product has no seller,
// so the cell reads as the store's own rather than blank.
{
- key: 'vendor',
- label: i18n.t('admin.fields.product.vendor.label'),
+ key: 'seller',
+ label: i18n.t('admin.fields.product.seller.label'),
filterable: true,
filterType: 'resource',
- filterResource: vendorAutocompleteProps('products-table-vendor-filter'),
- ransackAttribute: 'vendor_id',
+ filterResource: sellerAutocompleteProps('products-table-seller-filter'),
+ ransackAttribute: 'seller_id',
default: false,
render: (product) =>
- product.vendor_id ? (
+ product.seller_id ? (
<Link
- to={'/$storeId/vendors/$vendorId' as string}
- params={{ vendorId: product.vendor_id }}
+ to={'/$storeId/sellers/$sellerId' as string}
+ params={{ sellerId: product.seller_id }}
className="no-underline"
>
- {product.vendor_name}
+ {product.seller_name}
</Link>
) : (
<span className="text-muted-foreground">
- {i18n.t('admin.fields.product.vendor.first_party')}
+ {i18n.t('admin.fields.product.seller.first_party')}
</span>
),
},
diff --git a/packages/dashboard/src/tables/vendors.tsx b/packages/dashboard/src/tables/sellers.tsx
similarity index 57%
rename from packages/dashboard/src/tables/vendors.tsx
rename to packages/dashboard/src/tables/sellers.tsx
index 911501ba2b..bf3f024dd4 100644
--- a/packages/dashboard/src/tables/vendors.tsx
+++ b/packages/dashboard/src/tables/sellers.tsx
@@ -1,18 +1,18 @@
-import type { Vendor } from '@spree/admin-sdk'
+import type { Seller } from '@spree/admin-sdk'
import { defineTable } from '@spree/dashboard-core'
import { RelativeTime, StatusBadge } from '@spree/dashboard-ui'
import { Link } from '@tanstack/react-router'
import i18n from 'i18next'
import { StoreIcon } from 'lucide-react'
-import { VENDOR_STATUSES } from '../schemas/vendor'
+import { SELLER_STATUSES } from '../schemas/seller'
-defineTable<Vendor>('vendors', {
- title: i18n.t('admin.nav.vendors'),
+defineTable<Seller>('sellers', {
+ title: i18n.t('admin.nav.sellers'),
searchParam: 'name_cont',
- searchPlaceholder: i18n.t('admin.vendors.search_placeholder'),
+ searchPlaceholder: i18n.t('admin.sellers.search_placeholder'),
defaultSort: { field: 'name', direction: 'asc' },
emptyIcon: <StoreIcon className="size-8 text-muted-foreground" />,
- emptyMessage: i18n.t('admin.vendors.empty'),
+ emptyMessage: i18n.t('admin.sellers.empty'),
columns: [
{
key: 'name',
@@ -20,13 +20,13 @@ defineTable<Vendor>('vendors', {
sortable: true,
filterable: true,
default: true,
- render: (vendor) => (
+ render: (seller) => (
<Link
- to={'/$storeId/vendors/$vendorId' as string}
- params={{ vendorId: vendor.id }}
+ to={'/$storeId/sellers/$sellerId' as string}
+ params={{ sellerId: seller.id }}
className="font-medium text-foreground no-underline"
>
- {vendor.name}
+ {seller.name}
</Link>
),
},
@@ -36,15 +36,15 @@ defineTable<Vendor>('vendors', {
sortable: true,
filterable: true,
filterType: 'enum',
- filterOptions: VENDOR_STATUSES.map((status) => ({
+ filterOptions: SELLER_STATUSES.map((status) => ({
value: status,
- label: i18n.t(`admin.vendors.status.${status}`),
+ label: i18n.t(`admin.sellers.status.${status}`),
})),
default: true,
- render: (vendor) => (
+ render: (seller) => (
<StatusBadge
- status={vendor.status}
- label={i18n.t(`admin.vendors.status.${vendor.status}`)}
+ status={seller.status}
+ label={i18n.t(`admin.sellers.status.${seller.status}`)}
/>
),
},
@@ -54,25 +54,25 @@ defineTable<Vendor>('vendors', {
sortable: true,
filterable: true,
default: true,
- render: (vendor) => vendor.contact_email ?? <span className="text-muted-foreground">—</span>,
+ render: (seller) => seller.contact_email ?? <span className="text-muted-foreground">—</span>,
},
{
key: 'products_count',
- label: i18n.t('admin.vendors.products_column'),
+ label: i18n.t('admin.sellers.products_column'),
default: true,
- render: (vendor) => vendor.products_count,
+ render: (seller) => seller.products_count,
},
{
key: 'users_count',
- label: i18n.t('admin.vendors.team_column'),
- render: (vendor) => vendor.users_count,
+ label: i18n.t('admin.sellers.team_column'),
+ render: (seller) => seller.users_count,
},
{
key: 'created_at',
label: i18n.t('admin.fields.created_at.label'),
sortable: true,
default: true,
- render: (vendor) => <RelativeTime iso={vendor.created_at} />,
+ render: (seller) => <RelativeTime iso={seller.created_at} />,
},
],
})
diff --git a/packages/sdk/src/store-client.ts b/packages/sdk/src/store-client.ts
index f6cce9a753..78a373078a 100644
--- a/packages/sdk/src/store-client.ts
+++ b/packages/sdk/src/store-client.ts
@@ -48,12 +48,12 @@ import type {
RequestPasswordResetParams,
ResetPasswordParams,
Return,
+ Seller,
StockLocation,
StoreCredit,
UpdateCartParams,
UpdateLineItemParams,
UpdatePaymentSessionParams,
- Vendor,
Wishlist,
WishlistItem,
} from './types'
@@ -184,9 +184,9 @@ export class StoreClient {
*/
/**
* Public seller profiles on a marketplace. Only sellers a shopper can
- * currently buy from are listed — see the Store Vendors endpoint.
+ * currently buy from are listed — see the Store Sellers endpoint.
*/
- readonly vendors = {
+ readonly sellers = {
/**
* List sellers. Paginated like every other collection (`page`, `limit`),
* and filterable through Ransack — `q[name_cont]` for a name search,
@@ -198,19 +198,19 @@ export class StoreClient {
list: (
params?: ListParams & Record<string, unknown>,
options?: RequestOptions,
- ): Promise<PaginatedResponse<Vendor>> =>
- this.request<PaginatedResponse<Vendor>>('GET', '/vendors', {
+ ): Promise<PaginatedResponse<Seller>> =>
+ this.request<PaginatedResponse<Seller>>('GET', '/sellers', {
...options,
params: transformListParams({ ...params }),
}),
- /** By slug or prefixed ID, so a storefront can route `/vendors/sparks-audio`. */
+ /** By slug or prefixed ID, so a storefront can route `/sellers/sparks-audio`. */
get: (
idOrSlug: string,
params?: { expand?: string[]; fields?: string[] },
options?: RequestOptions,
- ): Promise<Vendor> =>
- this.request<Vendor>('GET', `/vendors/${idOrSlug}`, {
+ ): Promise<Seller> =>
+ this.request<Seller>('GET', `/sellers/${idOrSlug}`, {
...options,
params: getParams(params),
}),
diff --git a/packages/sdk/src/types/generated/LineItem.ts b/packages/sdk/src/types/generated/LineItem.ts
index d16c106c7c..d841a1b71a 100644
--- a/packages/sdk/src/types/generated/LineItem.ts
+++ b/packages/sdk/src/types/generated/LineItem.ts
@@ -1,12 +1,12 @@
-// Typelizer digest 4a01532ece2a9f2961143bc95c2a796e
+// Typelizer digest 1d51470347a255b4aa911fdc59b3df52
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {Vendor, OptionValue, DigitalLink, TaxLine} from '@/types'
+import type {Seller, OptionValue, DigitalLink, TaxLine} from '@/types'
interface LineItem {
id: string;
variant_id: string;
- vendor_id: string | null;
+ seller_id: string | null;
preorder: boolean;
preorder_ships_at: string | null;
quantity: number;
@@ -33,7 +33,7 @@ interface LineItem {
display_compare_at_amount: string | null;
compare_at_amount: string | null;
thumbnail_url: string | null;
- vendor?: Vendor;
+ seller?: Seller;
option_values: Array<OptionValue>;
digital_links: Array<DigitalLink>;
tax_lines?: Array<TaxLine>;
diff --git a/packages/sdk/src/types/generated/Product.ts b/packages/sdk/src/types/generated/Product.ts
index 10af5a7547..b14c606643 100644
--- a/packages/sdk/src/types/generated/Product.ts
+++ b/packages/sdk/src/types/generated/Product.ts
@@ -1,7 +1,7 @@
-// Typelizer digest 3819d8f93372d65ab72fc8b91e949c02
+// Typelizer digest 0759c6f74b8fd90a74d7066e05b1a44d
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {Price, PriceHistory, Vendor, Media, Variant, OptionType, OptionValue, Category, CustomField} from '@/types'
+import type {Price, PriceHistory, Seller, Media, Variant, OptionType, OptionValue, Category, CustomField} from '@/types'
interface Product {
id: string;
@@ -25,8 +25,8 @@ interface Product {
tags: Array<string>;
price: Price;
original_price: Price | null;
- vendor_id: string | null;
- vendor?: Vendor;
+ seller_id: string | null;
+ seller?: Seller;
primary_media?: Media;
media?: Array<Media>;
variants?: Array<Variant>;
diff --git a/packages/sdk/src/types/generated/Vendor.ts b/packages/sdk/src/types/generated/Seller.ts
similarity index 73%
rename from packages/sdk/src/types/generated/Vendor.ts
rename to packages/sdk/src/types/generated/Seller.ts
index 1ec0073198..4375dc45cc 100644
--- a/packages/sdk/src/types/generated/Vendor.ts
+++ b/packages/sdk/src/types/generated/Seller.ts
@@ -1,8 +1,8 @@
-// Typelizer digest daee0894487b6ff25189f6481f65f491
+// Typelizer digest 857b5dc686d0fd5e0adb37a28883d302
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-interface Vendor {
+interface Seller {
id: string;
name: string;
slug: string;
@@ -13,4 +13,4 @@ interface Vendor {
cover_photo_url: string | null;
}
-export default Vendor;
+export default Seller;
diff --git a/packages/sdk/src/types/generated/index.ts b/packages/sdk/src/types/generated/index.ts
index 33dae9c891..a17ca258fb 100644
--- a/packages/sdk/src/types/generated/index.ts
+++ b/packages/sdk/src/types/generated/index.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 49421ed63e4020134a1ad47a94ae0a05
+// Typelizer digest 976c58296cb2b9a554be05730f40d259
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
export type { default as Address } from './Address'
@@ -62,6 +62,7 @@ export type { default as Refund } from './Refund'
export type { default as ReturnLineItem } from './ReturnLineItem'
export type { default as ReturnReason } from './ReturnReason'
export type { default as Return } from './Return'
+export type { default as Seller } from './Seller'
export type { default as State } from './State'
export type { default as StockLocation } from './StockLocation'
export type { default as StockReservation } from './StockReservation'
@@ -69,6 +70,5 @@ export type { default as StoreCredit } from './StoreCredit'
export type { default as TaxIdentifier } from './TaxIdentifier'
export type { default as TaxLine } from './TaxLine'
export type { default as Variant } from './Variant'
-export type { default as Vendor } from './Vendor'
export type { default as WishlistItem } from './WishlistItem'
export type { default as Wishlist } from './Wishlist'
diff --git a/packages/sdk/src/types/index.ts b/packages/sdk/src/types/index.ts
index d637a94987..f7d4c1b112 100644
--- a/packages/sdk/src/types/index.ts
+++ b/packages/sdk/src/types/index.ts
@@ -46,11 +46,11 @@ export type {
Refund,
Return,
ReturnLineItem,
+ Seller,
State,
StockLocation,
StoreCredit,
Variant,
- Vendor,
Wishlist,
WishlistItem,
} from './generated'
diff --git a/packages/sdk/src/zod/generated/LineItem.ts b/packages/sdk/src/zod/generated/LineItem.ts
index 04af722d7d..b973b36fd0 100644
--- a/packages/sdk/src/zod/generated/LineItem.ts
+++ b/packages/sdk/src/zod/generated/LineItem.ts
@@ -2,13 +2,13 @@
import { z } from 'zod';
import { DigitalLinkSchema } from './DigitalLink';
import { OptionValueSchema } from './OptionValue';
+import { SellerSchema } from './Seller';
import { TaxLineSchema } from './TaxLine';
-import { VendorSchema } from './Vendor';
export const LineItemSchema = z.object({
id: z.string(),
variant_id: z.string(),
- vendor_id: z.string().nullable(),
+ seller_id: z.string().nullable(),
preorder: z.boolean(),
preorder_ships_at: z.string().nullable(),
quantity: z.number(),
@@ -35,7 +35,7 @@ export const LineItemSchema = z.object({
display_compare_at_amount: z.string().nullable(),
compare_at_amount: z.string().nullable(),
thumbnail_url: z.string().nullable(),
- vendor: VendorSchema.optional(),
+ seller: SellerSchema.optional(),
option_values: z.array(OptionValueSchema),
digital_links: z.array(DigitalLinkSchema),
tax_lines: z.array(TaxLineSchema).optional(),
diff --git a/packages/sdk/src/zod/generated/Product.ts b/packages/sdk/src/zod/generated/Product.ts
index c0b4fb7aff..b7da63cc52 100644
--- a/packages/sdk/src/zod/generated/Product.ts
+++ b/packages/sdk/src/zod/generated/Product.ts
@@ -7,8 +7,8 @@ import { OptionTypeSchema } from './OptionType';
import { OptionValueSchema } from './OptionValue';
import { PriceSchema } from './Price';
import { PriceHistorySchema } from './PriceHistory';
+import { SellerSchema } from './Seller';
import { VariantSchema } from './Variant';
-import { VendorSchema } from './Vendor';
export const ProductSchema = z.object({
id: z.string(),
@@ -32,8 +32,8 @@ export const ProductSchema = z.object({
tags: z.array(z.string()),
price: PriceSchema,
original_price: PriceSchema.nullable(),
- vendor_id: z.string().nullable(),
- vendor: VendorSchema.optional(),
+ seller_id: z.string().nullable(),
+ seller: SellerSchema.optional(),
primary_media: MediaSchema.optional(),
media: z.array(MediaSchema).optional(),
variants: z.array(VariantSchema).optional(),
diff --git a/packages/sdk/src/zod/generated/Vendor.ts b/packages/sdk/src/zod/generated/Seller.ts
similarity index 77%
rename from packages/sdk/src/zod/generated/Vendor.ts
rename to packages/sdk/src/zod/generated/Seller.ts
index 61ce7f0fca..8aa2e9026f 100644
--- a/packages/sdk/src/zod/generated/Vendor.ts
+++ b/packages/sdk/src/zod/generated/Seller.ts
@@ -1,7 +1,7 @@
// This file is auto-generated. Do not edit directly.
import { z } from 'zod';
-export const VendorSchema = z.object({
+export const SellerSchema = z.object({
id: z.string(),
name: z.string(),
slug: z.string(),
@@ -12,4 +12,4 @@ export const VendorSchema = z.object({
cover_photo_url: z.string().nullable(),
});
-export type Vendor = z.infer<typeof VendorSchema>;
+export type Seller = z.infer<typeof SellerSchema>;
diff --git a/packages/sdk/src/zod/generated/index.ts b/packages/sdk/src/zod/generated/index.ts
index 6c74526ae5..dddcd782a9 100644
--- a/packages/sdk/src/zod/generated/index.ts
+++ b/packages/sdk/src/zod/generated/index.ts
@@ -60,6 +60,7 @@ export { RefundSchema, type Refund } from './Refund';
export { ReturnSchema, type Return } from './Return';
export { ReturnLineItemSchema, type ReturnLineItem } from './ReturnLineItem';
export { ReturnReasonSchema, type ReturnReason } from './ReturnReason';
+export { SellerSchema, type Seller } from './Seller';
export { StateSchema, type State } from './State';
export { StockLocationSchema, type StockLocation } from './StockLocation';
export { StockReservationSchema, type StockReservation } from './StockReservation';
@@ -67,6 +68,5 @@ export { StoreCreditSchema, type StoreCredit } from './StoreCredit';
export { TaxIdentifierSchema, type TaxIdentifier } from './TaxIdentifier';
export { TaxLineSchema, type TaxLine } from './TaxLine';
export { VariantSchema, type Variant } from './Variant';
-export { VendorSchema, type Vendor } from './Vendor';
export { WishlistSchema, type Wishlist } from './Wishlist';
export { WishlistItemSchema, type WishlistItem } from './WishlistItem';
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index bb50034feb..aeb9007866 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -4251,7 +4251,7 @@ packages:
resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==}
engines: {node: '>= 0.8'}
resolution: {integrity: sha512-SbPDPdDBYp+5MJHhBCAyI7wKM3d5ivekigc2Dk2s7pgbZ9wIgIBYGVw4zGHBml/qTFbexrofXW6Gu4noGxrOwQ==}
@@ -7394,7 +7394,7 @@ snapshots:
reselect: 5.1.1
tiny-invariant: 1.3.3
use-sync-external-store: 1.6.0([email protected])
- victory-vendor: 37.3.6
+ victory-seller: 37.3.6
transitivePeerDependencies:
- '@types/react'
- redux
@@ -7886,7 +7886,7 @@ snapshots:
dependencies:
'@types/d3-array': 3.2.2
'@types/d3-ease': 3.0.2
diff --git a/spree/api/app/controllers/concerns/spree/api/v3/admin/role_grant_guard.rb b/spree/api/app/controllers/concerns/spree/api/v3/admin/role_grant_guard.rb
index 09ec1ba78e..b9c5210980 100644
--- a/spree/api/app/controllers/concerns/spree/api/v3/admin/role_grant_guard.rb
+++ b/spree/api/app/controllers/concerns/spree/api/v3/admin/role_grant_guard.rb
@@ -109,7 +109,7 @@ module Spree
# The caller's roles on this store, fetched once per request,
# mirroring `Spree::Ability#staff_roles`: a role owned by another
- # resource (a marketplace vendor) confers no store-admin authority
+ # resource (a marketplace seller) confers no store-admin authority
# and must not widen what the caller may grant.
#
# @return [Array<Spree::Role>]
diff --git a/spree/api/app/controllers/concerns/spree/api/v3/admin_authentication.rb b/spree/api/app/controllers/concerns/spree/api/v3/admin_authentication.rb
index 23c3fbbf82..b1176b0296 100644
--- a/spree/api/app/controllers/concerns/spree/api/v3/admin_authentication.rb
+++ b/spree/api/app/controllers/concerns/spree/api/v3/admin_authentication.rb
@@ -63,7 +63,7 @@ module Spree
# Membership is holding a role the store itself owns, mirroring
# Spree::Ability#staff_roles. A role belonging to another resource — a
- # marketplace vendor, say — is that panel's business and never admits
+ # marketplace seller, say — is that panel's business and never admits
# its holder here.
def current_user_member_of_store?
return false unless current_user.respond_to?(:spree_roles)
diff --git a/spree/api/app/controllers/concerns/spree/api/v3/jwt_authentication.rb b/spree/api/app/controllers/concerns/spree/api/v3/jwt_authentication.rb
index b36264fffa..00c64ccc16 100644
--- a/spree/api/app/controllers/concerns/spree/api/v3/jwt_authentication.rb
+++ b/spree/api/app/controllers/concerns/spree/api/v3/jwt_authentication.rb
@@ -13,9 +13,9 @@ module Spree
JWT_AUDIENCE_ADMIN = 'admin_api'.freeze
# Marketplace sellers share the admin user class, so the audience — not
# the principal — is what keeps a seller's token off the admin API and
- # an admin's off the vendor panel. Enforced at decode, before any store
- # or vendor is resolved.
- JWT_AUDIENCE_VENDOR = 'vendor_api'.freeze
+ # an admin's off the seller panel. Enforced at decode, before any store
+ # or seller is resolved.
+ JWT_AUDIENCE_SELLER = 'seller_api'.freeze
JWT_ISSUER = 'spree'.freeze
included do
diff --git a/spree/api/app/controllers/concerns/spree/api/v3/vendor/auth_cookies.rb b/spree/api/app/controllers/concerns/spree/api/v3/seller/auth_cookies.rb
similarity index 93%
rename from spree/api/app/controllers/concerns/spree/api/v3/vendor/auth_cookies.rb
rename to spree/api/app/controllers/concerns/spree/api/v3/seller/auth_cookies.rb
index 931b87eb27..64b3107fba 100644
--- a/spree/api/app/controllers/concerns/spree/api/v3/vendor/auth_cookies.rb
+++ b/spree/api/app/controllers/concerns/spree/api/v3/seller/auth_cookies.rb
@@ -1,7 +1,7 @@
module Spree
module Api
module V3
- module Vendor
+ module Seller
# Cookie-based delivery for seller refresh tokens.
#
# Both the name and the path differ from the admin cookie, and both
@@ -23,8 +23,8 @@ module Spree
include ActionController::Cookies
end
- REFRESH_COOKIE_NAME = :spree_vendor_refresh_token
- COOKIE_PATH = '/api/v3/vendor/auth'.freeze
+ REFRESH_COOKIE_NAME = :spree_seller_refresh_token
+ COOKIE_PATH = '/api/v3/seller/auth'.freeze
private
diff --git a/spree/api/app/controllers/concerns/spree/api/v3/vendor/vendor_context.rb b/spree/api/app/controllers/concerns/spree/api/v3/seller/seller_context.rb
similarity index 61%
rename from spree/api/app/controllers/concerns/spree/api/v3/vendor/vendor_context.rb
rename to spree/api/app/controllers/concerns/spree/api/v3/seller/seller_context.rb
index 89d23266a9..b73c2c7e0c 100644
--- a/spree/api/app/controllers/concerns/spree/api/v3/vendor/vendor_context.rb
+++ b/spree/api/app/controllers/concerns/spree/api/v3/seller/seller_context.rb
@@ -1,64 +1,64 @@
module Spree
module Api
module V3
- module Vendor
+ module Seller
# Resolves which seller a request acts as.
#
# The inverse of the admin branch's store context: there, the store is
# named by a header or a key and falls back to the default. Here the
- # vendor is named by the header, membership is checked against it, and
- # the store is *derived* from the vendor — never sent, never defaulted.
- # A request that names no vendor the caller belongs to has no tenant at
+ # seller is named by the header, membership is checked against it, and
+ # the store is *derived* from the seller — never sent, never defaulted.
+ # A request that names no seller the caller belongs to has no tenant at
# all, which is an error rather than a default.
#
# Included into both branch anchors (BaseController and
# ResourceController): they are parallel inheritance chains, so a
# concern on one is not on the other.
- module VendorContext
+ module SellerContext
extend ActiveSupport::Concern
- VENDOR_HEADER = 'X-Spree-Vendor-Id'.freeze
+ SELLER_HEADER = 'X-Spree-Seller-Id'.freeze
# Prepended, like the admin branch's store context, because the
# shared base chain reads the store while setting up locale and
# currency — before any ordinary callback runs.
#
- # Resolving a vendor needs the caller, so this identifies them first
+ # Resolving a seller needs the caller, so this identifies them first
# by calling `authenticate_user`, which is idempotent and is the same
# method the authentication callback runs later. That later callback
# remains the authority on whether the request may proceed; this only
# establishes the tenant early enough for the chain beneath it.
included do
- prepend_before_action :set_current_vendor_context
+ prepend_before_action :set_current_seller_context
end
- # The vendor this request acts as, or nil when the header names none
+ # The seller this request acts as, or nil when the header names none
# the caller belongs to.
#
- # @return [Spree::Vendor, nil]
- def current_vendor
- return @current_vendor if defined?(@current_vendor)
+ # @return [Spree::Seller, nil]
+ def current_seller
+ return @current_seller if defined?(@current_seller)
- @current_vendor = resolve_current_vendor
+ @current_seller = resolve_current_seller
end
- # Derived from the vendor, so a seller can never widen their reach by
+ # Derived from the seller, so a seller can never widen their reach by
# sending a store header.
#
- # Falls back to the default store only when no vendor resolved — such
+ # Falls back to the default store only when no seller resolved — such
# a request is already being rejected, and the chain beneath this
# (locale and currency setup) reads the store before the rejection
# renders. Nothing tenant-bearing is served through the fallback.
#
# @return [Spree::Store, nil]
def current_store
- current_vendor&.store || Spree::Store.default
+ current_seller&.store || Spree::Store.default
end
private
- def set_current_vendor_context
- # Identify the caller before resolving their vendor. Safe to call
+ def set_current_seller_context
+ # Identify the caller before resolving their seller. Safe to call
# here: it only populates @current_user, and the authentication
# callback still decides whether an unidentified request proceeds.
authenticate_user
@@ -68,42 +68,42 @@ module Spree
# before the rejection lands.
Spree::Current.store = current_store
- # An unauthenticated request has no vendor to resolve, and saying
+ # An unauthenticated request has no seller to resolve, and saying
# so is authentication's job — let it answer with a 401 rather than
# reporting a missing tenant.
return true if current_user.nil?
- require_current_vendor!
+ require_current_seller!
end
- def require_current_vendor!
- return true if current_vendor
+ def require_current_seller!
+ return true if current_seller
render_error(
code: ErrorHandler::ERROR_CODES[:access_denied],
- message: Spree.t(:vendor_access_denied),
+ message: Spree.t(:seller_access_denied),
status: :forbidden
)
false
end
- # Membership is holding a role the vendor owns — the same question
+ # Membership is holding a role the seller owns — the same question
# the store back office asks, pointed at a different resource. A
- # header naming a vendor the caller has no role on resolves to
- # nothing, so it reads as "no such vendor" rather than "denied",
+ # header naming a seller the caller has no role on resolves to
+ # nothing, so it reads as "no such seller" rather than "denied",
# which is also what stops the header being used to enumerate.
- def resolve_current_vendor
- return nil if vendor_id_header.blank?
- return nil unless current_user.respond_to?(:vendors)
+ def resolve_current_seller
+ return nil if seller_id_header.blank?
+ return nil unless current_user.respond_to?(:sellers)
- id = Spree::Vendor.decode_own_prefixed_id(vendor_id_header)
+ id = Spree::Seller.decode_own_prefixed_id(seller_id_header)
return nil if id.blank?
- current_user.vendors.find_by(id: id)
+ current_user.sellers.find_by(id: id)
end
- def vendor_id_header
- request.headers[VENDOR_HEADER]
+ def seller_id_header
+ request.headers[SELLER_HEADER]
end
end
end
diff --git a/spree/api/app/controllers/concerns/spree/api/v3/vendor_authentication.rb b/spree/api/app/controllers/concerns/spree/api/v3/seller_authentication.rb
similarity index 78%
rename from spree/api/app/controllers/concerns/spree/api/v3/vendor_authentication.rb
rename to spree/api/app/controllers/concerns/spree/api/v3/seller_authentication.rb
index c5ee7e993c..d5cb7594c8 100644
--- a/spree/api/app/controllers/concerns/spree/api/v3/vendor_authentication.rb
+++ b/spree/api/app/controllers/concerns/spree/api/v3/seller_authentication.rb
@@ -6,7 +6,7 @@ module Spree
# Deliberately not a subclass or variant of AdminAuthentication: a seller
# holds no secret API key (keys are store-bound and grant `manage :all`),
# so this surface is JWT-only and the key path simply does not exist here.
- module VendorAuthentication
+ module SellerAuthentication
extend ActiveSupport::Concern
included do
@@ -15,19 +15,19 @@ module Spree
protected
- # Rejects an admin or storefront token before any vendor is resolved.
+ # Rejects an admin or storefront token before any seller is resolved.
def expected_audience
- Spree::Api::V3::JwtAuthentication::JWT_AUDIENCE_VENDOR
+ Spree::Api::V3::JwtAuthentication::JWT_AUDIENCE_SELLER
end
- # Capability comes from the roles the seller holds *on this vendor*.
+ # Capability comes from the roles the seller holds *on this seller*.
# Passing the resource is what stops a store role — or the store's
# `admin` super-role — being read here (see Spree::Ability).
def ability_options
- { store: current_store, resource: current_vendor }
+ { store: current_store, resource: current_seller }
end
- def authenticate_vendor!
+ def authenticate_seller!
require_authentication!
end
diff --git a/spree/api/app/controllers/spree/api/v3/admin/commission_lines_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/commission_lines_controller.rb
index 3531cd37e9..4938c06290 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/commission_lines_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/commission_lines_controller.rb
@@ -30,7 +30,7 @@ module Spree
# Every association the serializer reads, so a page of lines costs a
# fixed number of queries rather than one per row.
def collection_includes
- [:vendor, :commission_rate, :order, :line_item, :fulfillment]
+ [:seller, :commission_rate, :order, :line_item, :fulfillment]
end
end
end
diff --git a/spree/api/app/controllers/spree/api/v3/admin/commission_rates_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/commission_rates_controller.rb
index d5faf63c14..14ba6445f8 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/commission_rates_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/commission_rates_controller.rb
@@ -9,7 +9,7 @@ module Spree
# round-trip — the same shape price lists use.
#
# Operator-only: `read_commissions`/`write_commissions` is closed to the
- # vendor audience, because a seller must never see, let alone set, what
+ # seller audience, because a seller must never see, let alone set, what
# anyone is charged.
class CommissionRatesController < ResourceController
scoped_resource :commissions
diff --git a/spree/api/app/controllers/spree/api/v3/admin/roles_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/roles_controller.rb
index d9addc7103..29b2af623f 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/roles_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/roles_controller.rb
@@ -5,7 +5,7 @@ module Spree
# Staff roles and their catalog permissions (docs/plans/6.0-admin-rbac.md).
# A role belongs to what it governs, so this surface reads and writes
# the current store's own roles; one owned by another resource — a
- # marketplace vendor's — belongs to that panel. Protection of the admin
+ # marketplace seller's — belongs to that panel. Protection of the admin
# role and host-locked rows lives on the model (`mutable` guards,
# `can_be_deleted?`).
class RolesController < ResourceController
@@ -40,7 +40,7 @@ module Spree
end
# The store's own roles. A role belonging to another resource — a
- # marketplace vendor's — is managed from that panel and never appears
+ # marketplace seller's — is managed from that panel and never appears
# in the staff role picker.
def scope
current_store.roles.accessible_by(current_ability, :show)
diff --git a/spree/api/app/controllers/spree/api/v3/admin/vendors_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/sellers_controller.rb
similarity index 79%
rename from spree/api/app/controllers/spree/api/v3/admin/vendors_controller.rb
rename to spree/api/app/controllers/spree/api/v3/admin/sellers_controller.rb
index 768a65dcf8..d48da93670 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/vendors_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/sellers_controller.rb
@@ -8,23 +8,23 @@ module Spree
# assignment, because each one is a workflow with its own arguments —
# suspending carries a reason, inviting carries an email address. The
# `status` field is deliberately not writable through `update`: a
- # vendor moved by a PATCH would skip the mail, the payout provisioning
+ # seller moved by a PATCH would skip the mail, the payout provisioning
# and the extension hooks that make the transition mean something.
- class VendorsController < ResourceController
- # Sellers are their own catalog resource: `read_vendors`/`write_vendors`
+ class SellersController < ResourceController
+ # Sellers are their own catalog resource: `read_sellers`/`write_sellers`
# is what a key needs here, and neither is grantable to a seller's own
# panel — managing sellers is the operator's job.
- scoped_resource :vendors
+ scoped_resource :sellers
before_action :set_resource, only: [:show, :update, :destroy, :invite, :approve, :suspend, :reject]
- # POST /api/v3/admin/vendors/:id/invite
+ # POST /api/v3/admin/sellers/:id/invite
#
- # Opens the vendor's team to someone. They become a member when they
+ # Opens the seller's team to someone. They become a member when they
# accept, on the same invitation rail the store's own staff use.
def invite
- result = Spree.vendor_invite_workflow.call(
- vendor: @resource,
+ result = Spree.seller_invite_workflow.call(
+ seller: @resource,
email: params[:email],
role: role_for_invite,
inviter: try_spree_current_user
@@ -37,21 +37,21 @@ module Spree
end
end
- # PATCH /api/v3/admin/vendors/:id/approve
+ # PATCH /api/v3/admin/sellers/:id/approve
def approve
- run_workflow(Spree.vendor_approve_workflow, approver: try_spree_current_user)
+ run_workflow(Spree.seller_approve_workflow, approver: try_spree_current_user)
end
- # PATCH /api/v3/admin/vendors/:id/suspend
+ # PATCH /api/v3/admin/sellers/:id/suspend
def suspend
- run_workflow(Spree.vendor_suspend_workflow,
+ run_workflow(Spree.seller_suspend_workflow,
reason: params[:reason],
suspended_by: try_spree_current_user)
end
- # PATCH /api/v3/admin/vendors/:id/reject
+ # PATCH /api/v3/admin/sellers/:id/reject
def reject
- run_workflow(Spree.vendor_reject_workflow,
+ run_workflow(Spree.seller_reject_workflow,
reason: params[:reason],
rejected_by: try_spree_current_user)
end
@@ -59,14 +59,14 @@ module Spree
protected
def model_class
- Spree::Vendor
+ Spree::Seller
end
def serializer_class
- Spree.api.admin_vendor_serializer
+ Spree.api.admin_seller_serializer
end
- # `users` is preloaded because a vendor team is small and its count is
+ # `users` is preloaded because a seller team is small and its count is
# a cheap `.size` over loaded rows. `products` deliberately is not: a
# catalog can run to thousands, so the serializer counts it in SQL
# rather than materializing it just to measure it.
@@ -82,7 +82,7 @@ module Spree
:postal_code, :zipcode, :phone, :country_code, :state_code, :state_name, :label
].freeze
- # The vendor's own profile fields, plus the settlement and tax
+ # The seller's own profile fields, plus the settlement and tax
# configuration only the operator sets. `status` is absent by
# design — see the class comment.
#
@@ -107,7 +107,7 @@ module Spree
private
def run_workflow(workflow, **arguments)
- result = workflow.call(vendor: @resource, **arguments)
+ result = workflow.call(seller: @resource, **arguments)
if result.success?
render json: serialize_resource(result.value)
@@ -116,7 +116,7 @@ module Spree
end
end
- # Read through the vendor's own roles: a role id naming somewhere
+ # Read through the seller's own roles: a role id naming somewhere
# else is a 404 here rather than an invitation into another team.
def role_for_invite
return nil if params[:role_id].blank?
diff --git a/spree/api/app/controllers/spree/api/v3/admin/stock_transfers_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/stock_transfers_controller.rb
index b3c307f2eb..eb3ebbb40f 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/stock_transfers_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/stock_transfers_controller.rb
@@ -2,7 +2,7 @@ module Spree
module Api
module V3
module Admin
- # Inventory movement between stock locations, or vendor → location
+ # Inventory movement between stock locations, or seller → location
# for receives. Pass `source_location_id` for transfers; omit it to
# record an external receive.
class StockTransfersController < ResourceController
diff --git a/spree/api/app/controllers/spree/api/v3/admin/tags_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/tags_controller.rb
index 73e42a8fc0..9cc519897c 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/tags_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/tags_controller.rb
@@ -99,7 +99,7 @@ module Spree
# Sourced from `Spree.taggable_types` (registered in
# `Spree::Core::Engine`'s after_initialize block). Apps extend the
# list in an initializer without overriding this controller:
- # Spree.taggable_types << 'MyApp::Vendor'
+ # Spree.taggable_types << 'MyApp::Seller'
def allowed_taggable_types
Spree.taggable_types
end
diff --git a/spree/api/app/controllers/spree/api/v3/vendor/auth_controller.rb b/spree/api/app/controllers/spree/api/v3/seller/auth_controller.rb
similarity index 77%
rename from spree/api/app/controllers/spree/api/v3/vendor/auth_controller.rb
rename to spree/api/app/controllers/spree/api/v3/seller/auth_controller.rb
index 3a190a015d..ddf9cb3c36 100644
--- a/spree/api/app/controllers/spree/api/v3/vendor/auth_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/seller/auth_controller.rb
@@ -1,15 +1,15 @@
module Spree
module Api
module V3
- module Vendor
+ module Seller
# Sign-in for the marketplace seller panel.
#
# Its own surface rather than a reuse of the admin one, so login policy
# can differ per panel: a store that requires SSO for its own staff can
# still let sellers sign in with a password, because the two read
# different strategy registries against the same user class.
- class AuthController < Vendor::BaseController
- include Spree::Api::V3::Vendor::AuthCookies
+ class AuthController < Seller::BaseController
+ include Spree::Api::V3::Seller::AuthCookies
include Spree::Api::V3::AuthenticationStrategies
skip_scope_check!
@@ -19,23 +19,23 @@ module Spree
# a login page fetches on every load would spend the login budget.
rate_limit to: Spree::Api::Config[:rate_limit_login],
within: Spree::Api::Config[:rate_limit_window].seconds,
- store: Rails.cache, only: :create, name: 'vendor_login',
+ store: Rails.cache, only: :create, name: 'seller_login',
with: -> { render_rate_limited(limit: Spree::Api::Config[:rate_limit_login]) }
rate_limit to: Spree::Api::Config[:rate_limit_refresh],
within: Spree::Api::Config[:rate_limit_window].seconds,
- store: Rails.cache, only: :providers, name: 'vendor_providers',
+ store: Rails.cache, only: :providers, name: 'seller_providers',
with: -> { render_rate_limited(limit: Spree::Api::Config[:rate_limit_refresh]) }
rate_limit to: Spree::Api::Config[:rate_limit_refresh],
within: Spree::Api::Config[:rate_limit_window].seconds,
- store: Rails.cache, only: [:refresh, :logout], name: 'vendor_refresh',
+ store: Rails.cache, only: [:refresh, :logout], name: 'seller_refresh',
with: -> { render_rate_limited(limit: Spree::Api::Config[:rate_limit_refresh]) }
- # Signing in is what establishes which vendors the caller may act as,
- # so these actions run before any vendor is known.
- skip_before_action :set_current_vendor_context, only: [:create, :refresh, :logout, :providers]
- skip_before_action :authenticate_vendor!, only: [:create, :refresh, :logout, :providers]
+ # Signing in is what establishes which sellers the caller may act as,
+ # so these actions run before any seller is known.
+ skip_before_action :set_current_seller_context, only: [:create, :refresh, :logout, :providers]
+ skip_before_action :authenticate_seller!, only: [:create, :refresh, :logout, :providers]
- # POST /api/v3/vendor/auth/login
+ # POST /api/v3/seller/auth/login
def create
strategy = authentication_strategy
return unless strategy
@@ -45,27 +45,27 @@ module Spree
user = result.value
# A store's own staff share this user class, so authenticating is
- # not enough: without a role on some vendor there is no panel to
+ # not enough: without a role on some seller there is no panel to
# sign in to, and minting a token would hand out an audience the
# holder can do nothing with.
- return render_authentication_failed(Spree.t(:vendor_membership_required)) unless user.vendor_member?
+ return render_authentication_failed(Spree.t(:seller_membership_required)) unless user.seller_member?
set_refresh_cookie(
Spree::RefreshToken.create_for(
user,
- audience: Spree::Api::V3::JwtAuthentication::JWT_AUDIENCE_VENDOR,
+ audience: Spree::Api::V3::JwtAuthentication::JWT_AUDIENCE_SELLER,
request_env: request_env_for_token
)
)
render json: auth_response(user)
end
- # GET /api/v3/vendor/auth/providers
+ # GET /api/v3/seller/auth/providers
def providers
- render json: { providers: Spree.vendor_authentication_strategies.describe }
+ render json: { providers: Spree.seller_authentication_strategies.describe }
end
- # POST /api/v3/vendor/auth/refresh
+ # POST /api/v3/seller/auth/refresh
def refresh
refresh_token_value = refresh_token_from_cookie
@@ -78,9 +78,9 @@ module Spree
end
# Narrowed by audience: a token minted on another surface must not
- # be exchangeable for a vendor one.
+ # be exchangeable for a seller one.
refresh_token = Spree::RefreshToken.active.
- for_audience(Spree::Api::V3::JwtAuthentication::JWT_AUDIENCE_VENDOR).
+ for_audience(Spree::Api::V3::JwtAuthentication::JWT_AUDIENCE_SELLER).
find_by(token: refresh_token_value)
if refresh_token.nil?
@@ -95,12 +95,12 @@ module Spree
user = refresh_token.user
# Membership can be revoked while a session is live; the refresh is
# where that takes effect.
- unless user.vendor_member?
+ unless user.seller_member?
refresh_token.destroy
clear_refresh_cookie
return render_error(
code: ErrorHandler::ERROR_CODES[:access_denied],
- message: Spree.t(:vendor_membership_required),
+ message: Spree.t(:seller_membership_required),
status: :forbidden
)
end
@@ -109,13 +109,13 @@ module Spree
render json: auth_response(user)
end
- # POST /api/v3/vendor/auth/logout
+ # POST /api/v3/seller/auth/logout
def logout
refresh_token_value = refresh_token_from_cookie
if refresh_token_value.present?
Spree::RefreshToken.
- for_audience(Spree::Api::V3::JwtAuthentication::JWT_AUDIENCE_VENDOR).
+ for_audience(Spree::Api::V3::JwtAuthentication::JWT_AUDIENCE_SELLER).
find_by(token: refresh_token_value)&.destroy
end
@@ -135,20 +135,20 @@ module Spree
def auth_response(user)
{
- token: generate_jwt(user, audience: Spree::Api::V3::JwtAuthentication::JWT_AUDIENCE_VENDOR),
- user: Spree.api.admin_user_serializer.new(user, params: { store: user.vendors.first&.store }).to_h,
- vendors: serialized_vendors(user)
+ token: generate_jwt(user, audience: Spree::Api::V3::JwtAuthentication::JWT_AUDIENCE_SELLER),
+ user: Spree.api.admin_user_serializer.new(user, params: { store: user.sellers.first&.store }).to_h,
+ sellers: serialized_sellers(user)
}
end
- # The panel needs these to choose an X-Spree-Vendor-Id before it can
+ # The panel needs these to choose an X-Spree-Seller-Id before it can
# make any other request.
- def serialized_vendors(user)
- user.vendors.map { |vendor| { id: vendor.prefixed_id, name: vendor.name, status: vendor.status } }
+ def serialized_sellers(user)
+ user.sellers.map { |seller| { id: seller.prefixed_id, name: seller.name, status: seller.status } }
end
def authentication_strategies
- Spree.vendor_authentication_strategies
+ Spree.seller_authentication_strategies
end
def authentication_user_class
diff --git a/spree/api/app/controllers/spree/api/v3/vendor/base_controller.rb b/spree/api/app/controllers/spree/api/v3/seller/base_controller.rb
similarity index 73%
rename from spree/api/app/controllers/spree/api/v3/vendor/base_controller.rb
rename to spree/api/app/controllers/spree/api/v3/seller/base_controller.rb
index cf478b87ca..7d61132ae4 100644
--- a/spree/api/app/controllers/spree/api/v3/vendor/base_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/seller/base_controller.rb
@@ -1,7 +1,7 @@
module Spree
module Api
module V3
- module Vendor
+ module Seller
# Anchor for the marketplace seller panel.
#
# Deliberately not a subclass of the admin anchor: the admin branch
@@ -9,13 +9,13 @@ module Spree
# lookups is precisely how a seller would come to read the whole
# store. Concerns and workflows are shared; controllers are not.
#
- # Mirrors Vendor::ResourceController — they anchor parallel inheritance
+ # Mirrors Seller::ResourceController — they anchor parallel inheritance
# branches, so a concern added to one must be added to the other.
class BaseController < Spree::Api::V3::BaseController
- include Spree::Api::V3::Vendor::VendorContext
- include Spree::Api::V3::VendorAuthentication
+ include Spree::Api::V3::Seller::SellerContext
+ include Spree::Api::V3::SellerAuthentication
- before_action :authenticate_vendor!
+ before_action :authenticate_seller!
include Spree::Api::V3::ScopedAuthorization
end
diff --git a/spree/api/app/controllers/spree/api/v3/vendor/me_controller.rb b/spree/api/app/controllers/spree/api/v3/seller/me_controller.rb
similarity index 62%
rename from spree/api/app/controllers/spree/api/v3/vendor/me_controller.rb
rename to spree/api/app/controllers/spree/api/v3/seller/me_controller.rb
index 1115b8b102..a54e81e22f 100644
--- a/spree/api/app/controllers/spree/api/v3/vendor/me_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/seller/me_controller.rb
@@ -1,17 +1,17 @@
module Spree
module Api
module V3
- module Vendor
- # The signed-in seller: who they are, which vendors they act for, and
+ module Seller
+ # The signed-in seller: who they are, which sellers they act for, and
# what they may do on the selected one.
#
- # Structurally exempt from vendor scoping — this is what tells the
- # panel which X-Spree-Vendor-Id to send, so it has to answer before one
+ # Structurally exempt from seller scoping — this is what tells the
+ # panel which X-Spree-Seller-Id to send, so it has to answer before one
# is chosen. Sending the header still narrows `permission_keys` to that
- # vendor.
- class MeController < Vendor::BaseController
+ # seller.
+ class MeController < Seller::BaseController
skip_scope_check!
- skip_before_action :set_current_vendor_context
+ skip_before_action :set_current_seller_context
before_action :require_current_user!
def show
@@ -23,28 +23,28 @@ module Spree
def me_response
{
user: Spree.api.admin_user_serializer.new(current_user, params: serializer_params).to_h,
- vendors: serialized_vendors,
+ sellers: serialized_sellers,
permission_keys: permission_keys
}
end
- def serialized_vendors
- current_user.vendors.map do |vendor|
- { id: vendor.prefixed_id, name: vendor.name, slug: vendor.slug, status: vendor.status }
+ def serialized_sellers
+ current_user.sellers.map do |seller|
+ { id: seller.prefixed_id, name: seller.name, slug: seller.slug, status: seller.status }
end
end
- # Empty until a vendor is named: capability is per vendor, so there is
+ # Empty until a seller is named: capability is per seller, so there is
# no meaningful answer spanning all of them.
def permission_keys
- return [] if current_vendor.nil?
+ return [] if current_seller.nil?
ability = current_ability
ability.respond_to?(:permission_keys) ? ability.permission_keys : []
end
def serializer_params
- { store: current_store || current_user.vendors.first&.store }
+ { store: current_store || current_user.sellers.first&.store }
end
def require_current_user!
diff --git a/spree/api/app/controllers/spree/api/v3/vendor/resource_controller.rb b/spree/api/app/controllers/spree/api/v3/seller/resource_controller.rb
similarity index 75%
rename from spree/api/app/controllers/spree/api/v3/vendor/resource_controller.rb
rename to spree/api/app/controllers/spree/api/v3/seller/resource_controller.rb
index 5f14ac124d..8cf4d86003 100644
--- a/spree/api/app/controllers/spree/api/v3/vendor/resource_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/seller/resource_controller.rb
@@ -1,45 +1,45 @@
module Spree
module Api
module V3
- module Vendor
+ module Seller
# Anchor for seller-facing CRUD.
#
- # Mirrors Vendor::BaseController's concerns; any concern added to one
+ # Mirrors Seller::BaseController's concerns; any concern added to one
# must be added to the other, since they anchor parallel inheritance
# branches rather than one chain.
class ResourceController < Spree::Api::V3::ResourceController
- include Spree::Api::V3::Vendor::VendorContext
- include Spree::Api::V3::VendorAuthentication
+ include Spree::Api::V3::Seller::SellerContext
+ include Spree::Api::V3::SellerAuthentication
include Spree::Api::V3::ScopedAuthorization
protected
def authenticate_request!
- authenticate_vendor!
+ authenticate_seller!
end
# Every collection is rooted in the seller's own records.
#
# The inherited implementation roots at `for_store(current_store)`,
# which on this branch would hand a seller the whole marketplace —
- # so subclasses name a `vendor_association` and the root scope comes
- # from the vendor itself. Tenancy is this fetch, not the ability:
+ # so subclasses name a `seller_association` and the root scope comes
+ # from the seller itself. Tenancy is this fetch, not the ability:
# authorizing without it reads store-wide.
def scope
return super if @parent.present?
- base_scope = current_vendor.public_send(vendor_association)
+ base_scope = current_seller.public_send(seller_association)
base_scope = base_scope.includes(scope_includes) if scope_includes.any?
base_scope = base_scope.preload_associations_lazily
model_class.include?(Spree::TranslatableResource) ? base_scope.i18n : base_scope
end
- # The vendor association this controller reads through, defaulting to
+ # The seller association this controller reads through, defaulting to
# the model's plural name (`Spree::Product` -> `products`). Override
# when the association is named differently.
#
# @return [Symbol]
- def vendor_association
+ def seller_association
model_class.table_name.delete_prefix('spree_').to_sym
end
diff --git a/spree/api/app/controllers/spree/api/v3/store/vendors_controller.rb b/spree/api/app/controllers/spree/api/v3/store/sellers_controller.rb
similarity index 73%
rename from spree/api/app/controllers/spree/api/v3/store/vendors_controller.rb
rename to spree/api/app/controllers/spree/api/v3/store/sellers_controller.rb
index 58be3fa6d2..05a4e1a31a 100644
--- a/spree/api/app/controllers/spree/api/v3/store/vendors_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/store/sellers_controller.rb
@@ -4,21 +4,21 @@ module Spree
module Store
# Public seller profiles.
#
- # Read-only, and scoped to vendors a shopper can actually buy from: one
+ # Read-only, and scoped to sellers a shopper can actually buy from: one
# still onboarding, suspended or away has nothing to show a customer,
# and listing them would advertise sellers whose products cannot be
# bought.
- class VendorsController < ResourceController
+ class SellersController < ResourceController
include Spree::Api::V3::HttpCaching
protected
def model_class
- Spree::Vendor
+ Spree::Seller
end
def serializer_class
- Spree.api.vendor_serializer
+ Spree.api.seller_serializer
end
def scope
@@ -26,11 +26,11 @@ module Spree
end
# By slug or prefixed ID, so a storefront can route
- # `/vendors/sparks-audio` without holding an id.
+ # `/sellers/sparks-audio` without holding an id.
def find_resource
id = params[:id]
- if id.to_s.start_with?('ven_')
+ if id.to_s.start_with?('sel_')
scope.find_by_prefix_id!(id)
else
scope.find_by!(slug: id)
diff --git a/spree/api/app/serializers/spree/api/v3/admin/commission_line_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/commission_line_serializer.rb
index 0f42cbc1e6..3e7ef15577 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/commission_line_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/commission_line_serializer.rb
@@ -14,8 +14,8 @@ module Spree
# has to show both.
class CommissionLineSerializer < V3::BaseSerializer
typelize order_id: :string,
- vendor_id: :string,
- vendor_name: 'string | null',
+ seller_id: :string,
+ seller_name: 'string | null',
line_item_id: 'string | null',
fulfillment_id: 'string | null',
commission_rate_id: 'string | null',
@@ -48,13 +48,13 @@ module Spree
attribute(formatted) { |line| line.public_send(formatted).to_s }
end
- %i[order vendor line_item fulfillment commission_rate].each do |association|
+ %i[order seller line_item fulfillment commission_rate].each do |association|
attribute(:"#{association}_id") { |line| line.public_send(association)&.prefixed_id }
end
# The seller's name, so a commission table reads without expanding.
- attribute :vendor_name do |line|
- line.vendor&.name
+ attribute :seller_name do |line|
+ line.seller&.name
end
end
end
diff --git a/spree/api/app/serializers/spree/api/v3/admin/line_item_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/line_item_serializer.rb
index 272e43480f..20e5390deb 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/line_item_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/line_item_serializer.rb
@@ -36,11 +36,11 @@ module Spree
many :digital_links, resource: proc { Spree.api.admin_digital_link_serializer }
many :tax_lines, resource: proc { Spree.api.admin_tax_line_serializer }, if: proc { expand?('tax_lines') }
- # `vendor_id` comes from the store serializer; the expand resolves
+ # `seller_id` comes from the store serializer; the expand resolves
# to the operator's view of the seller rather than the public one.
- one :vendor,
- resource: proc { Spree.api.admin_vendor_serializer },
- if: proc { expand?('vendor') }
+ one :seller,
+ resource: proc { Spree.api.admin_seller_serializer },
+ if: proc { expand?('seller') }
one :variant,
resource: proc { Spree.api.admin_variant_serializer },
diff --git a/spree/api/app/serializers/spree/api/v3/admin/product_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/product_serializer.rb
index df6f262c86..c84d5d2dc1 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/product_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/product_serializer.rb
@@ -12,7 +12,7 @@ module Spree
tax_category_id: [:string, nullable: true],
product_type_id: [:string, nullable: true],
delivery_profile_id: [:string, nullable: true],
- vendor_name: [:string, nullable: true],
+ seller_name: [:string, nullable: true],
price: ['Price', nullable: true],
deleted_at: [:string, nullable: true],
metadata: 'Record<string, unknown>'
@@ -25,16 +25,16 @@ module Spree
product.delivery_profile&.prefixed_id
end
- # `vendor_id` comes from the store serializer. The name rides along
+ # `seller_id` comes from the store serializer. The name rides along
# so the products list can show who sells a row without expanding —
- # the full profile is `?expand=vendor`.
- attribute :vendor_name do |product|
- product.vendor&.name
+ # the full profile is `?expand=seller`.
+ attribute :seller_name do |product|
+ product.seller&.name
end
- one :vendor,
- resource: proc { Spree.api.admin_vendor_serializer },
- if: proc { expand?('vendor') }
+ one :seller,
+ resource: proc { Spree.api.admin_seller_serializer },
+ if: proc { expand?('seller') }
attribute :product_type_id do |product|
product.product_type&.prefixed_id
diff --git a/spree/api/app/serializers/spree/api/v3/admin/vendor_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/seller_serializer.rb
similarity index 78%
rename from spree/api/app/serializers/spree/api/v3/admin/vendor_serializer.rb
rename to spree/api/app/serializers/spree/api/v3/admin/seller_serializer.rb
index 083ee64af8..8addca26e0 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/vendor_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/seller_serializer.rb
@@ -5,7 +5,7 @@ module Spree
# A seller as the marketplace operator sees it: the public profile the
# shopper also gets, plus the operational state and the settlement and
# tax configuration only the operator sets.
- class VendorSerializer < V3::VendorSerializer
+ class SellerSerializer < V3::SellerSerializer
typelize status: :string,
contact_email: [:string, nullable: true], billing_email: [:string, nullable: true],
tax_remittance: :string,
@@ -26,18 +26,18 @@ module Spree
updated_at: :iso8601,
deleted_at: :iso8601
- attribute :minimum_payout_amount do |vendor|
- vendor.minimum_payout_amount&.to_s
+ attribute :minimum_payout_amount do |seller|
+ seller.minimum_payout_amount&.to_s
end
# Approved but away still cannot sell, and the list has to say so
# without the dashboard re-deriving the rule.
- attribute :on_holiday do |vendor|
- vendor.on_holiday?
+ attribute :on_holiday do |seller|
+ seller.on_holiday?
end
- attribute :sellable do |vendor|
- vendor.sellable?
+ attribute :sellable do |seller|
+ seller.sellable?
end
# Saves the dashboard a request per row for the two counts its list
@@ -45,21 +45,21 @@ module Spree
# that can run to thousands of rows, and the list only ever renders
# the number. Costs one COUNT per row, which is cheaper than loading
# the catalog into memory to measure it.
- attribute :products_count do |vendor|
- vendor.products.count
+ attribute :products_count do |seller|
+ seller.products.count
end
- attribute :users_count do |vendor|
- vendor.users.size
+ attribute :users_count do |seller|
+ seller.users.size
end
one :billing_address,
resource: proc { Spree.api.admin_address_serializer },
- if: proc { |vendor| vendor.billing_address.present? }
+ if: proc { |seller| seller.billing_address.present? }
one :returns_address,
resource: proc { Spree.api.admin_address_serializer },
- if: proc { |vendor| vendor.returns_address.present? }
+ if: proc { |seller| seller.returns_address.present? }
end
end
end
diff --git a/spree/api/app/serializers/spree/api/v3/admin/stock_transfer_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/stock_transfer_serializer.rb
index 068594ad6b..4d09c4e5f6 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/stock_transfer_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/stock_transfer_serializer.rb
@@ -4,7 +4,7 @@ module Spree
module Admin
# Inventory movement between two stock locations (or external →
# location for receives). The originating location is `nil` for
- # receives (vendor stock arriving) and present for transfers.
+ # receives (seller stock arriving) and present for transfers.
class StockTransferSerializer < V3::BaseSerializer
typelize number: :string,
reference: [:string, nullable: true],
diff --git a/spree/api/app/serializers/spree/api/v3/import_serializer.rb b/spree/api/app/serializers/spree/api/v3/import_serializer.rb
index 3c63338af8..566c9d842a 100644
--- a/spree/api/app/serializers/spree/api/v3/import_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/import_serializer.rb
@@ -23,7 +23,7 @@ module Spree
import.status.to_s
end
- # `"store"` / `"vendor"`, not the polymorphic class name.
+ # `"store"` / `"seller"`, not the polymorphic class name.
attribute :owner_type do |import|
Spree::Base.polymorphic_api_type(import.owner_type)
end
diff --git a/spree/api/app/serializers/spree/api/v3/line_item_serializer.rb b/spree/api/app/serializers/spree/api/v3/line_item_serializer.rb
index da2ff1bed2..38b88b7594 100644
--- a/spree/api/app/serializers/spree/api/v3/line_item_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/line_item_serializer.rb
@@ -15,7 +15,7 @@ module Spree
compare_at_amount: [:string, nullable: true], display_compare_at_amount: [:string, nullable: true],
thumbnail_url: [:string, nullable: true],
preorder: :boolean, preorder_ships_at: [:string, nullable: true],
- vendor_id: [:string, nullable: true]
+ seller_id: [:string, nullable: true]
attribute :variant_id do |line_item|
line_item.variant&.prefixed_id
@@ -24,9 +24,9 @@ module Spree
# Which seller this line was bought from, snapshotted when it was
# added — nil is the operator's own first-party item. Always present
# so a storefront can group a multi-seller cart without paying for the
- # expand; `?expand=vendor` adds the public profile.
- attribute :vendor_id do |line_item|
- line_item.vendor&.prefixed_id
+ # expand; `?expand=seller` adds the public profile.
+ attribute :seller_id do |line_item|
+ line_item.seller&.prefixed_id
end
# True when the line item's variant is currently a pre-order, so the
@@ -66,9 +66,9 @@ module Spree
image_url_for(line_item.thumbnail)
end
- one :vendor,
- resource: proc { Spree.api.vendor_serializer },
- if: proc { expand?('vendor') }
+ one :seller,
+ resource: proc { Spree.api.seller_serializer },
+ if: proc { expand?('seller') }
many :option_values, resource: proc { Spree.api.option_value_serializer }
many :digital_links, resource: proc { Spree.api.digital_link_serializer }
diff --git a/spree/api/app/serializers/spree/api/v3/product_serializer.rb b/spree/api/app/serializers/spree/api/v3/product_serializer.rb
index a59846f8d0..4578dbb44c 100644
--- a/spree/api/app/serializers/spree/api/v3/product_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/product_serializer.rb
@@ -88,15 +88,15 @@ module Spree
# Nil on the marketplace's own first-party products. The id is always
# present so a storefront can group or link by seller without paying
- # for the expand; `?expand=vendor` adds the public profile.
- attribute :vendor_id do |product|
- product.vendor&.prefixed_id
+ # for the expand; `?expand=seller` adds the public profile.
+ attribute :seller_id do |product|
+ product.seller&.prefixed_id
end
# Conditional associations
- one :vendor,
- resource: proc { Spree.api.vendor_serializer },
- if: proc { expand?('vendor') }
+ one :seller,
+ resource: proc { Spree.api.seller_serializer },
+ if: proc { expand?('seller') }
one :primary_media,
resource: proc { Spree.api.media_serializer },
@@ -137,7 +137,7 @@ module Spree
if: proc { expand?('custom_fields') }
typelize prior_price: ['PriceHistory', nullable: true],
- vendor_id: [:string, nullable: true]
+ seller_id: [:string, nullable: true]
attribute :prior_price,
if: proc { expand?('prior_price') } do |product|
diff --git a/spree/api/app/serializers/spree/api/v3/vendor_serializer.rb b/spree/api/app/serializers/spree/api/v3/seller_serializer.rb
similarity index 60%
rename from spree/api/app/serializers/spree/api/v3/vendor_serializer.rb
rename to spree/api/app/serializers/spree/api/v3/seller_serializer.rb
index 155ba5af32..82f99df8ac 100644
--- a/spree/api/app/serializers/spree/api/v3/vendor_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/seller_serializer.rb
@@ -5,10 +5,10 @@ module Spree
# nothing about how the marketplace runs them.
#
# Deliberately excluded, because none of it is the customer's business:
- # `status` and `sellable` (operational state — a vendor a shopper can
+ # `status` and `sellable` (operational state — a seller a shopper can
# reach is by definition sellable), the settlement and tax configuration,
# billing and contact addresses, team size, and every timestamp.
- class VendorSerializer < BaseSerializer
+ class SellerSerializer < BaseSerializer
typelize name: :string, slug: :string,
about: :string, about_html: :string,
logo_url: [:string, nullable: true],
@@ -17,24 +17,24 @@ module Spree
attributes :name, :slug
- attribute :about do |vendor|
- Spree::RichTextHelper.to_plain_text(vendor.about)
+ attribute :about do |seller|
+ Spree::RichTextHelper.to_plain_text(seller.about)
end
- attribute :about_html do |vendor|
- vendor.about_html
+ attribute :about_html do |seller|
+ seller.about_html
end
- attribute :logo_url do |vendor|
- image_url_for(vendor.logo)
+ attribute :logo_url do |seller|
+ image_url_for(seller.logo)
end
- attribute :square_logo_url do |vendor|
- image_url_for(vendor.square_logo)
+ attribute :square_logo_url do |seller|
+ image_url_for(seller.square_logo)
end
- attribute :cover_photo_url do |vendor|
- image_url_for(vendor.cover_photo)
+ attribute :cover_photo_url do |seller|
+ image_url_for(seller.cover_photo)
end
end
end
diff --git a/spree/api/config/routes.rb b/spree/api/config/routes.rb
index 5d651ecee2..2b6b24030e 100644
--- a/spree/api/config/routes.rb
+++ b/spree/api/config/routes.rb
@@ -30,8 +30,8 @@ Spree::Core::Engine.add_routes do
end
end
# Public seller profiles. Read-only, and only sellers a shopper can
- # actually buy from — see Store::VendorsController.
- resources :vendors, only: [:index, :show], id: /.+/
+ # actually buy from — see Store::SellersController.
+ resources :sellers, only: [:index, :show], id: /.+/
resources :categories, only: [:index, :show], id: /.+/
resources :collections, only: [:index, :show] do
@@ -432,7 +432,7 @@ Spree::Core::Engine.add_routes do
# Marketplace sellers. Each status change is its own member action
# because each one is a workflow with its own arguments — mass
# assignment would skip the mail and the extension hooks.
- resources :vendors, concerns: :custom_fieldable do
+ resources :sellers, concerns: :custom_fieldable do
member do
post :invite
patch :approve
@@ -602,9 +602,9 @@ Spree::Core::Engine.add_routes do
# The marketplace seller panel. A branch of its own rather than a
# narrowing of :admin — every endpoint here scope-fetches through
- # current_vendor, which is what makes cross-seller access impossible by
+ # current_seller, which is what makes cross-seller access impossible by
# construction rather than by rule.
- namespace :vendor do
+ namespace :seller do
# Everything unauthenticated lives under auth/, so the refresh
# cookie's path covers it and nothing else.
post 'auth/login', to: 'auth#create'
diff --git a/spree/api/lib/spree/api/dependencies.rb b/spree/api/lib/spree/api/dependencies.rb
index 8c493e2e05..fe89812e1d 100644
--- a/spree/api/lib/spree/api/dependencies.rb
+++ b/spree/api/lib/spree/api/dependencies.rb
@@ -152,8 +152,8 @@ module Spree
admin_company_contact_serializer: 'Spree::Api::V3::Admin::CompanyContactSerializer',
admin_tax_exemption_certificate_serializer: 'Spree::Api::V3::Admin::TaxExemptionCertificateSerializer',
admin_admin_user_serializer: 'Spree::Api::V3::Admin::AdminUserSerializer',
- vendor_serializer: 'Spree::Api::V3::VendorSerializer',
- admin_vendor_serializer: 'Spree::Api::V3::Admin::VendorSerializer',
+ seller_serializer: 'Spree::Api::V3::SellerSerializer',
+ admin_seller_serializer: 'Spree::Api::V3::Admin::SellerSerializer',
admin_commission_rate_serializer: 'Spree::Api::V3::Admin::CommissionRateSerializer',
admin_commission_rule_serializer: 'Spree::Api::V3::Admin::CommissionRuleSerializer',
admin_commission_line_serializer: 'Spree::Api::V3::Admin::CommissionLineSerializer',
diff --git a/spree/api/lib/spree/api/testing_support/v3/base.rb b/spree/api/lib/spree/api/testing_support/v3/base.rb
index 793903e1e5..3bd0b6e0ea 100644
--- a/spree/api/lib/spree/api/testing_support/v3/base.rb
+++ b/spree/api/lib/spree/api/testing_support/v3/base.rb
@@ -80,31 +80,31 @@ shared_context 'API v3 Admin authenticated' do
let(:headers) { bearer_headers }
end
-# The marketplace seller panel. Deliberately no `current_vendor` stub: the
+# The marketplace seller panel. Deliberately no `current_seller` stub: the
# header and the membership lookup behind it are what these specs exist to
# exercise, so stubbing them would test nothing.
-shared_context 'API v3 Vendor' do
+shared_context 'API v3 Seller' do
let(:store) { @default_store || create(:store, default: true) }
- let(:vendor) { create(:vendor, :approved, store: store) }
- let(:vendor_role) { create(:role, name: 'Seller', resource: vendor, permissions: %w[write_products]) }
- let(:vendor_user) do
- create(:admin_user, :without_admin_role).tap { |user| vendor.add_user(user, vendor_role) }
+ let(:seller) { create(:seller, :approved, store: store) }
+ let(:seller_role) { create(:role, name: 'Seller', resource: seller, permissions: %w[write_products]) }
+ let(:seller_user) do
+ create(:admin_user, :without_admin_role).tap { |user| seller.add_user(user, seller_role) }
end
- let(:vendor_jwt_token) do
+ let(:seller_jwt_token) do
Spree::Api::V3::TestingSupport.generate_jwt(
- vendor_user, audience: Spree::Api::V3::JwtAuthentication::JWT_AUDIENCE_VENDOR
+ seller_user, audience: Spree::Api::V3::JwtAuthentication::JWT_AUDIENCE_SELLER
)
end
- let(:vendor_headers) do
- { 'Authorization' => "Bearer #{vendor_jwt_token}", 'X-Spree-Vendor-Id' => vendor.prefixed_id }
+ let(:seller_headers) do
+ { 'Authorization' => "Bearer #{seller_jwt_token}", 'X-Spree-Seller-Id' => seller.prefixed_id }
end
end
-shared_context 'API v3 Vendor authenticated' do
- include_context 'API v3 Vendor'
+shared_context 'API v3 Seller authenticated' do
+ include_context 'API v3 Seller'
- let(:headers) { vendor_headers }
+ let(:headers) { seller_headers }
end
# Authenticates as an admin whose ability is restricted to specific catalog
diff --git a/spree/api/spec/controllers/spree/api/v3/admin/base_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/base_controller_spec.rb
index 812c3c9782..219f1aa203 100644
--- a/spree/api/spec/controllers/spree/api/v3/admin/base_controller_spec.rb
+++ b/spree/api/spec/controllers/spree/api/v3/admin/base_controller_spec.rb
@@ -200,7 +200,7 @@ RSpec.describe Spree::Api::V3::Admin::BaseController, type: :controller do
# A role held on a non-store resource binds to that resource's store, so
# matching membership on store_id alone would admit its holder here. The
- # stand-in resource plays the part of a marketplace vendor until the Vendor
+ # stand-in resource plays the part of a marketplace seller until the Seller
# model lands.
context 'with an admin JWT whose only role is on a non-store resource of this store' do
let(:panel) { create(:customer_group, store: store) }
diff --git a/spree/api/spec/controllers/spree/api/v3/admin/commission_lines_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/commission_lines_controller_spec.rb
index b3d74cf160..653bb0a74c 100644
--- a/spree/api/spec/controllers/spree/api/v3/admin/commission_lines_controller_spec.rb
+++ b/spree/api/spec/controllers/spree/api/v3/admin/commission_lines_controller_spec.rb
@@ -5,11 +5,11 @@ RSpec.describe Spree::Api::V3::Admin::CommissionLinesController, type: :controll
include_context 'API v3 Admin authenticated'
- let(:vendor) { create(:vendor, :approved, store: store, name: 'Sparks Audio') }
+ let(:seller) { create(:seller, :approved, store: store, name: 'Sparks Audio') }
let(:order) { create(:order, store: store) }
let(:line_item) { create(:line_item, order: order) }
let!(:commission_line) do
- create(:commission_line, order: order, vendor: vendor, line_item: line_item,
+ create(:commission_line, order: order, seller: seller, line_item: line_item,
amount: 10, tax_amount: 2.1, total: 12.1, currency: 'USD')
end
@@ -22,7 +22,7 @@ RSpec.describe Spree::Api::V3::Admin::CommissionLinesController, type: :controll
expect(response).to have_http_status(:ok)
row = json_response['data'].first
expect(row['id']).to start_with('cline_')
- expect(row['vendor_name']).to eq('Sparks Audio')
+ expect(row['seller_name']).to eq('Sparks Audio')
expect(row['amount']).to eq('10.0')
expect(row['tax_amount']).to eq('2.1')
expect(row['total']).to eq('12.1')
@@ -33,7 +33,7 @@ RSpec.describe Spree::Api::V3::Admin::CommissionLinesController, type: :controll
other_store = create(:store)
other = create(:commission_line,
order: create(:order, store: other_store),
- vendor: create(:vendor, store: other_store),
+ seller: create(:seller, store: other_store),
line_item: create(:line_item))
get :index, as: :json
@@ -47,7 +47,7 @@ RSpec.describe Spree::Api::V3::Admin::CommissionLinesController, type: :controll
other_store = create(:store)
other = create(:commission_line,
order: create(:order, store: other_store),
- vendor: create(:vendor, store: other_store),
+ seller: create(:seller, store: other_store),
line_item: create(:line_item))
get :show, params: { id: other.prefixed_id }, as: :json
diff --git a/spree/api/spec/controllers/spree/api/v3/admin/commission_rates_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/commission_rates_controller_spec.rb
index 93461733ce..065749f80a 100644
--- a/spree/api/spec/controllers/spree/api/v3/admin/commission_rates_controller_spec.rb
+++ b/spree/api/spec/controllers/spree/api/v3/admin/commission_rates_controller_spec.rb
@@ -6,13 +6,13 @@ RSpec.describe Spree::Api::V3::Admin::CommissionRatesController, type: :controll
include_context 'API v3 Admin authenticated'
let!(:rate) { create(:commission_rate, store: store, name: 'Standard', value: 10) }
- let(:vendor) { create(:vendor, store: store) }
+ let(:seller) { create(:seller, store: store) }
before { request.headers.merge!(headers) }
describe 'GET #index' do
it 'lists the store rates with their targeting' do
- create(:commission_vendor_rule, commission_rate: rate, vendors: [vendor])
+ create(:commission_seller_rule, commission_rate: rate, sellers: [seller])
get :index, as: :json
@@ -21,7 +21,7 @@ RSpec.describe Spree::Api::V3::Admin::CommissionRatesController, type: :controll
expect(row['id']).to start_with('crate_')
expect(row['name']).to eq('Standard')
expect(row['kind']).to eq('percentage')
- expect(row['rules'].first).to include('type' => 'vendor_rule', 'label' => 'Seller')
+ expect(row['rules'].first).to include('type' => 'seller_rule', 'label' => 'Seller')
end
it "hides another marketplace's rates" do
@@ -49,12 +49,12 @@ RSpec.describe Spree::Api::V3::Admin::CommissionRatesController, type: :controll
name: 'Audio sellers',
kind: 'percentage',
value: 12.5,
- rules: [{ type: 'vendor_rule', preferences: { vendor_ids: [vendor.prefixed_id] } }]
+ rules: [{ type: 'seller_rule', preferences: { seller_ids: [seller.prefixed_id] } }]
}, as: :json
expect(response).to have_http_status(:created)
expect(json_response['value']).to eq('12.5')
- expect(json_response['rules'].first['type']).to eq('vendor_rule')
+ expect(json_response['rules'].first['type']).to eq('seller_rule')
end
it 'refuses a fixed rate that states no amount anywhere' do
@@ -79,7 +79,7 @@ RSpec.describe Spree::Api::V3::Admin::CommissionRatesController, type: :controll
describe 'PATCH #update' do
it 'replaces the targeting wholesale' do
- create(:commission_vendor_rule, commission_rate: rate, vendors: [vendor])
+ create(:commission_seller_rule, commission_rate: rate, sellers: [seller])
category = create(:category, store: store)
patch :update, params: {
@@ -96,16 +96,16 @@ RSpec.describe Spree::Api::V3::Admin::CommissionRatesController, type: :controll
# rather than having it silently dropped — and the rate keeps the targeting
# it had, since a half-applied payload could widen what it charges.
it 'refuses a rule naming another store record, leaving the targeting alone' do
- create(:commission_vendor_rule, commission_rate: rate, vendors: [vendor])
- foreign_vendor = create(:vendor, store: create(:store))
+ create(:commission_seller_rule, commission_rate: rate, sellers: [seller])
+ foreign_seller = create(:seller, store: create(:store))
patch :update, params: {
id: rate.prefixed_id,
- rules: [{ type: 'vendor_rule', preferences: { vendor_ids: [foreign_vendor.prefixed_id] } }]
+ rules: [{ type: 'seller_rule', preferences: { seller_ids: [foreign_seller.prefixed_id] } }]
}, as: :json
expect(response).to have_http_status(:not_found)
- expect(rate.reload.commission_rules.map(&:class)).to eq([Spree::CommissionRules::VendorRule])
+ expect(rate.reload.commission_rules.map(&:class)).to eq([Spree::CommissionRules::SellerRule])
end
it 'refuses a rule kind nobody registered' do
@@ -120,14 +120,14 @@ RSpec.describe Spree::Api::V3::Admin::CommissionRatesController, type: :controll
it 'refuses a rule naming a record that no longer exists' do
patch :update, params: {
id: rate.prefixed_id,
- rules: [{ type: 'vendor_rule', preferences: { vendor_ids: ['ven_gone'] } }]
+ rules: [{ type: 'seller_rule', preferences: { seller_ids: ['sel_gone'] } }]
}, as: :json
expect(response).to have_http_status(:not_found)
end
it 'still accepts an empty list as clearing the targeting' do
- create(:commission_vendor_rule, commission_rate: rate, vendors: [vendor])
+ create(:commission_seller_rule, commission_rate: rate, sellers: [seller])
patch :update, params: { id: rate.prefixed_id, rules: [] }, as: :json
@@ -206,7 +206,7 @@ RSpec.describe Spree::Api::V3::Admin::CommissionRatesController, type: :controll
expect(response).to have_http_status(:ok)
types = json_response['data']
expect(types.map { |row| row['type'] }).
- to include('vendor_rule', 'category_rule', 'product_rule', 'item_total_rule')
+ to include('seller_rule', 'category_rule', 'product_rule', 'item_total_rule')
band = types.find { |row| row['type'] == 'item_total_rule' }
expect(band['name']).to eq('Sale value')
diff --git a/spree/api/spec/controllers/spree/api/v3/admin/invitations_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/invitations_controller_spec.rb
index 0f28814d2c..8a723414ed 100644
--- a/spree/api/spec/controllers/spree/api/v3/admin/invitations_controller_spec.rb
+++ b/spree/api/spec/controllers/spree/api/v3/admin/invitations_controller_spec.rb
@@ -80,10 +80,10 @@ RSpec.describe Spree::Api::V3::Admin::InvitationsController, type: :controller d
# on this store — the invitation is rejected as invalid rather than
# unauthorized, since it is not a privilege question but a nonsensical one.
it 'refuses inviting store staff into a role owned by another resource' do
- vendor_role = create(:role, name: 'vendor_manager', resource: create(:customer_group))
+ seller_role = create(:role, name: 'seller_manager', resource: create(:customer_group))
expect {
- post :create, params: { email: '[email protected]', role_id: vendor_role.prefixed_id }, as: :json
+ post :create, params: { email: '[email protected]', role_id: seller_role.prefixed_id }, as: :json
}.not_to change(Spree::Invitation, :count)
expect(response).to have_http_status(:unprocessable_content)
diff --git a/spree/api/spec/controllers/spree/api/v3/admin/products_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/products_controller_spec.rb
index bb7fd62349..b96ffc85ff 100644
--- a/spree/api/spec/controllers/spree/api/v3/admin/products_controller_spec.rb
+++ b/spree/api/spec/controllers/spree/api/v3/admin/products_controller_spec.rb
@@ -7,37 +7,37 @@ RSpec.describe Spree::Api::V3::Admin::ProductsController, type: :controller do
let!(:product) { create(:product) }
- describe 'vendor' do
- let!(:vendor) { create(:vendor, store: store, name: 'Sparks Audio') }
- let!(:vendor_product) { create(:product, store: store, vendor: vendor, name: 'Vendor Item') }
+ describe 'seller' do
+ let!(:seller) { create(:seller, store: store, name: 'Sparks Audio') }
+ let!(:seller_product) { create(:product, store: store, seller: seller, name: 'Seller Item') }
let!(:own_product) { create(:product, store: store, name: 'First Party Item') }
before { request.headers.merge!(headers) }
# The name rides along so a products list can show who sells a row without
- # a request per vendor.
+ # a request per seller.
it 'serializes the seller, and nothing for a first-party product' do
get :index, as: :json
rows = json_response['data'].index_by { |row| row['name'] }
- expect(rows['Vendor Item']['vendor_id']).to eq(vendor.prefixed_id)
- expect(rows['Vendor Item']['vendor_name']).to eq('Sparks Audio')
- expect(rows['First Party Item']['vendor_id']).to be_nil
- expect(rows['First Party Item']['vendor_name']).to be_nil
+ expect(rows['Seller Item']['seller_id']).to eq(seller.prefixed_id)
+ expect(rows['Seller Item']['seller_name']).to eq('Sparks Audio')
+ expect(rows['First Party Item']['seller_id']).to be_nil
+ expect(rows['First Party Item']['seller_name']).to be_nil
end
it 'filters to one seller' do
- get :index, params: { q: { vendor_id_eq: vendor.id } }, as: :json
+ get :index, params: { q: { seller_id_eq: seller.id } }, as: :json
- expect(json_response['data'].pluck('name')).to eq(['Vendor Item'])
+ expect(json_response['data'].pluck('name')).to eq(['Seller Item'])
end
# "Sold by us" is a question a marketplace operator asks constantly.
it 'filters to the products nobody sells but the marketplace' do
- get :index, params: { q: { vendor_id_null: true } }, as: :json
+ get :index, params: { q: { seller_id_null: true } }, as: :json
expect(json_response['data'].pluck('name')).to include('First Party Item')
- expect(json_response['data'].pluck('name')).not_to include('Vendor Item')
+ expect(json_response['data'].pluck('name')).not_to include('Seller Item')
end
end
diff --git a/spree/api/spec/controllers/spree/api/v3/admin/roles_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/roles_controller_spec.rb
index a2b68a6614..d4204f6208 100644
--- a/spree/api/spec/controllers/spree/api/v3/admin/roles_controller_spec.rb
+++ b/spree/api/spec/controllers/spree/api/v3/admin/roles_controller_spec.rb
@@ -28,12 +28,12 @@ RSpec.describe Spree::Api::V3::Admin::RolesController, type: :controller do
# The staff Roles page feeds the staff role picker, so a role owned by
# another resource would be assignable to store staff.
it 'omits roles owned by another resource' do
- create(:role, name: 'vendor_manager', resource: create(:customer_group))
+ create(:role, name: 'seller_manager', resource: create(:customer_group))
get :index, as: :json
names = json_response['data'].map { |r| r['name'] }
- expect(names).not_to include('vendor_manager')
+ expect(names).not_to include('seller_manager')
end
it 'reports the admin role as immutable with the full catalog' do
@@ -86,15 +86,15 @@ RSpec.describe Spree::Api::V3::Admin::RolesController, type: :controller do
expect(Spree::Role.find_by(name: 'sneaky')).to be_nil
end
- # A role owned by another resource (a marketplace vendor) confers nothing
+ # A role owned by another resource (a marketplace seller) confers nothing
# in the store admin, so it must not widen what the caller may grant.
it 'ignores keys the caller holds only on a non-store resource' do
Spree.permissions.register_resource(
:products, group: :catalog, audiences: %i[dummy_model], subjects: -> { [Spree::Product] }
)
create(:role_user, user: staffer,
- role: create(:role, name: 'vendor_catalog', permissions: %w[write_products],
- resource: Spree::DummyModel.create!(name: 'Vendor A')))
+ role: create(:role, name: 'seller_catalog', permissions: %w[write_products],
+ resource: Spree::DummyModel.create!(name: 'Seller A')))
post :create, params: { name: 'sneaky', permissions: %w[write_products] }, as: :json
diff --git a/spree/api/spec/controllers/spree/api/v3/admin/vendors_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/sellers_controller_spec.rb
similarity index 68%
rename from spree/api/spec/controllers/spree/api/v3/admin/vendors_controller_spec.rb
rename to spree/api/spec/controllers/spree/api/v3/admin/sellers_controller_spec.rb
index 55cdf4fbde..6426fe5303 100644
--- a/spree/api/spec/controllers/spree/api/v3/admin/vendors_controller_spec.rb
+++ b/spree/api/spec/controllers/spree/api/v3/admin/sellers_controller_spec.rb
@@ -1,11 +1,11 @@
require 'spec_helper'
-RSpec.describe Spree::Api::V3::Admin::VendorsController, type: :controller do
+RSpec.describe Spree::Api::V3::Admin::SellersController, type: :controller do
render_views
include_context 'API v3 Admin authenticated'
- let!(:vendor) { create(:vendor, store: store, name: 'Sparks Audio', contact_email: '[email protected]') }
+ let!(:seller) { create(:seller, store: store, name: 'Sparks Audio', contact_email: '[email protected]') }
before { request.headers.merge!(headers) }
@@ -15,13 +15,13 @@ RSpec.describe Spree::Api::V3::Admin::VendorsController, type: :controller do
expect(response).to have_http_status(:ok)
row = json_response['data'].first
- expect(row['id']).to start_with('ven_')
+ expect(row['id']).to start_with('sel_')
expect(row['name']).to eq('Sparks Audio')
expect(row['status']).to eq('pending')
end
it "hides another marketplace's sellers" do
- other = create(:vendor, store: create(:store))
+ other = create(:seller, store: create(:store))
get :index, as: :json
@@ -31,9 +31,9 @@ RSpec.describe Spree::Api::V3::Admin::VendorsController, type: :controller do
# The team is preloaded and counted in Ruby; the catalog is counted in SQL,
# so a seller with thousands of products never loads them just to show a
# number.
- it 'never loads a vendor catalog to count it' do
- vendor.products << create(:product, store: store)
- 3.times { create(:vendor, store: store) }
+ it 'never loads a seller catalog to count it' do
+ seller.products << create(:product, store: store)
+ 3.times { create(:seller, store: store) }
product_row_loads = 0
team_counts = 0
@@ -51,7 +51,7 @@ RSpec.describe Spree::Api::V3::Admin::VendorsController, type: :controller do
end
it 'says whether a seller can be bought from right now' do
- vendor.update!(status: 'approved', holiday_mode_until: 2.weeks.from_now)
+ seller.update!(status: 'approved', holiday_mode_until: 2.weeks.from_now)
get :index, as: :json
@@ -63,14 +63,14 @@ RSpec.describe Spree::Api::V3::Admin::VendorsController, type: :controller do
describe 'GET #show' do
it 'returns the seller profile' do
- get :show, params: { id: vendor.prefixed_id }, as: :json
+ get :show, params: { id: seller.prefixed_id }, as: :json
expect(response).to have_http_status(:ok)
expect(json_response['contact_email']).to eq('[email protected]')
end
it "404s on another marketplace's seller" do
- other = create(:vendor, store: create(:store))
+ other = create(:seller, store: create(:store))
get :show, params: { id: other.prefixed_id }, as: :json
@@ -97,30 +97,30 @@ RSpec.describe Spree::Api::V3::Admin::VendorsController, type: :controller do
describe 'PATCH #update' do
it 'edits the profile and the settlement configuration' do
patch :update, params: {
- id: vendor.prefixed_id,
+ id: seller.prefixed_id,
billing_email: '[email protected]',
payouts_schedule_interval: 'weekly',
minimum_payout_amount: '25.0'
}, as: :json
expect(response).to have_http_status(:ok)
- expect(vendor.reload.billing_email).to eq('[email protected]')
- expect(vendor.payouts_schedule_interval).to eq('weekly')
+ expect(seller.reload.billing_email).to eq('[email protected]')
+ expect(seller.payouts_schedule_interval).to eq('weekly')
end
# The transitions are workflows; a PATCH that moved status would skip the
# mail, the payout provisioning and the extension hooks.
it 'ignores a status sent through mass assignment' do
- patch :update, params: { id: vendor.prefixed_id, status: 'approved' }, as: :json
+ patch :update, params: { id: seller.prefixed_id, status: 'approved' }, as: :json
expect(response).to have_http_status(:ok)
- expect(vendor.reload).to be_pending
+ expect(seller.reload).to be_pending
end
# Written as `about`, read back as both the plain text and the markup —
# the column holds HTML either way.
it 'keeps the markup in the description' do
- patch :update, params: { id: vendor.prefixed_id, about: '<p>Independent <em>hi-fi</em>.</p>' },
+ patch :update, params: { id: seller.prefixed_id, about: '<p>Independent <em>hi-fi</em>.</p>' },
as: :json
expect(response).to have_http_status(:ok)
@@ -129,10 +129,10 @@ RSpec.describe Spree::Api::V3::Admin::VendorsController, type: :controller do
end
it 'strips scripts out of the description' do
- patch :update, params: { id: vendor.prefixed_id, about: '<p>Hi</p><script>alert(1)</script>' },
+ patch :update, params: { id: seller.prefixed_id, about: '<p>Hi</p><script>alert(1)</script>' },
as: :json
- expect(vendor.reload.about_html).not_to include('script')
+ expect(seller.reload.about_html).not_to include('script')
end
# An address carries no store of its own, so an id would bind an arbitrary
@@ -141,30 +141,30 @@ RSpec.describe Spree::Api::V3::Admin::VendorsController, type: :controller do
victim = create(:user)
foreign = create(:address, user: victim, address1: '99 Secret Lane')
- patch :update, params: { id: vendor.prefixed_id, billing_address_id: foreign.prefixed_id },
+ patch :update, params: { id: seller.prefixed_id, billing_address_id: foreign.prefixed_id },
as: :json
- expect(vendor.reload.billing_address_id).to be_nil
+ expect(seller.reload.billing_address_id).to be_nil
expect(json_response).not_to have_key('billing_address')
end
it 'ignores a raw integer address id too' do
foreign = create(:address, user: create(:user))
- patch :update, params: { id: vendor.prefixed_id, billing_address_id: foreign.id.to_s }, as: :json
+ patch :update, params: { id: seller.prefixed_id, billing_address_id: foreign.id.to_s }, as: :json
- expect(vendor.reload.billing_address_id).to be_nil
+ expect(seller.reload.billing_address_id).to be_nil
end
- it 'creates the vendor its own address from nested attributes' do
+ it 'creates the seller its own address from nested attributes' do
patch :update, params: {
- id: vendor.prefixed_id,
- billing_address: { first_name: 'Ada', last_name: 'Lovelace', address1: '1 Vendor Way',
+ id: seller.prefixed_id,
+ billing_address: { first_name: 'Ada', last_name: 'Lovelace', address1: '1 Seller Way',
city: 'London', postal_code: 'EC1A 1BB', country_code: 'GB', phone: '555' }
}, as: :json
expect(response).to have_http_status(:ok)
- expect(vendor.reload.billing_address.address1).to eq('1 Vendor Way')
+ expect(seller.reload.billing_address.address1).to eq('1 Seller Way')
expect(json_response['billing_address']['city']).to eq('London')
end
@@ -175,10 +175,10 @@ RSpec.describe Spree::Api::V3::Admin::VendorsController, type: :controller do
filename: 'thinking-cat.jpg', content_type: 'image/jpeg'
)
- patch :update, params: { id: vendor.prefixed_id, logo: blob.signed_id }, as: :json
+ patch :update, params: { id: seller.prefixed_id, logo: blob.signed_id }, as: :json
expect(response).to have_http_status(:ok)
- expect(vendor.reload.logo).to be_attached
+ expect(seller.reload.logo).to be_attached
expect(json_response['logo_url']).to be_present
end
@@ -188,123 +188,123 @@ RSpec.describe Spree::Api::V3::Admin::VendorsController, type: :controller do
filename: 'cover.jpg', content_type: 'image/jpeg'
)
- patch :update, params: { id: vendor.prefixed_id, cover_photo: blob.signed_id }, as: :json
+ patch :update, params: { id: seller.prefixed_id, cover_photo: blob.signed_id }, as: :json
- expect(vendor.reload.cover_photo).to be_attached
+ expect(seller.reload.cover_photo).to be_attached
expect(json_response['cover_photo_url']).to be_present
end
it 'purges the logo when logo is set to null' do
- vendor.logo.attach(
+ seller.logo.attach(
io: File.new(Spree::Core::Engine.root.join('spec', 'fixtures', 'thinking-cat.jpg')),
filename: 'thinking-cat.jpg'
)
- patch :update, params: { id: vendor.prefixed_id, logo: nil }, as: :json
+ patch :update, params: { id: seller.prefixed_id, logo: nil }, as: :json
expect(response).to have_http_status(:ok)
- expect(vendor.reload.logo).not_to be_attached
+ expect(seller.reload.logo).not_to be_attached
end
end
- # Spree::Vendor includes HasCustomFields and the controller permits them, so
+ # Spree::Seller includes HasCustomFields and the controller permits them, so
# the nested endpoints have to exist for a client to read or write one.
describe 'custom fields' do
it 'mounts the nested custom_fields resource' do
- expect(get: "/api/v3/admin/vendors/#{vendor.prefixed_id}/custom_fields").to be_routable
+ expect(get: "/api/v3/admin/sellers/#{seller.prefixed_id}/custom_fields").to be_routable
end
end
describe 'POST #invite' do
it "invites someone into the seller's own team" do
- post :invite, params: { id: vendor.prefixed_id, email: '[email protected]' }, as: :json
+ post :invite, params: { id: seller.prefixed_id, email: '[email protected]' }, as: :json
expect(response).to have_http_status(:created)
- expect(vendor.reload).to be_invited
- expect(vendor.invitations.last.role.resource).to eq(vendor)
+ expect(seller.reload).to be_invited
+ expect(seller.invitations.last.role.resource).to eq(seller)
end
it 'refuses a role from another team' do
store_role = Spree::Role.default_admin_role(store)
- post :invite, params: { id: vendor.prefixed_id, email: '[email protected]', role_id: store_role.prefixed_id },
+ post :invite, params: { id: seller.prefixed_id, email: '[email protected]', role_id: store_role.prefixed_id },
as: :json
expect(response).to have_http_status(:not_found)
- expect(vendor.reload).to be_pending
+ expect(seller.reload).to be_pending
end
end
describe 'PATCH #approve' do
it 'lets an applicant under review trade' do
- vendor.update!(status: 'ready_for_review')
+ seller.update!(status: 'ready_for_review')
- patch :approve, params: { id: vendor.prefixed_id }, as: :json
+ patch :approve, params: { id: seller.prefixed_id }, as: :json
expect(response).to have_http_status(:ok)
- expect(vendor.reload).to be_approved
+ expect(seller.reload).to be_approved
end
it 'refuses one that has not applied yet' do
- patch :approve, params: { id: vendor.prefixed_id }, as: :json
+ patch :approve, params: { id: seller.prefixed_id }, as: :json
expect(response).to have_http_status(:unprocessable_content)
end
end
describe 'PATCH #suspend' do
- before { vendor.update!(status: 'approved') }
+ before { seller.update!(status: 'approved') }
it 'stops a trading seller and keeps the reason' do
- patch :suspend, params: { id: vendor.prefixed_id, reason: 'Counterfeit goods' }, as: :json
+ patch :suspend, params: { id: seller.prefixed_id, reason: 'Counterfeit goods' }, as: :json
expect(response).to have_http_status(:ok)
- expect(vendor.reload).to be_suspended
- expect(vendor.metadata['suspension_reason']).to eq('Counterfeit goods')
+ expect(seller.reload).to be_suspended
+ expect(seller.metadata['suspension_reason']).to eq('Counterfeit goods')
end
end
describe 'PATCH #reject' do
it 'turns down an applicant' do
- vendor.update!(status: 'ready_for_review')
+ seller.update!(status: 'ready_for_review')
- patch :reject, params: { id: vendor.prefixed_id, reason: 'Incomplete paperwork' }, as: :json
+ patch :reject, params: { id: seller.prefixed_id, reason: 'Incomplete paperwork' }, as: :json
expect(response).to have_http_status(:ok)
- expect(vendor.reload).to be_rejected
+ expect(seller.reload).to be_rejected
end
it 'refuses one already trading — suspension is the right move there' do
- vendor.update!(status: 'approved')
+ seller.update!(status: 'approved')
- patch :reject, params: { id: vendor.prefixed_id }, as: :json
+ patch :reject, params: { id: seller.prefixed_id }, as: :json
expect(response).to have_http_status(:unprocessable_content)
end
end
describe 'DELETE #destroy' do
- # A vendor's roles refuse deletion while anyone holds them. That guard is
- # for deleting a role on its own; when the whole vendor goes, its team goes
- # with it — otherwise an invited vendor could never be removed.
+ # A seller's roles refuse deletion while anyone holds them. That guard is
+ # for deleting a role on its own; when the whole seller goes, its team goes
+ # with it — otherwise an invited seller could never be removed.
it 'removes a seller that has already been invited' do
- Spree::Vendors::Invite.call(vendor: vendor, email: '[email protected]',
+ Spree::Sellers::Invite.call(seller: seller, email: '[email protected]',
inviter: create(:admin_user))
- delete :destroy, params: { id: vendor.prefixed_id }, as: :json
+ delete :destroy, params: { id: seller.prefixed_id }, as: :json
expect(response).to have_http_status(:no_content)
- expect(Spree::Vendor.find_by(id: vendor.id)).to be_nil
- expect(Spree::Role.where(resource: vendor)).to be_empty
+ expect(Spree::Seller.find_by(id: seller.id)).to be_nil
+ expect(Spree::Role.where(resource: seller)).to be_empty
end
it 'removes the seller but keeps their catalog' do
- product = create(:product, store: store, vendor: vendor)
+ product = create(:product, store: store, seller: seller)
- delete :destroy, params: { id: vendor.prefixed_id }, as: :json
+ delete :destroy, params: { id: seller.prefixed_id }, as: :json
expect(response).to have_http_status(:no_content)
- expect(product.reload.vendor_id).to be_nil
+ expect(product.reload.seller_id).to be_nil
end
end
end
diff --git a/spree/api/spec/controllers/spree/api/v3/admin/stock_transfers_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/stock_transfers_controller_spec.rb
index 713703b49f..d4ae0123c4 100644
--- a/spree/api/spec/controllers/spree/api/v3/admin/stock_transfers_controller_spec.rb
+++ b/spree/api/spec/controllers/spree/api/v3/admin/stock_transfers_controller_spec.rb
@@ -46,7 +46,7 @@ RSpec.describe Spree::Api::V3::Admin::StockTransfersController, type: :controlle
expect(destination_location.stock_item(variant).reload.count_on_hand).to eq(5)
end
- it 'receives from external vendor when source is omitted' do
+ it 'receives from external seller when source is omitted' do
post :create, params: base_params.except(:source_location_id), as: :json
expect(response).to have_http_status(:created)
diff --git a/spree/api/spec/controllers/spree/api/v3/vendor/base_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/seller/base_controller_spec.rb
similarity index 55%
rename from spree/api/spec/controllers/spree/api/v3/vendor/base_controller_spec.rb
rename to spree/api/spec/controllers/spree/api/v3/seller/base_controller_spec.rb
index 3eb8dc82dc..86bb202b57 100644
--- a/spree/api/spec/controllers/spree/api/v3/vendor/base_controller_spec.rb
+++ b/spree/api/spec/controllers/spree/api/v3/seller/base_controller_spec.rb
@@ -1,43 +1,43 @@
require 'spec_helper'
-# Anonymous controller so the branch's authentication and vendor resolution can
+# Anonymous controller so the branch's authentication and seller resolution can
# be exercised without depending on any particular endpoint existing yet.
-class Spree::Api::V3::Vendor::TestController < Spree::Api::V3::Vendor::BaseController
+class Spree::Api::V3::Seller::TestController < Spree::Api::V3::Seller::BaseController
skip_scope_check!
def index
- render json: { ok: true, vendor_id: current_vendor&.prefixed_id, store_id: current_store&.prefixed_id }
+ render json: { ok: true, seller_id: current_seller&.prefixed_id, store_id: current_store&.prefixed_id }
end
end
-RSpec.describe Spree::Api::V3::Vendor::BaseController, type: :controller do
- controller(Spree::Api::V3::Vendor::TestController) do
+RSpec.describe Spree::Api::V3::Seller::BaseController, type: :controller do
+ controller(Spree::Api::V3::Seller::TestController) do
skip_scope_check!
def index
- render json: { ok: true, vendor_id: current_vendor&.prefixed_id, store_id: current_store&.prefixed_id }
+ render json: { ok: true, seller_id: current_seller&.prefixed_id, store_id: current_store&.prefixed_id }
end
end
render_views
- include_context 'API v3 Vendor'
+ include_context 'API v3 Seller'
- before { routes.draw { get 'index' => 'spree/api/v3/vendor/test#index' } }
+ before { routes.draw { get 'index' => 'spree/api/v3/seller/test#index' } }
describe 'a seller signing in to their own panel' do
- before { request.headers.merge!(vendor_headers) }
+ before { request.headers.merge!(seller_headers) }
- it 'resolves the vendor and derives the store from it' do
+ it 'resolves the seller and derives the store from it' do
get :index
expect(response).to have_http_status(:ok)
- expect(json_response['vendor_id']).to eq(vendor.prefixed_id)
+ expect(json_response['seller_id']).to eq(seller.prefixed_id)
expect(json_response['store_id']).to eq(store.prefixed_id)
end
end
- # The audience is checked at decode, before any vendor is resolved, so these
+ # The audience is checked at decode, before any seller is resolved, so these
# never reach the membership lookup at all.
describe 'tokens minted for another surface' do
it 'refuses an admin token' do
@@ -46,7 +46,7 @@ RSpec.describe Spree::Api::V3::Vendor::BaseController, type: :controller do
admin, audience: Spree::Api::V3::JwtAuthentication::JWT_AUDIENCE_ADMIN
)
request.headers['Authorization'] = "Bearer #{token}"
- request.headers['X-Spree-Vendor-Id'] = vendor.prefixed_id
+ request.headers['X-Spree-Seller-Id'] = seller.prefixed_id
get :index
@@ -55,10 +55,10 @@ RSpec.describe Spree::Api::V3::Vendor::BaseController, type: :controller do
it 'refuses a storefront token' do
token = Spree::Api::V3::TestingSupport.generate_jwt(
- vendor_user, audience: Spree::Api::V3::JwtAuthentication::JWT_AUDIENCE_STORE
+ seller_user, audience: Spree::Api::V3::JwtAuthentication::JWT_AUDIENCE_STORE
)
request.headers['Authorization'] = "Bearer #{token}"
- request.headers['X-Spree-Vendor-Id'] = vendor.prefixed_id
+ request.headers['X-Spree-Seller-Id'] = seller.prefixed_id
get :index
@@ -66,7 +66,7 @@ RSpec.describe Spree::Api::V3::Vendor::BaseController, type: :controller do
end
it 'refuses a request with no token at all' do
- request.headers['X-Spree-Vendor-Id'] = vendor.prefixed_id
+ request.headers['X-Spree-Seller-Id'] = seller.prefixed_id
get :index
@@ -74,24 +74,24 @@ RSpec.describe Spree::Api::V3::Vendor::BaseController, type: :controller do
end
end
- describe 'acting as a vendor the caller does not belong to' do
- let(:other_vendor) { create(:vendor, :approved, store: store) }
+ describe 'acting as a seller the caller does not belong to' do
+ let(:other_seller) { create(:seller, :approved, store: store) }
it 'is forbidden' do
- request.headers['Authorization'] = "Bearer #{vendor_jwt_token}"
- request.headers['X-Spree-Vendor-Id'] = other_vendor.prefixed_id
+ request.headers['Authorization'] = "Bearer #{seller_jwt_token}"
+ request.headers['X-Spree-Seller-Id'] = other_seller.prefixed_id
get :index
expect(response).to have_http_status(:forbidden)
end
- # A vendor on another store is no more reachable than one on this store —
+ # A seller on another store is no more reachable than one on this store —
# the membership lookup never consults the store at all.
it 'is forbidden across stores too' do
- foreign = create(:vendor, :approved, store: create(:store))
- request.headers['Authorization'] = "Bearer #{vendor_jwt_token}"
- request.headers['X-Spree-Vendor-Id'] = foreign.prefixed_id
+ foreign = create(:seller, :approved, store: create(:store))
+ request.headers['Authorization'] = "Bearer #{seller_jwt_token}"
+ request.headers['X-Spree-Seller-Id'] = foreign.prefixed_id
get :index
@@ -99,9 +99,9 @@ RSpec.describe Spree::Api::V3::Vendor::BaseController, type: :controller do
end
end
- describe 'naming no vendor' do
+ describe 'naming no seller' do
it 'is forbidden rather than falling back to a default' do
- request.headers['Authorization'] = "Bearer #{vendor_jwt_token}"
+ request.headers['Authorization'] = "Bearer #{seller_jwt_token}"
get :index
@@ -110,12 +110,12 @@ RSpec.describe Spree::Api::V3::Vendor::BaseController, type: :controller do
end
describe 'capability' do
- before { request.headers.merge!(vendor_headers) }
+ before { request.headers.merge!(seller_headers) }
- # Capability comes from the roles held on THIS vendor, so the store's own
+ # Capability comes from the roles held on THIS seller, so the store's own
# roles — including its admin super-role — confer nothing here.
- it 'reads the roles held on the vendor, not on the store' do
- store.add_user(vendor_user, Spree::Role.default_admin_role(store))
+ it 'reads the roles held on the seller, not on the store' do
+ store.add_user(seller_user, Spree::Role.default_admin_role(store))
get :index
diff --git a/spree/api/spec/controllers/spree/api/v3/store/products_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/store/products_controller_spec.rb
index cb160d25e1..5eb80f62db 100644
--- a/spree/api/spec/controllers/spree/api/v3/store/products_controller_spec.rb
+++ b/spree/api/spec/controllers/spree/api/v3/store/products_controller_spec.rb
@@ -19,32 +19,32 @@ RSpec.describe Spree::Api::V3::Store::ProductsController, type: :controller do
I18n.locale = store.default_locale
end
- describe 'vendor' do
- let!(:vendor) { create(:vendor, store: store, name: 'Sparks Audio', status: 'approved') }
- let!(:vendor_product) { create(:product, store: store, vendor: vendor, status: 'active') }
+ describe 'seller' do
+ let!(:seller) { create(:seller, store: store, name: 'Sparks Audio', status: 'approved') }
+ let!(:seller_product) { create(:product, store: store, seller: seller, status: 'active') }
# Always present so a storefront can group or link by seller without
# paying for the expand.
- it 'exposes vendor_id without an expand' do
- get :show, params: { id: vendor_product.slug }, as: :json
+ it 'exposes seller_id without an expand' do
+ get :show, params: { id: seller_product.slug }, as: :json
- expect(json_response['vendor_id']).to eq(vendor.prefixed_id)
- expect(json_response).not_to have_key('vendor')
+ expect(json_response['seller_id']).to eq(seller.prefixed_id)
+ expect(json_response).not_to have_key('seller')
end
it 'embeds the public profile on expand' do
- get :show, params: { id: vendor_product.slug, expand: 'vendor' }, as: :json
+ get :show, params: { id: seller_product.slug, expand: 'seller' }, as: :json
- expect(json_response['vendor']['name']).to eq('Sparks Audio')
+ expect(json_response['seller']['name']).to eq('Sparks Audio')
# The storefront never sees how the marketplace runs the seller.
- expect(json_response['vendor']).not_to have_key('status')
- expect(json_response['vendor']).not_to have_key('tax_remittance')
+ expect(json_response['seller']).not_to have_key('status')
+ expect(json_response['seller']).not_to have_key('tax_remittance')
end
- it 'leaves vendor_id nil on a first-party product' do
+ it 'leaves seller_id nil on a first-party product' do
get :show, params: { id: product.slug }, as: :json
- expect(json_response['vendor_id']).to be_nil
+ expect(json_response['seller_id']).to be_nil
end
end
diff --git a/spree/api/spec/controllers/spree/api/v3/store/vendors_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/store/sellers_controller_spec.rb
similarity index 73%
rename from spree/api/spec/controllers/spree/api/v3/store/vendors_controller_spec.rb
rename to spree/api/spec/controllers/spree/api/v3/store/sellers_controller_spec.rb
index 6a658417ea..1626677185 100644
--- a/spree/api/spec/controllers/spree/api/v3/store/vendors_controller_spec.rb
+++ b/spree/api/spec/controllers/spree/api/v3/store/sellers_controller_spec.rb
@@ -1,11 +1,11 @@
require 'spec_helper'
-RSpec.describe Spree::Api::V3::Store::VendorsController, type: :controller do
+RSpec.describe Spree::Api::V3::Store::SellersController, type: :controller do
render_views
include_context 'API v3 Store'
- let!(:vendor) { create(:vendor, store: store, name: 'Sparks Audio', status: 'approved') }
+ let!(:seller) { create(:seller, store: store, name: 'Sparks Audio', status: 'approved') }
before { request.headers['X-Spree-Api-Key'] = api_key.token }
@@ -17,12 +17,12 @@ RSpec.describe Spree::Api::V3::Store::VendorsController, type: :controller do
expect(json_response['data'].pluck('name')).to eq(['Sparks Audio'])
end
- # A vendor still onboarding, suspended or away has nothing to show a
+ # A seller still onboarding, suspended or away has nothing to show a
# customer, and listing them advertises products that cannot be bought.
it 'hides sellers who cannot currently sell' do
- create(:vendor, store: store, name: 'Not Yet', status: 'pending')
- create(:vendor, store: store, name: 'Suspended', status: 'suspended')
- create(:vendor, store: store, name: 'Away', status: 'approved',
+ create(:seller, store: store, name: 'Not Yet', status: 'pending')
+ create(:seller, store: store, name: 'Suspended', status: 'suspended')
+ create(:seller, store: store, name: 'Away', status: 'approved',
holiday_mode_until: 2.weeks.from_now)
get :index, as: :json
@@ -31,7 +31,7 @@ RSpec.describe Spree::Api::V3::Store::VendorsController, type: :controller do
end
it "hides another store's sellers" do
- other = create(:vendor, store: create(:store), status: 'approved')
+ other = create(:seller, store: create(:store), status: 'approved')
get :index, as: :json
@@ -51,20 +51,20 @@ RSpec.describe Spree::Api::V3::Store::VendorsController, type: :controller do
describe 'GET #show' do
it 'finds a seller by slug' do
- get :show, params: { id: vendor.slug }, as: :json
+ get :show, params: { id: seller.slug }, as: :json
expect(response).to have_http_status(:ok)
expect(json_response['name']).to eq('Sparks Audio')
end
it 'finds a seller by prefixed id' do
- get :show, params: { id: vendor.prefixed_id }, as: :json
+ get :show, params: { id: seller.prefixed_id }, as: :json
expect(response).to have_http_status(:ok)
end
it '404s on a seller who cannot currently sell' do
- hidden = create(:vendor, store: store, status: 'pending')
+ hidden = create(:seller, store: store, status: 'pending')
get :show, params: { id: hidden.slug }, as: :json
diff --git a/spree/api/spec/integration/spree/api/v3/admin/commission_lines_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/commission_lines_spec.rb
index b0e6f235b9..c59aade124 100644
--- a/spree/api/spec/integration/spree/api/v3/admin/commission_lines_spec.rb
+++ b/spree/api/spec/integration/spree/api/v3/admin/commission_lines_spec.rb
@@ -6,10 +6,10 @@ RSpec.describe 'Admin Commission Lines API', type: :request, swagger_doc: 'api-r
include_context 'API v3 Admin'
let(:Authorization) { "Bearer #{admin_jwt_token}" }
- let(:vendor) { create(:vendor, :approved, store: store, name: 'Sparks Audio') }
+ let(:seller) { create(:seller, :approved, store: store, name: 'Sparks Audio') }
let(:order) { create(:order, store: store) }
let!(:commission_line) do
- create(:commission_line, order: order, vendor: vendor, line_item: create(:line_item, order: order),
+ create(:commission_line, order: order, seller: seller, line_item: create(:line_item, order: order),
amount: 10, tax_amount: 2.1, total: 12.1, currency: 'USD')
end
@@ -43,7 +43,7 @@ RSpec.describe 'Admin Commission Lines API', type: :request, swagger_doc: 'api-r
parameter name: :page, in: :query, type: :integer, required: false, description: 'Page number'
parameter name: :limit, in: :query, type: :integer, required: false,
description: 'Number of records per page'
- parameter name: :'q[vendor_id_eq]', in: :query, type: :string, required: false,
+ parameter name: :'q[seller_id_eq]', in: :query, type: :string, required: false,
description: 'Filter to one seller'
parameter name: :'q[order_id_eq]', in: :query, type: :string, required: false,
description: 'Filter to one order'
diff --git a/spree/api/spec/integration/spree/api/v3/admin/commission_rates_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/commission_rates_spec.rb
index 1f22a623e6..e1398b3a12 100644
--- a/spree/api/spec/integration/spree/api/v3/admin/commission_rates_spec.rb
+++ b/spree/api/spec/integration/spree/api/v3/admin/commission_rates_spec.rb
@@ -76,7 +76,7 @@ RSpec.describe 'Admin Commission Rates API', type: :request, swagger_doc: 'api-r
`rules` is the rate's whole targeting, sent inline. Every rule has to
hold, and a rule naming several records means any of them — so
"(Cameras OR Audio) AND that seller" is a category rule holding two ids
- beside a vendor rule holding one. Send no rules to charge every sale.
+ beside a seller rule holding one. Send no rules to charge every sale.
Rule kinds come from `GET /commission_rates/rule_types`, which also
describes the configuration each one takes. A marketplace that adds its
@@ -142,9 +142,9 @@ RSpec.describe 'Admin Commission Rates API', type: :request, swagger_doc: 'api-r
type: :object,
properties: {
id: { type: :string, description: 'Present for an existing rule; omit to create one.' },
- type: { type: :string, example: 'vendor_rule',
+ type: { type: :string, example: 'seller_rule',
description: 'A kind from /commission_rates/rule_types.' },
- preferences: { type: :object, example: { vendor_ids: ['ven_a1b2c3'] },
+ preferences: { type: :object, example: { seller_ids: ['sel_a1b2c3'] },
description: "Configuration for the kind, per its preference_schema." },
product_ids: { type: :array, items: { type: :string },
description: 'For kinds that name products, which are kept outside preferences.' }
@@ -206,7 +206,7 @@ RSpec.describe 'Admin Commission Rates API', type: :request, swagger_doc: 'api-r
items: {
type: :object,
properties: {
- type: { type: :string, example: 'vendor_rule' },
+ type: { type: :string, example: 'seller_rule' },
name: { type: :string, example: 'Seller' },
description: { type: :string, nullable: true },
preference_schema: { type: :array, items: { type: :object } },
@@ -218,7 +218,7 @@ RSpec.describe 'Admin Commission Rates API', type: :request, swagger_doc: 'api-r
run_test! do |response|
data = JSON.parse(response.body)
- expect(data['data'].pluck('type')).to include('vendor_rule', 'item_total_rule')
+ expect(data['data'].pluck('type')).to include('seller_rule', 'item_total_rule')
end
end
end
diff --git a/spree/api/spec/integration/spree/api/v3/admin/integrations_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/integrations_spec.rb
index 7f1e19cad9..6f5215796f 100644
--- a/spree/api/spec/integration/spree/api/v3/admin/integrations_spec.rb
+++ b/spree/api/spec/integration/spree/api/v3/admin/integrations_spec.rb
@@ -115,7 +115,7 @@ RSpec.describe 'Admin Integrations API', type: :request, swagger_doc: 'api-refer
tags 'Integrations'
produces 'application/json'
security [api_key: [], bearer_auth: []]
- description 'Runs a live connection check against the provider. Nothing is persisted; a failed check reports the vendor error message.'
+ description 'Runs a live connection check against the provider. Nothing is persisted; a failed check reports the seller error message.'
admin_scope :write, :integrations
admin_sdk_example 'integrations/test'
diff --git a/spree/api/spec/integration/spree/api/v3/admin/vendors_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/sellers_spec.rb
similarity index 72%
rename from spree/api/spec/integration/spree/api/v3/admin/vendors_spec.rb
rename to spree/api/spec/integration/spree/api/v3/admin/sellers_spec.rb
index 12bdebc79b..76b95c4645 100644
--- a/spree/api/spec/integration/spree/api/v3/admin/vendors_spec.rb
+++ b/spree/api/spec/integration/spree/api/v3/admin/sellers_spec.rb
@@ -2,19 +2,19 @@
require 'swagger_helper'
-# Both vendor addresses accept the same keys, so they document the same shape —
+# Both seller addresses accept the same keys, so they document the same shape —
# a bare `type: :object` on one of them would leave SDK consumers without any
# property types for it.
-VENDOR_ADDRESS_SCHEMA = {
+SELLER_ADDRESS_SCHEMA = {
type: :object,
- description: "The vendor's own address, written inline. There is no " \
+ description: "The seller's own address, written inline. There is no " \
'`billing_address_id` — an address belongs to whoever it was ' \
'created for, so it is never referenced by id here.',
properties: {
first_name: { type: :string, example: 'Ada' },
last_name: { type: :string, example: 'Lovelace' },
company: { type: :string, example: 'Sparks Audio Ltd' },
- address1: { type: :string, example: '1 Vendor Way' },
+ address1: { type: :string, example: '1 Seller Way' },
address2: { type: :string, example: 'Unit 4' },
city: { type: :string, example: 'London' },
postal_code: { type: :string, example: 'EC1A 1BB' },
@@ -26,28 +26,28 @@ VENDOR_ADDRESS_SCHEMA = {
}
}.freeze
-RSpec.describe 'Admin Vendors API', type: :request, swagger_doc: 'api-reference/admin.yaml' do
+RSpec.describe 'Admin Sellers API', type: :request, swagger_doc: 'api-reference/admin.yaml' do
include_context 'API v3 Admin'
let(:Authorization) { "Bearer #{admin_jwt_token}" }
- let!(:vendor) do
- create(:vendor, store: store, name: 'Sparks Audio', contact_email: '[email protected]')
+ let!(:seller) do
+ create(:seller, store: store, name: 'Sparks Audio', contact_email: '[email protected]')
end
- path '/api/v3/admin/vendors' do
- get 'List vendors' do
- tags 'Vendors'
+ path '/api/v3/admin/sellers' do
+ get 'List sellers' do
+ tags 'Sellers'
produces 'application/json'
security [api_key: [], bearer_auth: []]
description <<~DESC
Returns the sellers on this marketplace. `status` says where each one
is in its life on the marketplace, and `sellable` answers the question
- the status alone cannot: an approved vendor who is away cannot be
+ the status alone cannot: an approved seller who is away cannot be
bought from either.
DESC
- admin_scope :read, :vendors
+ admin_scope :read, :sellers
- admin_sdk_example 'vendors/list'
+ admin_sdk_example 'sellers/list'
parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
parameter name: :Authorization, in: :header, type: :string, required: true,
@@ -61,14 +61,14 @@ RSpec.describe 'Admin Vendors API', type: :request, swagger_doc: 'api-reference/
parameter name: :sort, in: :query, type: :string, required: false,
description: 'Sort by field. Prefix with `-` for descending (e.g., `-created_at`).'
- response '200', 'vendors found' do
+ response '200', 'sellers found' do
let(:'x-spree-api-key') { secret_api_key.plaintext_token }
- schema SwaggerSchemaHelpers.paginated('Vendor')
+ schema SwaggerSchemaHelpers.paginated('Seller')
run_test! do |response|
data = JSON.parse(response.body)
- expect(data['data'].pluck('id')).to include(vendor.prefixed_id)
+ expect(data['data'].pluck('id')).to include(seller.prefixed_id)
end
end
@@ -82,22 +82,22 @@ RSpec.describe 'Admin Vendors API', type: :request, swagger_doc: 'api-reference/
end
end
- post 'Create a vendor' do
- tags 'Vendors'
+ post 'Create a seller' do
+ tags 'Sellers'
consumes 'application/json'
produces 'application/json'
security [api_key: [], bearer_auth: []]
description <<~DESC
- Opens a seller record. The vendor starts as `pending` and has no team
+ Opens a seller record. The seller starts as `pending` and has no team
yet — invite someone to run it with the `invite` action below.
`status` is deliberately not writable here or on update: every move
through the lifecycle is its own action, because each one does more
than set a column.
DESC
- admin_scope :write, :vendors
+ admin_scope :write, :sellers
- admin_sdk_example 'vendors/create'
+ admin_sdk_example 'sellers/create'
parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
parameter name: :Authorization, in: :header, type: :string, required: true
@@ -111,7 +111,7 @@ RSpec.describe 'Admin Vendors API', type: :request, swagger_doc: 'api-reference/
contact_email: { type: :string, example: '[email protected]', nullable: true },
billing_email: { type: :string, example: '[email protected]', nullable: true },
about: { type: :string, example: '<p>Independent bookshop.</p>', nullable: true },
- tax_remittance: { type: :string, enum: %w[vendor platform], example: 'vendor' },
+ tax_remittance: { type: :string, enum: %w[seller platform], example: 'seller' },
payouts_schedule_interval: {
type: :string, enum: %w[daily weekly biweekly monthly manual], nullable: true
},
@@ -119,11 +119,11 @@ RSpec.describe 'Admin Vendors API', type: :request, swagger_doc: 'api-reference/
}
}
- response '201', 'vendor created' do
+ response '201', 'seller created' do
let(:'x-spree-api-key') { secret_api_key.plaintext_token }
let(:body) { { name: 'Northwind Books', contact_email: '[email protected]' } }
- schema '$ref' => '#/components/schemas/Vendor'
+ schema '$ref' => '#/components/schemas/Seller'
run_test! do |response|
data = JSON.parse(response.body)
@@ -144,37 +144,37 @@ RSpec.describe 'Admin Vendors API', type: :request, swagger_doc: 'api-reference/
end
end
- path '/api/v3/admin/vendors/{id}' do
- parameter name: :id, in: :path, type: :string, required: true, description: 'Vendor prefixed ID'
+ path '/api/v3/admin/sellers/{id}' do
+ parameter name: :id, in: :path, type: :string, required: true, description: 'Seller prefixed ID'
- get 'Get a vendor' do
- tags 'Vendors'
+ get 'Get a seller' do
+ tags 'Sellers'
produces 'application/json'
security [api_key: [], bearer_auth: []]
- description 'Returns a single vendor, including its settlement and tax configuration.'
- admin_scope :read, :vendors
+ description 'Returns a single seller, including its settlement and tax configuration.'
+ admin_scope :read, :sellers
- admin_sdk_example 'vendors/get'
+ admin_sdk_example 'sellers/get'
parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
parameter name: :Authorization, in: :header, type: :string, required: true
- response '200', 'vendor found' do
+ response '200', 'seller found' do
let(:'x-spree-api-key') { secret_api_key.plaintext_token }
- let(:id) { vendor.prefixed_id }
+ let(:id) { seller.prefixed_id }
- schema '$ref' => '#/components/schemas/Vendor'
+ schema '$ref' => '#/components/schemas/Seller'
run_test! do |response|
data = JSON.parse(response.body)
- expect(data['id']).to eq(vendor.prefixed_id)
+ expect(data['id']).to eq(seller.prefixed_id)
expect(data['contact_email']).to eq('[email protected]')
end
end
- response '404', 'vendor not found' do
+ response '404', 'seller not found' do
let(:'x-spree-api-key') { secret_api_key.plaintext_token }
- let(:id) { 'ven_nonexistent' }
+ let(:id) { 'sel_nonexistent' }
schema '$ref' => '#/components/schemas/ErrorResponse'
@@ -182,19 +182,19 @@ RSpec.describe 'Admin Vendors API', type: :request, swagger_doc: 'api-reference/
end
end
- patch 'Update a vendor' do
- tags 'Vendors'
+ patch 'Update a seller' do
+ tags 'Sellers'
consumes 'application/json'
produces 'application/json'
security [api_key: [], bearer_auth: []]
description <<~DESC
- Updates the vendor's profile and the settlement configuration the
+ Updates the seller's profile and the settlement configuration the
operator owns. A `status` sent here is ignored — use the lifecycle
actions.
DESC
- admin_scope :write, :vendors
+ admin_scope :write, :sellers
- admin_sdk_example 'vendors/update'
+ admin_sdk_example 'sellers/update'
parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
parameter name: :Authorization, in: :header, type: :string, required: true
@@ -216,17 +216,17 @@ RSpec.describe 'Admin Vendors API', type: :request, swagger_doc: 'api-reference/
},
square_logo: { type: :string, nullable: true },
cover_photo: { type: :string, nullable: true },
- billing_address: VENDOR_ADDRESS_SCHEMA,
- returns_address: VENDOR_ADDRESS_SCHEMA
+ billing_address: SELLER_ADDRESS_SCHEMA,
+ returns_address: SELLER_ADDRESS_SCHEMA
}
}
- response '200', 'vendor updated' do
+ response '200', 'seller updated' do
let(:'x-spree-api-key') { secret_api_key.plaintext_token }
- let(:id) { vendor.prefixed_id }
+ let(:id) { seller.prefixed_id }
let(:body) { { billing_email: '[email protected]', payouts_schedule_interval: 'weekly' } }
- schema '$ref' => '#/components/schemas/Vendor'
+ schema '$ref' => '#/components/schemas/Seller'
run_test! do |response|
data = JSON.parse(response.body)
@@ -235,29 +235,29 @@ RSpec.describe 'Admin Vendors API', type: :request, swagger_doc: 'api-reference/
end
end
- response '200', 'vendor address written inline' do
+ response '200', 'seller address written inline' do
let(:'x-spree-api-key') { secret_api_key.plaintext_token }
- let(:id) { vendor.prefixed_id }
+ let(:id) { seller.prefixed_id }
let(:body) do
{
billing_address: {
- first_name: 'Ada', last_name: 'Lovelace', address1: '1 Vendor Way',
+ first_name: 'Ada', last_name: 'Lovelace', address1: '1 Seller Way',
city: 'London', postal_code: 'EC1A 1BB', country_code: 'GB', phone: '555'
}
}
end
- schema '$ref' => '#/components/schemas/Vendor'
+ schema '$ref' => '#/components/schemas/Seller'
run_test! do |response|
data = JSON.parse(response.body)
- expect(data['billing_address']['address1']).to eq('1 Vendor Way')
+ expect(data['billing_address']['address1']).to eq('1 Seller Way')
end
end
response '422', 'validation error' do
let(:'x-spree-api-key') { secret_api_key.plaintext_token }
- let(:id) { vendor.prefixed_id }
+ let(:id) { seller.prefixed_id }
let(:body) { { name: '' } }
schema '$ref' => '#/components/schemas/ErrorResponse'
@@ -266,50 +266,50 @@ RSpec.describe 'Admin Vendors API', type: :request, swagger_doc: 'api-reference/
end
end
- delete 'Delete a vendor' do
- tags 'Vendors'
+ delete 'Delete a seller' do
+ tags 'Sellers'
security [api_key: [], bearer_auth: []]
description <<~DESC
- Soft-deletes the vendor. Their products are kept and left without a
+ Soft-deletes the seller. Their products are kept and left without a
seller rather than deleted — what happens to a departed seller's
catalog is the operator's decision.
DESC
- admin_scope :write, :vendors
+ admin_scope :write, :sellers
- admin_sdk_example 'vendors/delete'
+ admin_sdk_example 'sellers/delete'
parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
parameter name: :Authorization, in: :header, type: :string, required: true
- response '204', 'vendor deleted' do
+ response '204', 'seller deleted' do
let(:'x-spree-api-key') { secret_api_key.plaintext_token }
- let(:id) { vendor.prefixed_id }
+ let(:id) { seller.prefixed_id }
run_test!
end
end
end
- path '/api/v3/admin/vendors/{id}/invite' do
- parameter name: :id, in: :path, type: :string, required: true, description: 'Vendor prefixed ID'
+ path '/api/v3/admin/sellers/{id}/invite' do
+ parameter name: :id, in: :path, type: :string, required: true, description: 'Seller prefixed ID'
- post 'Invite someone to run a vendor' do
- tags 'Vendors'
+ post 'Invite someone to run a seller' do
+ tags 'Sellers'
consumes 'application/json'
produces 'application/json'
security [api_key: [], bearer_auth: []]
description <<~DESC
- Sends an invitation to the vendor's own team and moves the vendor to
+ Sends an invitation to the seller's own team and moves the seller to
`invited`. The person becomes a member when they accept, and can then
- sign in to the vendor panel.
+ sign in to the seller panel.
- `role_id` must name a role this vendor owns; omit it for the vendor's
+ `role_id` must name a role this seller owns; omit it for the seller's
own admin role. Re-inviting is allowed — an invitation expires, or the
first one goes to the wrong address.
DESC
- admin_scope :write, :vendors
+ admin_scope :write, :sellers
- admin_sdk_example 'vendors/invite'
+ admin_sdk_example 'sellers/invite'
parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
parameter name: :Authorization, in: :header, type: :string, required: true
@@ -324,10 +324,10 @@ RSpec.describe 'Admin Vendors API', type: :request, swagger_doc: 'api-reference/
response '201', 'invitation sent' do
let(:'x-spree-api-key') { secret_api_key.plaintext_token }
- let(:id) { vendor.prefixed_id }
+ let(:id) { seller.prefixed_id }
let(:body) { { email: '[email protected]' } }
- schema '$ref' => '#/components/schemas/Vendor'
+ schema '$ref' => '#/components/schemas/Seller'
run_test! do |response|
expect(JSON.parse(response.body)['status']).to eq('invited')
@@ -336,32 +336,32 @@ RSpec.describe 'Admin Vendors API', type: :request, swagger_doc: 'api-reference/
end
end
- path '/api/v3/admin/vendors/{id}/approve' do
- parameter name: :id, in: :path, type: :string, required: true, description: 'Vendor prefixed ID'
+ path '/api/v3/admin/sellers/{id}/approve' do
+ parameter name: :id, in: :path, type: :string, required: true, description: 'Seller prefixed ID'
- patch 'Approve a vendor' do
- tags 'Vendors'
+ patch 'Approve a seller' do
+ tags 'Sellers'
produces 'application/json'
security [api_key: [], bearer_auth: []]
description <<~DESC
- Lets the vendor sell. This is also the way back for one that was
+ Lets the seller sell. This is also the way back for one that was
suspended or turned down, and it clears any holiday along with the
suspension.
DESC
- admin_scope :write, :vendors
+ admin_scope :write, :sellers
- admin_sdk_example 'vendors/approve'
+ admin_sdk_example 'sellers/approve'
parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
parameter name: :Authorization, in: :header, type: :string, required: true
- response '200', 'vendor approved' do
+ response '200', 'seller approved' do
let(:'x-spree-api-key') { secret_api_key.plaintext_token }
- let(:id) { vendor.prefixed_id }
+ let(:id) { seller.prefixed_id }
- before { vendor.update!(status: 'ready_for_review') }
+ before { seller.update!(status: 'ready_for_review') }
- schema '$ref' => '#/components/schemas/Vendor'
+ schema '$ref' => '#/components/schemas/Seller'
run_test! do |response|
data = JSON.parse(response.body)
@@ -370,11 +370,11 @@ RSpec.describe 'Admin Vendors API', type: :request, swagger_doc: 'api-reference/
end
end
- response '422', 'vendor cannot be approved from its current status' do
+ response '422', 'seller cannot be approved from its current status' do
let(:'x-spree-api-key') { secret_api_key.plaintext_token }
- let(:id) { vendor.prefixed_id }
+ let(:id) { seller.prefixed_id }
- before { vendor.update!(status: 'approved') }
+ before { seller.update!(status: 'approved') }
schema '$ref' => '#/components/schemas/ErrorResponse'
@@ -383,23 +383,23 @@ RSpec.describe 'Admin Vendors API', type: :request, swagger_doc: 'api-reference/
end
end
- path '/api/v3/admin/vendors/{id}/suspend' do
- parameter name: :id, in: :path, type: :string, required: true, description: 'Vendor prefixed ID'
+ path '/api/v3/admin/sellers/{id}/suspend' do
+ parameter name: :id, in: :path, type: :string, required: true, description: 'Seller prefixed ID'
- patch 'Suspend a vendor' do
- tags 'Vendors'
+ patch 'Suspend a seller' do
+ tags 'Sellers'
consumes 'application/json'
produces 'application/json'
security [api_key: [], bearer_auth: []]
description <<~DESC
- Stops a trading vendor from selling. Their catalog and history stay,
+ Stops a trading seller from selling. Their catalog and history stay,
and approving reinstates them. Use this rather than `reject` for a
- vendor already on the marketplace — it says something different, and
+ seller already on the marketplace — it says something different, and
it can be undone.
DESC
- admin_scope :write, :vendors
+ admin_scope :write, :sellers
- admin_sdk_example 'vendors/suspend'
+ admin_sdk_example 'sellers/suspend'
parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
parameter name: :Authorization, in: :header, type: :string, required: true
@@ -410,14 +410,14 @@ RSpec.describe 'Admin Vendors API', type: :request, swagger_doc: 'api-reference/
}
}
- response '200', 'vendor suspended' do
+ response '200', 'seller suspended' do
let(:'x-spree-api-key') { secret_api_key.plaintext_token }
- let(:id) { vendor.prefixed_id }
+ let(:id) { seller.prefixed_id }
let(:body) { { reason: 'Counterfeit goods' } }
- before { vendor.update!(status: 'approved') }
+ before { seller.update!(status: 'approved') }
- schema '$ref' => '#/components/schemas/Vendor'
+ schema '$ref' => '#/components/schemas/Seller'
run_test! do |response|
data = JSON.parse(response.body)
@@ -428,21 +428,21 @@ RSpec.describe 'Admin Vendors API', type: :request, swagger_doc: 'api-reference/
end
end
- path '/api/v3/admin/vendors/{id}/reject' do
- parameter name: :id, in: :path, type: :string, required: true, description: 'Vendor prefixed ID'
+ path '/api/v3/admin/sellers/{id}/reject' do
+ parameter name: :id, in: :path, type: :string, required: true, description: 'Seller prefixed ID'
- patch 'Reject a vendor' do
- tags 'Vendors'
+ patch 'Reject a seller' do
+ tags 'Sellers'
consumes 'application/json'
produces 'application/json'
security [api_key: [], bearer_auth: []]
description <<~DESC
- Turns down an applicant who never traded. A vendor already selling is
+ Turns down an applicant who never traded. A seller already selling is
suspended instead; rejecting one is refused.
DESC
- admin_scope :write, :vendors
+ admin_scope :write, :sellers
- admin_sdk_example 'vendors/reject'
+ admin_sdk_example 'sellers/reject'
parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
parameter name: :Authorization, in: :header, type: :string, required: true
@@ -453,14 +453,14 @@ RSpec.describe 'Admin Vendors API', type: :request, swagger_doc: 'api-reference/
}
}
- response '200', 'vendor rejected' do
+ response '200', 'seller rejected' do
let(:'x-spree-api-key') { secret_api_key.plaintext_token }
- let(:id) { vendor.prefixed_id }
+ let(:id) { seller.prefixed_id }
let(:body) { { reason: 'Incomplete paperwork' } }
- before { vendor.update!(status: 'ready_for_review') }
+ before { seller.update!(status: 'ready_for_review') }
- schema '$ref' => '#/components/schemas/Vendor'
+ schema '$ref' => '#/components/schemas/Seller'
run_test! do |response|
expect(JSON.parse(response.body)['status']).to eq('rejected')
diff --git a/spree/api/spec/integration/spree/api/v3/store/products_spec.rb b/spree/api/spec/integration/spree/api/v3/store/products_spec.rb
index d77ca0925b..5cf5d320ed 100644
--- a/spree/api/spec/integration/spree/api/v3/store/products_spec.rb
+++ b/spree/api/spec/integration/spree/api/v3/store/products_spec.rb
@@ -55,7 +55,7 @@ RSpec.describe 'Products API', type: :request, swagger_doc: 'api-reference/store
parameter name: 'q[in_stock]', in: :query, type: :boolean, required: false,
description: 'Filter to only in-stock products'
parameter name: :expand, in: :query, type: :string, required: false,
- description: 'Comma-separated associations to expand (variants, media, categories, option_types, vendor)'
+ description: 'Comma-separated associations to expand (variants, media, categories, option_types, seller)'
parameter name: :fields, in: :query, type: :string, required: false,
description: 'Comma-separated list of fields to include (e.g., name,slug,price). id is always included.'
@@ -104,8 +104,8 @@ RSpec.describe 'Products API', type: :request, swagger_doc: 'api-reference/store
description: 'Product slug (e.g., spree-tote) or prefix ID (e.g., product_abc123)'
parameter name: :expand, in: :query, type: :string, required: false,
description: 'Comma-separated associations to expand (variants, media, categories, ' \
- 'option_types, prior_price, vendor). On a marketplace, `vendor` embeds ' \
- 'the seller public profile; `vendor_id` is present without it.'
+ 'option_types, prior_price, seller). On a marketplace, `seller` embeds ' \
+ 'the seller public profile; `seller_id` is present without it.'
parameter name: :fields, in: :query, type: :string, required: false,
description: 'Comma-separated list of fields to include (e.g., name,slug,price). id is always included.'
diff --git a/spree/api/spec/integration/spree/api/v3/store/vendors_spec.rb b/spree/api/spec/integration/spree/api/v3/store/sellers_spec.rb
similarity index 72%
rename from spree/api/spec/integration/spree/api/v3/store/vendors_spec.rb
rename to spree/api/spec/integration/spree/api/v3/store/sellers_spec.rb
index 23033bce4b..38523f026f 100644
--- a/spree/api/spec/integration/spree/api/v3/store/vendors_spec.rb
+++ b/spree/api/spec/integration/spree/api/v3/store/sellers_spec.rb
@@ -2,20 +2,20 @@
require 'swagger_helper'
-RSpec.describe 'Vendors API', type: :request, swagger_doc: 'api-reference/store.yaml' do
+RSpec.describe 'Sellers API', type: :request, swagger_doc: 'api-reference/store.yaml' do
include_context 'API v3 Store'
- let!(:vendor) { create(:vendor, store: store, name: 'Sparks Audio', status: 'approved') }
- let!(:pending_vendor) { create(:vendor, store: store, name: 'Not Yet', status: 'pending') }
+ let!(:seller) { create(:seller, store: store, name: 'Sparks Audio', status: 'approved') }
+ let!(:pending_seller) { create(:seller, store: store, name: 'Not Yet', status: 'pending') }
- path '/api/v3/store/vendors' do
- get 'List vendors' do
- tags 'Vendors'
+ path '/api/v3/store/sellers' do
+ get 'List sellers' do
+ tags 'Sellers'
produces 'application/json'
security [api_key: []]
description <<~DESC
Returns the sellers on this marketplace that a shopper can currently
- buy from. A vendor still onboarding, suspended, or away on holiday is
+ buy from. A seller still onboarding, suspended, or away on holiday is
not listed — showing them would advertise a seller whose products
cannot be bought.
@@ -32,20 +32,20 @@ RSpec.describe 'Vendors API', type: :request, swagger_doc: 'api-reference/store.
parameter name: :fields, in: :query, type: :string, required: false,
description: 'Comma-separated list of fields to include. id is always included.'
- response '200', 'vendors found' do
+ response '200', 'sellers found' do
let(:'x-spree-api-key') { api_key.token }
schema type: :object,
properties: {
- data: { type: :array, items: { '$ref' => '#/components/schemas/Vendor' } },
+ data: { type: :array, items: { '$ref' => '#/components/schemas/Seller' } },
meta: { '$ref' => '#/components/schemas/PaginationMeta' }
}
run_test! do |response|
data = JSON.parse(response.body)
ids = data['data'].pluck('id')
- expect(ids).to include(vendor.prefixed_id)
- expect(ids).not_to include(pending_vendor.prefixed_id)
+ expect(ids).to include(seller.prefixed_id)
+ expect(ids).not_to include(pending_seller.prefixed_id)
end
end
@@ -59,29 +59,29 @@ RSpec.describe 'Vendors API', type: :request, swagger_doc: 'api-reference/store.
end
end
- path '/api/v3/store/vendors/{id}' do
- get 'Get a vendor' do
- tags 'Vendors'
+ path '/api/v3/store/sellers/{id}' do
+ get 'Get a seller' do
+ tags 'Sellers'
produces 'application/json'
security [api_key: []]
description <<~DESC
Returns a single seller's public profile, by slug or prefixed ID, so a
- storefront can route `/vendors/sparks-audio` without holding an id.
+ storefront can route `/sellers/sparks-audio` without holding an id.
- A vendor who cannot currently sell returns 404 rather than a profile.
+ A seller who cannot currently sell returns 404 rather than a profile.
DESC
parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
parameter name: :id, in: :path, type: :string, required: true,
- description: 'Vendor slug (e.g., sparks-audio) or prefixed ID (e.g., ven_abc123)'
+ description: 'Seller slug (e.g., sparks-audio) or prefixed ID (e.g., sel_abc123)'
parameter name: :fields, in: :query, type: :string, required: false,
description: 'Comma-separated list of fields to include. id is always included.'
- response '200', 'vendor found by slug' do
+ response '200', 'seller found by slug' do
let(:'x-spree-api-key') { api_key.token }
- let(:id) { vendor.slug }
+ let(:id) { seller.slug }
- schema '$ref' => '#/components/schemas/Vendor'
+ schema '$ref' => '#/components/schemas/Seller'
run_test! do |response|
data = JSON.parse(response.body)
@@ -90,9 +90,9 @@ RSpec.describe 'Vendors API', type: :request, swagger_doc: 'api-reference/store.
end
end
- response '404', 'vendor not found' do
+ response '404', 'seller not found' do
let(:'x-spree-api-key') { api_key.token }
- let(:id) { pending_vendor.slug }
+ let(:id) { pending_seller.slug }
schema '$ref' => '#/components/schemas/ErrorResponse'
diff --git a/spree/api/spec/serializers/spree/api/v3/admin/line_item_serializer_spec.rb b/spree/api/spec/serializers/spree/api/v3/admin/line_item_serializer_spec.rb
index b15ecd72e3..60434d18d3 100644
--- a/spree/api/spec/serializers/spree/api/v3/admin/line_item_serializer_spec.rb
+++ b/spree/api/spec/serializers/spree/api/v3/admin/line_item_serializer_spec.rb
@@ -32,18 +32,18 @@ RSpec.describe Spree::Api::V3::Admin::LineItemSerializer do
expect(subject).to have_key('total')
end
- # `vendor_id` itself is covered on the store serializer this one extends.
- describe 'vendor expand' do
+ # `seller_id` itself is covered on the store serializer this one extends.
+ describe 'seller expand' do
it 'resolves the operator view rather than the public profile' do
- vendor = create(:vendor, store: store)
- line_item.variant.product.update!(vendor: vendor)
+ seller = create(:seller, store: store)
+ line_item.variant.product.update!(seller: seller)
line_item.reload.save!
result = described_class.new(
- line_item.reload, params: base_params.merge(expand: ['vendor'])
+ line_item.reload, params: base_params.merge(expand: ['seller'])
).to_h
- expect(result['vendor']['status']).to eq(vendor.status)
+ expect(result['seller']['status']).to eq(seller.status)
end
end
end
diff --git a/spree/api/spec/serializers/spree/api/v3/line_item_serializer_spec.rb b/spree/api/spec/serializers/spree/api/v3/line_item_serializer_spec.rb
index bd6e7f4d68..8f8e972a7f 100644
--- a/spree/api/spec/serializers/spree/api/v3/line_item_serializer_spec.rb
+++ b/spree/api/spec/serializers/spree/api/v3/line_item_serializer_spec.rb
@@ -113,36 +113,36 @@ RSpec.describe Spree::Api::V3::LineItemSerializer do
end
end
- describe 'vendor' do
- let(:vendor) { create(:vendor, store: store, name: 'Sparks Audio') }
+ describe 'seller' do
+ let(:seller) { create(:seller, store: store, name: 'Sparks Audio') }
it 'exposes the seller id without an expand' do
- line_item.variant.product.update!(vendor: vendor)
+ line_item.variant.product.update!(seller: seller)
line_item.reload.save!
result = described_class.new(line_item.reload, params: base_params).to_h
- expect(result['vendor_id']).to eq(vendor.prefixed_id)
- expect(result).not_to have_key('vendor')
+ expect(result['seller_id']).to eq(seller.prefixed_id)
+ expect(result).not_to have_key('seller')
end
it 'is nil on a first-party line' do
- expect(subject['vendor_id']).to be_nil
+ expect(subject['seller_id']).to be_nil
end
# The storefront gets the public profile, never how the marketplace runs
# the seller.
it 'embeds the public profile on expand' do
- line_item.variant.product.update!(vendor: vendor)
+ line_item.variant.product.update!(seller: seller)
line_item.reload.save!
result = described_class.new(
- line_item.reload, params: base_params.merge(expand: ['vendor'])
+ line_item.reload, params: base_params.merge(expand: ['seller'])
).to_h
- expect(result['vendor']['name']).to eq('Sparks Audio')
- expect(result['vendor']).not_to have_key('status')
- expect(result['vendor']).not_to have_key('tax_remittance')
+ expect(result['seller']['name']).to eq('Sparks Audio')
+ expect(result['seller']).not_to have_key('status')
+ expect(result['seller']).not_to have_key('tax_remittance')
end
end
end
diff --git a/spree/core/app/mailers/spree/invitation_mailer.rb b/spree/core/app/mailers/spree/invitation_mailer.rb
index 62c3c8840f..3df4948252 100644
--- a/spree/core/app/mailers/spree/invitation_mailer.rb
+++ b/spree/core/app/mailers/spree/invitation_mailer.rb
@@ -1,6 +1,6 @@
module Spree
class InvitationMailer < BaseMailer
- # invitation email, sending email to the invited to let them know they have been invited to join a store/account/vendor
+ # invitation email, sending email to the invited to let them know they have been invited to join a store/account/seller
def invitation_email(invitation)
@invitation = invitation
# The shared header/footer and from/reply-to addresses read
diff --git a/spree/core/app/models/concerns/spree/user_management.rb b/spree/core/app/models/concerns/spree/user_management.rb
index 253d250d66..09fa6d093a 100644
--- a/spree/core/app/models/concerns/spree/user_management.rb
+++ b/spree/core/app/models/concerns/spree/user_management.rb
@@ -1,6 +1,6 @@
module Spree
# Included into whatever a role can govern — a Store today, a marketplace
- # vendor later. Assignments hang off the resource's own roles, so a user is
+ # seller later. Assignments hang off the resource's own roles, so a user is
# "in" a resource exactly when they hold one of its roles.
module UserManagement
extend ActiveSupport::Concern
@@ -37,7 +37,7 @@ module Spree
Spree::RoleUser.where(user: user, role: roles).destroy_all
end
- # this can be overridden in the base model to use a different user role, eg. 'vendor'
+ # this can be overridden in the base model to use a different user role, eg. 'seller'
def default_user_role
Spree::Role.default_admin_role(self)
end
diff --git a/spree/core/app/models/concerns/spree/user_roles.rb b/spree/core/app/models/concerns/spree/user_roles.rb
index dc0bbcddf2..b504d4ba12 100644
--- a/spree/core/app/models/concerns/spree/user_roles.rb
+++ b/spree/core/app/models/concerns/spree/user_roles.rb
@@ -6,7 +6,7 @@ module Spree
has_many :role_users, class_name: 'Spree::RoleUser', foreign_key: :user_id, as: :user, dependent: :destroy_async # async as we need to check if the user has admin role before destroying
has_many :spree_roles, through: :role_users, class_name: 'Spree::Role', source: :role
has_many :stores, through: :spree_roles, source: :resource, source_type: 'Spree::Store'
- has_many :vendors, through: :spree_roles, source: :resource, source_type: 'Spree::Vendor'
+ has_many :sellers, through: :spree_roles, source: :resource, source_type: 'Spree::Seller'
has_many :invitations, class_name: 'Spree::Invitation', as: :invitee, dependent: :destroy
has_many :sent_invitations, class_name: 'Spree::Invitation', as: :inviter, dependent: :destroy
@@ -63,14 +63,14 @@ module Spree
invitations.first&.inviter
end
- # Whether this user belongs to any marketplace vendor. The vendor login
+ # Whether this user belongs to any marketplace seller. The seller login
# refuses anyone this is false for, so a store's own staff cannot mint a
- # vendor token — the same rule the admin SSO callback applies to
+ # seller token — the same rule the admin SSO callback applies to
# unprovisioned subjects.
#
# @return [Boolean]
- def vendor_member?
- spree_roles.where(resource_type: 'Spree::Vendor').exists?
+ def seller_member?
+ spree_roles.where(resource_type: 'Spree::Seller').exists?
end
end
diff --git a/spree/core/app/models/spree/ability.rb b/spree/core/app/models/spree/ability.rb
index 73f5b7a7b1..b9f79d6f3c 100644
--- a/spree/core/app/models/spree/ability.rb
+++ b/spree/core/app/models/spree/ability.rb
@@ -25,7 +25,7 @@ module Spree
attr_reader :store
# @return [Object] the resource whose role assignments this ability reads —
- # the store for the admin panel, a Spree::Vendor for a vendor panel
+ # the store for the admin panel, a Spree::Seller for a seller panel
attr_reader :resource
# @return [Array<String>] the expanded catalog keys this ability activated
@@ -36,14 +36,14 @@ module Spree
# @param options [Hash]
# @option options [Spree::Store] :store the current store
# @option options [Object] :resource the resource whose assignments grant
- # capability — defaults to the store. Pass a Spree::Vendor to build the
- # ability of a vendor panel from that vendor's own role assignments.
+ # capability — defaults to the store. Pass a Spree::Seller to build the
+ # ability of a seller panel from that seller's own role assignments.
#
- # **The ability answers capability, never tenancy.** A vendor holding
+ # **The ability answers capability, never tenancy.** A seller holding
# `write_orders` gets `can :manage, Spree::Order` — the model class, not
- # that vendor's subset — exactly as a store admin does. Which records a
+ # that seller's subset — exactly as a store admin does. Which records a
# panel may touch is decided by scope-fetching in the controller
- # (`current_vendor.orders`), the same way store isolation works on the
+ # (`current_seller.orders`), the same way store isolation works on the
# admin branch. A panel controller that authorizes with `accessible_by`
# or `authorize!` and does NOT scope-fetch is reading store-wide.
def initialize(user, options = {})
@@ -124,7 +124,7 @@ module Spree
end
# @return [Boolean] whether this ability is being built for the store's own
- # back office, as opposed to another panel (a marketplace vendor's)
+ # back office, as opposed to another panel (a marketplace seller's)
def store_resource?
@resource.is_a?(Spree::Store)
end
@@ -133,7 +133,7 @@ module Spree
#
# A role names what it governs, so matching on it answers both questions at
# once: which panel these grants belong to, and which tenant. A role owned
- # by a marketplace vendor cannot be picked up here however it was assigned.
+ # by a marketplace seller cannot be picked up here however it was assigned.
#
# @return [Array<Spree::Role>]
def staff_roles
@@ -166,7 +166,7 @@ module Spree
#
# The store grant is unrestricted only for the store's own back office.
# Another panel reads the one store it operates under and no other, so a
- # marketplace's vendors cannot enumerate its sibling stores.
+ # marketplace's sellers cannot enumerate its sibling stores.
def apply_staff_baseline
can :read, Spree::Country
can :read, Spree::State
diff --git a/spree/core/app/models/spree/authentication/strategies/oidc_strategy.rb b/spree/core/app/models/spree/authentication/strategies/oidc_strategy.rb
index d550b4c603..7e1ccd6313 100644
--- a/spree/core/app/models/spree/authentication/strategies/oidc_strategy.rb
+++ b/spree/core/app/models/spree/authentication/strategies/oidc_strategy.rb
@@ -5,10 +5,10 @@ module Spree
module Strategies
# Generic OpenID Connect strategy — the reference SSO provider.
#
- # Configured by issuer rather than by vendor, so one class covers Microsoft
+ # Configured by issuer rather than by seller, so one class covers Microsoft
# Entra ID, Okta, Google Workspace, Keycloak and Auth0. Endpoints and signing
# keys are read from the issuer's discovery document
- # (+.well-known/openid-configuration+), so nothing vendor-specific is hardcoded.
+ # (+.well-known/openid-configuration+), so nothing seller-specific is hardcoded.
#
# Registered as a configured factory, which lets the same class back several
# providers with different issuers:
@@ -223,7 +223,7 @@ module Spree
end
def identity_info(claims)
- claims.slice('email', 'name', 'given_name', 'family_name', 'picture')
+ claims.slice('email', 'name', 'gisel_name', 'family_name', 'picture')
end
# The key this provider is registered under — used as UserIdentity#provider
diff --git a/spree/core/app/models/spree/commission_line.rb b/spree/core/app/models/spree/commission_line.rb
index 2e18e8c181..d18a49ed49 100644
--- a/spree/core/app/models/spree/commission_line.rb
+++ b/spree/core/app/models/spree/commission_line.rb
@@ -30,7 +30,7 @@ module Spree
# Associations
#
belongs_to :order, class_name: 'Spree::Order'
- belongs_to :vendor, class_name: 'Spree::Vendor'
+ belongs_to :seller, class_name: 'Spree::Seller'
# Exactly one of these: the item that was commissioned, or the delivery,
# when the rate carries include_shipping.
belongs_to :line_item, class_name: 'Spree::LineItem', optional: true
@@ -62,7 +62,7 @@ module Spree
scope :for_fulfillments, -> { where.not(fulfillment_id: nil) }
self.whitelisted_ransackable_attributes = %w[amount tax_amount total currency kind rate]
- self.whitelisted_ransackable_associations = %w[order vendor commission_rate]
+ self.whitelisted_ransackable_associations = %w[order seller commission_rate]
extend Spree::DisplayMoney
money_methods :amount, :tax_amount, :total
diff --git a/spree/core/app/models/spree/commission_rate.rb b/spree/core/app/models/spree/commission_rate.rb
index e82894ef93..e0a5a4f1e5 100644
--- a/spree/core/app/models/spree/commission_rate.rb
+++ b/spree/core/app/models/spree/commission_rate.rb
@@ -11,7 +11,7 @@ module Spree
#
# The list IS the precedence, so what an operator sees in the table is what
# resolution does. Seeded rates arrive in the order merchants asked for —
- # product, then category, then vendor, then the marketplace default — and a
+ # product, then category, then seller, then the marketplace default — and a
# marketplace that wants a different answer drags a row instead of reasoning
# about which rule type is 'narrower'.
#
@@ -222,7 +222,7 @@ module Spree
#
# Every rule must say yes. A rule naming several records means any of
# them, so "(Cameras OR Audio) AND that seller" is a category rule holding
- # two ids beside a vendor rule holding one — the OR lives inside a rule,
+ # two ids beside a seller rule holding one — the OR lives inside a rule,
# which is why there is no match-policy setting to get wrong. A rate with
# no rules charges every sale.
#
diff --git a/spree/core/app/models/spree/commission_rules/vendor_rule.rb b/spree/core/app/models/spree/commission_rules/seller_rule.rb
similarity index 55%
rename from spree/core/app/models/spree/commission_rules/vendor_rule.rb
rename to spree/core/app/models/spree/commission_rules/seller_rule.rb
index 84184a7d5b..ecc544d224 100644
--- a/spree/core/app/models/spree/commission_rules/vendor_rule.rb
+++ b/spree/core/app/models/spree/commission_rules/seller_rule.rb
@@ -3,30 +3,30 @@
module Spree
module CommissionRules
# Charge this rate only when the seller is one of these.
- class VendorRule < Spree::CommissionRule
+ class SellerRule < Spree::CommissionRule
# Ids are checked against the rate's own store on write, so a rule can
# never be pointed at another marketplace's seller — and the client is
# told, rather than having the id quietly dropped.
- preference :vendor_ids, :array, default: [],
+ preference :seller_ids, :array, default: [],
parse_on_set: normalize_id_preference(
- klass: Spree::Vendor,
- scope: ->(rule) { rule.store.vendors }
+ klass: Spree::Seller,
+ scope: ->(rule) { rule.store.sellers }
)
- # @return [Array<Spree::Vendor>]
- def vendors
- return [] if preferred_vendor_ids.blank?
+ # @return [Array<Spree::Seller>]
+ def sellers
+ return [] if preferred_seller_ids.blank?
- Spree::Vendor.where(id: preferred_vendor_ids)
+ Spree::Seller.where(id: preferred_seller_ids)
end
def applicable?(context)
- return false if context.vendor.nil?
+ return false if context.seller.nil?
# A rule naming nobody narrows nothing, which is what a half-filled
# form leaves behind — it must not silently charge every seller.
- return false if preferred_vendor_ids.blank?
+ return false if preferred_seller_ids.blank?
- preferred_vendor_ids.map(&:to_s).include?(context.vendor.id.to_s)
+ preferred_seller_ids.map(&:to_s).include?(context.seller.id.to_s)
end
end
end
diff --git a/spree/core/app/models/spree/commissions/context.rb b/spree/core/app/models/spree/commissions/context.rb
index b183c36237..6f75943c94 100644
--- a/spree/core/app/models/spree/commissions/context.rb
+++ b/spree/core/app/models/spree/commissions/context.rb
@@ -10,9 +10,9 @@ module Spree
# category walk especially — are resolved for the whole order up front.
# Mirrors Spree::Pricing::Context, which serves price rules the same way.
class Context
- attr_reader :line_item, :fulfillment, :vendor, :order, :currency
+ attr_reader :line_item, :fulfillment, :seller, :order, :currency
- # @param vendor [Spree::Vendor] the seller being charged
+ # @param seller [Spree::Seller] the seller being charged
# @param order [Spree::Order]
# @param line_item [Spree::LineItem, nil] the sale being commissioned…
# @param fulfillment [Spree::Fulfillment, nil] …or its delivery
@@ -20,8 +20,8 @@ module Spree
# @param categories [Array<Spree::Category>, nil] the product's
# categories *with their ancestors*, resolved once for the order — a
# rate on a parent governs everything filed beneath it
- def initialize(vendor:, order:, line_item: nil, fulfillment: nil, currency: nil, categories: nil)
- @vendor = vendor
+ def initialize(seller:, order:, line_item: nil, fulfillment: nil, currency: nil, categories: nil)
+ @seller = seller
@order = order
@line_item = line_item
@fulfillment = fulfillment
diff --git a/spree/core/app/models/spree/delivery_rate_provider/base.rb b/spree/core/app/models/spree/delivery_rate_provider/base.rb
index 93ca9a745f..369657c368 100644
--- a/spree/core/app/models/spree/delivery_rate_provider/base.rb
+++ b/spree/core/app/models/spree/delivery_rate_provider/base.rb
@@ -82,7 +82,7 @@ module Spree
# hides the ones they have.
#
# Return {ServiceCatalog.listing} with `[{ carrier:, service:,
- # label: }]`, {ServiceCatalog.unavailable} with the vendor's message
+ # label: }]`, {ServiceCatalog.unavailable} with the seller's message
# when the listing cannot be fetched (unconnected integration,
# credential tier without access, carrier outage), or
# {ServiceCatalog.none} — the default — when the provider lists no
diff --git a/spree/core/app/models/spree/delivery_rate_provider/service_catalog.rb b/spree/core/app/models/spree/delivery_rate_provider/service_catalog.rb
index 5a1aa1970c..b5487dd64b 100644
--- a/spree/core/app/models/spree/delivery_rate_provider/service_catalog.rb
+++ b/spree/core/app/models/spree/delivery_rate_provider/service_catalog.rb
@@ -7,7 +7,7 @@ module Spree
# Providers fetch live where their API allows it. When it does not — an
# unconnected integration, a credential tier that forbids the listing
# endpoint, a carrier outage — they return {.unavailable} with the
- # vendor's own message, and the picker explains the situation instead of
+ # seller's own message, and the picker explains the situation instead of
# showing a silently empty or invented list.
class ServiceCatalog
include ActiveModel::Model
@@ -33,7 +33,7 @@ module Spree
new(services: Array(services))
end
- # @param message [String] the vendor's message, shown to the merchant
+ # @param message [String] the seller's message, shown to the merchant
# @return [ServiceCatalog]
def self.unavailable(message)
new(error_message: message)
diff --git a/spree/core/app/models/spree/export.rb b/spree/core/app/models/spree/export.rb
index eb6f4f2da3..f34ce92f4b 100644
--- a/spree/core/app/models/spree/export.rb
+++ b/spree/core/app/models/spree/export.rb
@@ -25,7 +25,7 @@ module Spree
# exports without a human user attached. The email notification is
# skipped for these — apps poll instead.
belongs_to :user, class_name: Spree.admin_user_class.to_s, optional: true
- belongs_to :vendor, -> { with_deleted }, class_name: 'Spree::Vendor', optional: true
+ belongs_to :seller, -> { with_deleted }, class_name: 'Spree::Seller', optional: true
#
# Validations
@@ -40,7 +40,7 @@ module Spree
#
# Ransack configuration
#
- self.whitelisted_ransackable_attributes = %w[number type format vendor_id]
+ self.whitelisted_ransackable_attributes = %w[number type format seller_id]
#
# Preferences
@@ -132,7 +132,7 @@ module Spree
def scope
scope = model_class
scope = scope.for_store(store) if model_class.respond_to?(:for_store)
- scope = scope.for_vendor(vendor) if model_class.respond_to?(:for_vendor) && vendor.present?
+ scope = scope.for_seller(seller) if model_class.respond_to?(:for_seller) && seller.present?
# A staff-created export only contains what its creator may read; a
# userless export (console, system jobs) is unfiltered.
scope = scope.accessible_by(current_ability) if user.present?
@@ -158,7 +158,7 @@ module Spree
# Replace any prefixed IDs in `search_params` with their raw DB IDs so
# Ransack can match them. Without this, an admin filtering an export by
- # a foreign key (`promotion_id_eq: 'promo_xxx'`, `vendor_id_in: [...]`)
+ # a foreign key (`promotion_id_eq: 'promo_xxx'`, `seller_id_in: [...]`)
# would always get zero rows. We only touch values that look like
# prefixed IDs — anything else (numeric IDs, code strings, ranges,
# state names) passes through untouched.
diff --git a/spree/core/app/models/spree/fulfillment.rb b/spree/core/app/models/spree/fulfillment.rb
index e629d321df..8d161a7ddc 100644
--- a/spree/core/app/models/spree/fulfillment.rb
+++ b/spree/core/app/models/spree/fulfillment.rb
@@ -588,7 +588,7 @@ module Spree
delivery_method&.provider || Spree::FulfillmentProvider::Manual.new
end
- # Commission base for multi-vendor include_shipping: the cost net of
+ # Commission base for multi-seller include_shipping: the cost net of
# fulfillment-attached discounts.
#
# @return [BigDecimal]
diff --git a/spree/core/app/models/spree/import.rb b/spree/core/app/models/spree/import.rb
index dbf7f541c4..47b9c80fbe 100644
--- a/spree/core/app/models/spree/import.rb
+++ b/spree/core/app/models/spree/import.rb
@@ -25,7 +25,7 @@ module Spree
#
# Associations
#
- belongs_to :owner, polymorphic: true # Store, Vendor, etc.
+ belongs_to :owner, polymorphic: true # Store, Seller, etc.
belongs_to :user, class_name: Spree.admin_user_class.to_s, optional: true
has_many :mappings, class_name: 'Spree::ImportMapping', dependent: :destroy, inverse_of: :import
alias import_mappings mappings
diff --git a/spree/core/app/models/spree/integration.rb b/spree/core/app/models/spree/integration.rb
index 6f2d19c07e..04f724ef27 100644
--- a/spree/core/app/models/spree/integration.rb
+++ b/spree/core/app/models/spree/integration.rb
@@ -37,7 +37,7 @@ module Spree
validate :type_must_be_registered, if: :type_changed?
# Verify-before-activate (decisions.md 2026-08-06): saving credentials
# never makes a network call; flipping active on does, and a failed
- # connection blocks going live with the vendor's message attached.
+ # connection blocks going live with the seller's message attached.
validate :must_connect_when_activating, if: -> { active? && will_save_change_to_active? }
#
@@ -170,7 +170,7 @@ module Spree
errors.add(:type, Spree.t('errors.messages.integration_type_not_registered'))
end
- # On :base, not :active — the vendor's message ("This api key is no
+ # On :base, not :active — the seller's message ("This api key is no
# longer active…") is a record-level failure, and an attribute error
# would render with the humanized attribute prepended ("Active This
# api key…").
diff --git a/spree/core/app/models/spree/invitation.rb b/spree/core/app/models/spree/invitation.rb
index 818140f290..9c2826d37c 100644
--- a/spree/core/app/models/spree/invitation.rb
+++ b/spree/core/app/models/spree/invitation.rb
@@ -13,7 +13,7 @@ module Spree
#
# Associations
#
- belongs_to :resource, polymorphic: true # eg. Store, Vendor, Account
+ belongs_to :resource, polymorphic: true # eg. Store, Seller, Account
belongs_to :inviter, polymorphic: true # User or AdminUser
belongs_to :invitee, polymorphic: true, optional: true # User or AdminUser
belongs_to :role, class_name: 'Spree::Role'
diff --git a/spree/core/app/models/spree/line_item.rb b/spree/core/app/models/spree/line_item.rb
index 250b42fca0..57f948837f 100644
--- a/spree/core/app/models/spree/line_item.rb
+++ b/spree/core/app/models/spree/line_item.rb
@@ -18,9 +18,9 @@ module Spree
end
belongs_to :tax_category, -> { with_deleted }, class_name: 'Spree::TaxCategory'
belongs_to :price_list, class_name: 'Spree::PriceList', optional: true
- # Snapshotted from the variant when the line is added — see copy_vendor.
+ # Snapshotted from the variant when the line is added — see copy_seller.
# Nil is the operator's own first-party item.
- belongs_to :vendor, class_name: 'Spree::Vendor', optional: true
+ belongs_to :seller, class_name: 'Spree::Seller', optional: true
has_one :product, -> { with_deleted }, class_name: 'Spree::Product', through: :variant
@@ -36,7 +36,7 @@ module Spree
before_validation :copy_price
before_validation :copy_tax_category
- before_validation :copy_vendor
+ before_validation :copy_seller
validates :variant, presence: true
validate :exactly_one_owner
@@ -155,7 +155,7 @@ module Spree
end
# Reads the seller off the variant, falling back to the product that owns
- # the listing. Once a variant can carry its own `vendor_id` (the shared
+ # the listing. Once a variant can carry its own `seller_id` (the shared
# catalog), the variant answers first and this fallback covers a product
# whose seller owns every variant on it.
#
@@ -168,17 +168,17 @@ module Spree
# Keyed on the order being placed rather than on the line being persisted:
# a draft order's lines are persisted too, and they must keep following
# their product until the order is actually placed.
- def copy_vendor
+ def copy_seller
return if variant.blank?
return if order&.placed?
- self.vendor_id = vendor_id_from_variant
+ self.seller_id = seller_id_from_variant
end
- def vendor_id_from_variant
- return variant.vendor_id if variant.respond_to?(:vendor_id) && variant.vendor_id.present?
+ def seller_id_from_variant
+ return variant.seller_id if variant.respond_to?(:seller_id) && variant.seller_id.present?
- variant.product&.vendor_id
+ variant.product&.seller_id
end
extend DisplayMoney
diff --git a/spree/core/app/models/spree/order.rb b/spree/core/app/models/spree/order.rb
index 7d1da8a2ed..82c2ffe56c 100644
--- a/spree/core/app/models/spree/order.rb
+++ b/spree/core/app/models/spree/order.rb
@@ -184,7 +184,7 @@ module Spree
# What the marketplace charged its sellers on this order. Off-order by
# design: commission never reaches a total the customer pays, so this is a
- # ledger the order merely hosts. See docs/plans/6.0-multi-vendor-marketplace.md.
+ # ledger the order merely hosts. See docs/plans/6.0-multi-seller-marketplace.md.
has_many :commission_lines, class_name: 'Spree::CommissionLine', dependent: :destroy, inverse_of: :order
has_many :line_item_tax_lines, through: :line_items, source: :tax_lines
diff --git a/spree/core/app/models/spree/policy.rb b/spree/core/app/models/spree/policy.rb
index bd5b1dfd1a..2e291b0961 100644
--- a/spree/core/app/models/spree/policy.rb
+++ b/spree/core/app/models/spree/policy.rb
@@ -16,7 +16,7 @@ module Spree
#
# Associations
#
- belongs_to :owner, polymorphic: true, touch: true # can be a store or a vendor or organization
+ belongs_to :owner, polymorphic: true, touch: true # can be a store or a seller or organization
#
# Translations
diff --git a/spree/core/app/models/spree/product.rb b/spree/core/app/models/spree/product.rb
index ef7b9760d9..8a8a8a84de 100644
--- a/spree/core/app/models/spree/product.rb
+++ b/spree/core/app/models/spree/product.rb
@@ -130,7 +130,7 @@ module Spree
# The seller this product belongs to on a marketplace. Nil is the
# operator's own catalog — which is everything, on a store selling only
# its own goods.
- belongs_to :vendor, class_name: 'Spree::Vendor', optional: true, inverse_of: :products
+ belongs_to :seller, class_name: 'Spree::Seller', optional: true, inverse_of: :products
# How this product ships: origins, zones and methods all hang off the
# profile. Required — a product without one could not be fulfilled at
@@ -144,9 +144,9 @@ module Spree
# linking another store's profile.
validate :delivery_profile_must_belong_to_store, if: :delivery_profile_id_changed?
# Either side moving breaks the pair, and a product's store is not frozen
- # after create, so watching only the vendor would let a move carry the old
+ # after create, so watching only the seller would let a move carry the old
# store's seller along.
- validate :vendor_must_belong_to_store, if: -> { vendor_id_changed? || store_id_changed? }
+ validate :seller_must_belong_to_store, if: -> { seller_id_changed? || store_id_changed? }
# Every product has at least one variant. `default_variant` is the "face" of
# the product (price display, default add-to-cart, property delegation).
@@ -354,9 +354,9 @@ module Spree
apply_variants(variants_params)
end
- self.whitelisted_ransackable_attributes = %w[description name slug discontinue_on status available_on created_at updated_at vendor_id]
+ self.whitelisted_ransackable_attributes = %w[description name slug discontinue_on status available_on created_at updated_at seller_id]
self.whitelisted_ransackable_associations = %w[categories collections store channels variants default_variant tags labels
- product_type product_categories option_types vendor]
+ product_type product_categories option_types seller]
self.whitelisted_ransackable_scopes = %w[not_discontinued search_by_name in_taxon in_category in_categories in_collection price_between
price_lte price_gte
search multi_search in_stock out_of_stock with_option_value_ids
@@ -941,13 +941,13 @@ module Spree
end
# A seller from another store would put one store's catalog inside another
- # store's vendor — and every vendor-scoped read is rooted in exactly that
+ # store's seller — and every seller-scoped read is rooted in exactly that
# association.
- def vendor_must_belong_to_store
- return if vendor.nil? || store.nil?
- return if vendor.store_id == store_id
+ def seller_must_belong_to_store
+ return if seller.nil? || store.nil?
+ return if seller.store_id == store_id
- errors.add(:vendor, :invalid)
+ errors.add(:seller, :invalid)
end
def run_touch_callbacks
diff --git a/spree/core/app/models/spree/report_line_items/products_performance.rb b/spree/core/app/models/spree/report_line_items/products_performance.rb
index 967dedf044..3070a86d45 100644
--- a/spree/core/app/models/spree/report_line_items/products_performance.rb
+++ b/spree/core/app/models/spree/report_line_items/products_performance.rb
@@ -3,7 +3,7 @@ module Spree
class ProductsPerformance < Spree::ReportLineItem
attribute :sku, :string
attribute :name, :string
- attribute :vendor, :string
+ attribute :seller, :string
attribute :category_lvl0, :string
attribute :category_lvl1, :string
attribute :category_lvl2, :string
@@ -17,8 +17,8 @@ module Spree
delegate :sku, :name, to: :record
- def vendor
- record.try(:vendor_name)
+ def seller
+ record.try(:seller_name)
end
def category_lvl0
diff --git a/spree/core/app/models/spree/reports/products_performance.rb b/spree/core/app/models/spree/reports/products_performance.rb
index 8c8d0e1f0e..a1197ff805 100644
--- a/spree/core/app/models/spree/reports/products_performance.rb
+++ b/spree/core/app/models/spree/reports/products_performance.rb
@@ -26,7 +26,7 @@ module Spree
line_items_sql = line_items_scope.to_sql
product_scope = store.products
- product_scope = product_scope.where(vendor_id: vendor.id) if defined?(vendor) && vendor.present?
+ product_scope = product_scope.where(seller_id: seller.id) if defined?(seller) && seller.present?
product_scope.includes(:categories, :tax_category, variants: :prices).
joins("LEFT JOIN (#{line_items_sql}) AS line_items ON #{Spree::Product.table_name}.id = line_items.product_id").
diff --git a/spree/core/app/models/spree/reports/sales_total.rb b/spree/core/app/models/spree/reports/sales_total.rb
index ba036c2d82..1b276e963e 100644
--- a/spree/core/app/models/spree/reports/sales_total.rb
+++ b/spree/core/app/models/spree/reports/sales_total.rb
@@ -9,7 +9,7 @@ module Spree
)
).includes(:order, shipments: :inventory_units, variant: :product)
- scope = scope.where(vendor_id: vendor.id) if defined?(vendor) && vendor.present?
+ scope = scope.where(seller_id: seller.id) if defined?(seller) && seller.present?
scope
end
diff --git a/spree/core/app/models/spree/role.rb b/spree/core/app/models/spree/role.rb
index 6992d0efb8..8d329c3bc1 100644
--- a/spree/core/app/models/spree/role.rb
+++ b/spree/core/app/models/spree/role.rb
@@ -29,7 +29,7 @@ module Spree
# Associations
#
# What this role governs: a Spree::Store for back-office staff, a
- # marketplace vendor for a seller's own team. The resource is the role's
+ # marketplace seller for a seller's own team. The resource is the role's
# owner and its audience at once — a role on a Store is a staff role by
# construction, so there is no parallel column to keep in step.
belongs_to :resource, polymorphic: true
@@ -44,7 +44,7 @@ module Spree
#
validates :resource, presence: true
# Unique within the owning resource rather than globally: two stores may
- # each define a "Manager", and a store may hold one beside a vendor's.
+ # each define a "Manager", and a store may hold one beside a seller's.
validates :name, presence: true,
uniqueness: { case_sensitive: false, allow_blank: true,
scope: [*spree_base_uniqueness_scope, :resource_id, :resource_type] }
@@ -85,7 +85,7 @@ module Spree
end
# The protected super-role: everything in this store. Guarded by the owning
- # resource as well as the name — names are unique per resource, so a vendor
+ # resource as well as the name — names are unique per resource, so a seller
# may legitimately call a role "admin" and it must never be mistaken for
# this one — and by the `mutable` flag, so a stale flag cannot expose it.
#
@@ -104,7 +104,7 @@ module Spree
# The permission catalog's name for the panel this role belongs to —
# derived from the owning resource, never stored, so the two cannot drift.
- # `Spree::Vendor` reads as `:vendor`.
+ # `Spree::Seller` reads as `:seller`.
#
# @return [Symbol, nil]
def audience
diff --git a/spree/core/app/models/spree/role_user.rb b/spree/core/app/models/spree/role_user.rb
index 0e640a1442..ba1e0815bf 100644
--- a/spree/core/app/models/spree/role_user.rb
+++ b/spree/core/app/models/spree/role_user.rb
@@ -1,6 +1,6 @@
module Spree
# A user holding a role. Where the grant applies is the role's business —
- # `role.resource` names the store or vendor it governs — so an assignment
+ # `role.resource` names the store or seller it governs — so an assignment
# carries nothing but the pairing.
class RoleUser < Spree.base_class
#
diff --git a/spree/core/app/models/spree/vendor.rb b/spree/core/app/models/spree/seller.rb
similarity index 81%
rename from spree/core/app/models/spree/vendor.rb
rename to spree/core/app/models/spree/seller.rb
index f066bbbec7..c1c8072684 100644
--- a/spree/core/app/models/spree/vendor.rb
+++ b/spree/core/app/models/spree/seller.rb
@@ -1,13 +1,13 @@
# frozen_string_literal: true
module Spree
- # A selling party on a marketplace: the store is the tenant, the vendor is a
- # seller within it (docs/plans/6.0-multi-vendor-marketplace.md).
+ # A selling party on a marketplace: the store is the tenant, the seller is a
+ # seller within it (docs/plans/6.0-multi-seller-marketplace.md).
#
- # A vendor owns roles, so its team is the people holding them — the same
- # machinery the store's own back office uses, pointed at the vendor.
- class Vendor < Spree.base_class
- has_prefix_id :ven
+ # A seller owns roles, so its team is the people holding them — the same
+ # machinery the store's own back office uses, pointed at the seller.
+ class Seller < Spree.base_class
+ has_prefix_id :sel
acts_as_paranoid
@@ -20,23 +20,23 @@ module Spree
publishes_lifecycle_events
- # Where a vendor is in its life on the marketplace. Transitions belong to
- # workflows (Spree::Vendors::Approve and friends) rather than a state
+ # Where a seller is in its life on the marketplace. Transitions belong to
+ # workflows (Spree::Sellers::Approve and friends) rather than a state
# machine: approving sends mail and provisions payouts, which is exactly
# the work that must not run inside a save callback.
#
# pending → invited → onboarding → ready_for_review → approved
#
- # `approve` also lifts a suspension, and a rejected vendor can be revived,
+ # `approve` also lifts a suspension, and a rejected seller can be revived,
# so the reachable set is deliberately wider than that line suggests.
include Spree::HasStatus
has_status :pending, :invited, :canceled, :onboarding, :ready_for_review,
:approved, :rejected, :suspended, default: :pending
- # Who remits consumer tax on this vendor's sales. `vendor` means they are
+ # Who remits consumer tax on this seller's sales. `seller` means they are
# merchant of record; `platform` is the marketplace-facilitator case, and
- # only Enterprise decides a vendor belongs there — core just reads it.
- TAX_REMITTANCES = %w[vendor platform].freeze
+ # only Enterprise decides a seller belongs there — core just reads it.
+ TAX_REMITTANCES = %w[seller platform].freeze
PAYOUT_INTERVALS = %w[daily weekly biweekly monthly manual].freeze
TRANSLATABLE_FIELDS = %i[name about].freeze
@@ -48,7 +48,7 @@ module Spree
sanitizes_rich_text :about
acts_as_paranoid
- # A deleted vendor's translations still have to render — its storefront
+ # A deleted seller's translations still have to render — its storefront
# profile outlives the row for as long as anything links to it.
default_scope { unscope(where: :deleted_at) }
end
@@ -64,8 +64,8 @@ module Spree
# read back — a row belonging to another store's customer.
#
# Not `dependent: :destroy`, unlike the equivalent on CompanyLocation: a
- # vendor is paranoid, so destroy is a soft delete, and taking the addresses
- # with it would hard-delete the rows a restored vendor — and its historical
+ # seller is paranoid, so destroy is a soft delete, and taking the addresses
+ # with it would hard-delete the rows a restored seller — and its historical
# commission invoices — still point at.
belongs_to :billing_address, class_name: 'Spree::Address', optional: true
belongs_to :returns_address, class_name: 'Spree::Address', optional: true
@@ -83,12 +83,12 @@ module Spree
end
end
- # Products and stock survive the vendor leaving: the operator decides what
+ # Products and stock survive the seller leaving: the operator decides what
# happens to a departed seller's catalog, so it is never cascade-deleted.
has_many :products, class_name: 'Spree::Product', dependent: :nullify
# What this seller has been charged. Deliberately neither destroyed nor
- # nullified when the vendor goes: a vendor is paranoid, so it is still
+ # nullified when the seller goes: a seller is paranoid, so it is still
# there to be read, and a settlement record that forgot who owed it would
# be worse than no record at all.
has_many :commission_lines, class_name: 'Spree::CommissionLine', dependent: nil
@@ -123,24 +123,24 @@ module Spree
# Callbacks
#
before_validation :normalize_slug
- # A vendor is born through plain CRUD rather than a workflow — creating one
+ # A seller is born through plain CRUD rather than a workflow — creating one
# is not a lifecycle transition, inviting them is — so the default lands
# here instead of in a creating workflow, as on Spree::Fulfillment.
after_initialize :apply_default_status, if: :new_record?
# Roles refuse to be destroyed while anyone still holds them, which is
- # right when a role is deleted on its own and wrong when the whole vendor
+ # right when a role is deleted on its own and wrong when the whole seller
# goes: its roles govern nothing else. Dissolving the team first lets the
- # cascade through, so an invited vendor stays deletable.
+ # cascade through, so an invited seller stays deletable.
before_destroy :dissolve_team, prepend: true
- # A vendor's own team is granted through its roles, not the store's.
+ # A seller's own team is granted through its roles, not the store's.
#
# @return [Spree::Role]
def default_user_role
Spree::Role.default_admin_role(self)
end
- # Whether the vendor is currently away. The catalog stays visible; what
+ # Whether the seller is currently away. The catalog stays visible; what
# stops is selling.
#
# @return [Boolean]
@@ -148,7 +148,7 @@ module Spree
holiday_mode_until.present? && holiday_mode_until > Time.current
end
- # Whether customers may buy from this vendor right now.
+ # Whether customers may buy from this seller right now.
#
# @return [Boolean]
def sellable?
@@ -171,7 +171,7 @@ module Spree
end
# Memberships and outstanding invitations are what make a role undeletable.
- # They mean nothing once the vendor is gone, so they go first.
+ # They mean nothing once the seller is gone, so they go first.
def dissolve_team
Spree::RoleUser.where(role_id: roles.ids).delete_all
invitations.destroy_all
diff --git a/spree/core/app/models/spree/setup_tasks.rb b/spree/core/app/models/spree/setup_tasks.rb
index 1f7896feb3..498f8e1cbf 100644
--- a/spree/core/app/models/spree/setup_tasks.rb
+++ b/spree/core/app/models/spree/setup_tasks.rb
@@ -1,7 +1,7 @@
module Spree
# Registry of onboarding tasks for a given subject type. `Spree.store_setup_tasks`
# holds the Getting Started checklist evaluated against a store; future
- # registries (e.g. vendor onboarding) instantiate the same class against
+ # registries (e.g. seller onboarding) instantiate the same class against
# their own subject. Defaults are registered in
# `config/initializers/spree_store_setup_tasks.rb`; extensions and host apps
# can add or remove tasks at boot:
diff --git a/spree/core/app/models/spree/stock_transfer.rb b/spree/core/app/models/spree/stock_transfer.rb
index a620bc1293..73754a6dfb 100644
--- a/spree/core/app/models/spree/stock_transfer.rb
+++ b/spree/core/app/models/spree/stock_transfer.rb
@@ -66,7 +66,7 @@ module Spree
true
end
- # receive inventory from external vendor
+ # receive inventory from external seller
def receive(destination_location, variants)
transfer(nil, destination_location, variants)
end
diff --git a/spree/core/app/models/spree/store.rb b/spree/core/app/models/spree/store.rb
index f94625ef82..8c514b6b54 100644
--- a/spree/core/app/models/spree/store.rb
+++ b/spree/core/app/models/spree/store.rb
@@ -59,7 +59,7 @@ module Spree
# Sellers are a different audience from shoppers, with their own reasons to
# be silenced — a marketplace fronting its own seller comms turns these off
# without also stopping customer receipts.
- preference :send_vendor_transactional_emails, :boolean, default: true
+ preference :send_seller_transactional_emails, :boolean, default: true
# Marketplace preferences
#
# VAT on the commission itself, as a fraction, when neither the rate nor
@@ -184,7 +184,7 @@ module Spree
has_many :tax_categories, class_name: 'Spree::TaxCategory', dependent: :destroy, inverse_of: :store
has_many :tax_rates, class_name: 'Spree::TaxRate', dependent: :destroy, inverse_of: :store
- has_many :vendors, class_name: 'Spree::Vendor', dependent: :destroy, inverse_of: :store
+ has_many :sellers, class_name: 'Spree::Seller', dependent: :destroy, inverse_of: :store
has_many :commission_rates, class_name: 'Spree::CommissionRate', dependent: :destroy, inverse_of: :store
has_many :wishlists, class_name: 'Spree::Wishlist'
diff --git a/spree/core/app/presenters/spree/csv/order_line_item_presenter.rb b/spree/core/app/presenters/spree/csv/order_line_item_presenter.rb
index 04db28f855..98bbcb1d3d 100644
--- a/spree/core/app/presenters/spree/csv/order_line_item_presenter.rb
+++ b/spree/core/app/presenters/spree/csv/order_line_item_presenter.rb
@@ -28,7 +28,7 @@ module Spree
'Item Total Price',
'Item requires shipping',
'Item taxbale',
- 'Item Vendor',
+ 'Item Seller',
'Category lvl0',
'Category lvl1',
'Category lvl2',
@@ -96,7 +96,7 @@ module Spree
line_item.total,
!line_item.product.digital?,
line_item.product.tax_category_id.present?,
- line_item.product.try(:vendor_name),
+ line_item.product.try(:seller_name),
taxon_dict(line_item.product.primary_category)[0],
taxon_dict(line_item.product.primary_category)[1],
taxon_dict(line_item.product.primary_category)[2],
diff --git a/spree/core/app/presenters/spree/csv/product_variant_presenter.rb b/spree/core/app/presenters/spree/csv/product_variant_presenter.rb
index 136c353400..1e0509e4b9 100644
--- a/spree/core/app/presenters/spree/csv/product_variant_presenter.rb
+++ b/spree/core/app/presenters/spree/csv/product_variant_presenter.rb
@@ -9,7 +9,7 @@ module Spree
'name',
'slug',
'status',
- 'vendor_name',
+ 'seller_name',
'description',
'meta_title',
'meta_description',
@@ -64,7 +64,7 @@ module Spree
# Generates an array representing a CSV row of product variant data.
#
# For the primary variant row (when the index is zero), product-level details such as name,
- # slug, status, vendor name, description, meta tags, and tag/label lists are included.
+ # slug, status, seller name, description, meta tags, and tag/label lists are included.
# In all cases, variant-specific attributes (e.g., id, SKU, pricing, dimensions, weight,
# availability dates, inventory count, shipping category, tax category, image URLs via original_url,
# and the first three option types and corresponding option values) are appended.
@@ -82,7 +82,7 @@ module Spree
index.zero? ? product.name : nil,
product.slug,
index.zero? ? product.status : nil,
- index.zero? ? product.try(:vendor_name) : nil,
+ index.zero? ? product.try(:seller_name) : nil,
index.zero? ? product.description : nil,
index.zero? ? product.meta_title : nil,
index.zero? ? product.meta_description : nil,
diff --git a/spree/core/app/services/spree/commissions/calculate_line.rb b/spree/core/app/services/spree/commissions/calculate_line.rb
index 4116e0d5ed..dc7620a2d5 100644
--- a/spree/core/app/services/spree/commissions/calculate_line.rb
+++ b/spree/core/app/services/spree/commissions/calculate_line.rb
@@ -21,14 +21,14 @@ module Spree
prepend Spree::ServiceModule::Base
# @param rate [Spree::CommissionRate] the resolved rate
- # @param vendor [Spree::Vendor] the seller being charged
+ # @param seller [Spree::Seller] the seller being charged
# @param order [Spree::Order]
# @param line_item [Spree::LineItem, nil] the commissioned item…
# @param fulfillment [Spree::Fulfillment, nil] …or the commissioned delivery
# @param commission_tax [Spree::CommissionTax, nil] pre-resolved tax
# treatment, so commissioning a whole order resolves it once
# @return [Spree::CommissionLine] unsaved
- def call(rate:, vendor:, order:, line_item: nil, fulfillment: nil, commission_tax: nil)
+ def call(rate:, seller:, order:, line_item: nil, fulfillment: nil, commission_tax: nil)
# Exactly one, checked here rather than left to the record's own
# validation: passing both would otherwise quietly commission the item
# and drop the delivery, and only fail on save.
@@ -40,7 +40,7 @@ module Spree
subject = subjects.first
currency = order.currency
precision = Spree::Money::Rounding.precision(currency)
- tax = commission_tax || resolve_tax(rate: rate, vendor: vendor, order: order)
+ tax = commission_tax || resolve_tax(rate: rate, seller: seller, order: order)
amount = Spree::Money::Rounding.quantize(charge_for(rate, subject, currency), precision)
tax_amount = Spree::Money::Rounding.quantize(amount * tax.rate, precision)
@@ -48,7 +48,7 @@ module Spree
success(
Spree::CommissionLine.new(
order: order,
- vendor: vendor,
+ seller: seller,
line_item: line_item,
fulfillment: fulfillment,
commission_rate: rate,
@@ -124,8 +124,8 @@ module Spree
amount
end
- def resolve_tax(rate:, vendor:, order:)
- Spree.commissions_resolve_tax_rate_service.call(rate: rate, vendor: vendor, order: order).value
+ def resolve_tax(rate:, seller:, order:)
+ Spree.commissions_resolve_tax_rate_service.call(rate: rate, seller: seller, order: order).value
end
end
end
diff --git a/spree/core/app/services/spree/commissions/commission_order.rb b/spree/core/app/services/spree/commissions/commission_order.rb
index 2d55689f47..f54f575fce 100644
--- a/spree/core/app/services/spree/commissions/commission_order.rb
+++ b/spree/core/app/services/spree/commissions/commission_order.rb
@@ -12,7 +12,7 @@ module Spree
# placement would charge them twice.
#
# Lines are grouped by the seller each item was bought from, which is
- # `line_item.vendor_id` — the snapshot frozen when the order was placed,
+ # `line_item.seller_id` — the snapshot frozen when the order was placed,
# not whoever owns the product today. Items with no seller are the
# marketplace's own and are not commissioned.
#
@@ -32,22 +32,22 @@ module Spree
return success([]) if order.commission_lines.exists?
commissioned = order.line_items.
- includes(vendor: :billing_address, variant: { product: :categories }).
- select(&:vendor_id)
+ includes(seller: :billing_address, variant: { product: :categories }).
+ select(&:seller_id)
return success([]) if commissioned.empty?
rates = Spree::Commissions::ResolveRate.candidates_for(order.store)
categories = Spree::Commissions::ResolveRate.categories_for(
commissioned.map { |line_item| line_item.variant&.product }
)
- deliveries = deliveries_by_vendor(order)
+ deliveries = deliveries_by_seller(order)
lines = []
Spree::CommissionLine.transaction do
- commissioned.group_by(&:vendor_id).each_value do |line_items|
+ commissioned.group_by(&:seller_id).each_value do |line_items|
lines.concat(
- commission_vendor(
- order: order, vendor: line_items.first.vendor, line_items: line_items,
+ commission_seller(
+ order: order, seller: line_items.first.seller, line_items: line_items,
rates: rates, categories: categories, deliveries: deliveries
)
)
@@ -65,9 +65,9 @@ module Spree
private
- def commission_vendor(order:, vendor:, line_items:, rates:, categories:, deliveries:)
+ def commission_seller(order:, seller:, line_items:, rates:, categories:, deliveries:)
matched = line_items.filter_map do |line_item|
- rate = resolve(line_item: line_item, vendor: vendor, order: order, rates: rates, categories: categories)
+ rate = resolve(line_item: line_item, seller: seller, order: order, rates: rates, categories: categories)
[line_item, rate] if rate
end
return [] if matched.empty?
@@ -77,11 +77,11 @@ module Spree
# rate asks the tax service once — but a rate may carry its own
# override, so two rates are still two answers.
taxes = Hash.new do |cache, rate|
- cache[rate] = resolve_tax(rate: rate, vendor: vendor, order: order)
+ cache[rate] = resolve_tax(rate: rate, seller: seller, order: order)
end
lines = matched.map do |line_item, rate|
- write(rate: rate, vendor: vendor, order: order, line_item: line_item, tax: taxes[rate])
+ write(rate: rate, seller: seller, order: order, line_item: line_item, tax: taxes[rate])
end
# A fulfillment carries goods, not a rate, so the one that governs
@@ -89,10 +89,10 @@ module Spree
shipping_rate = matched.map(&:last).find(&:include_shipping?)
return lines if shipping_rate.nil?
- deliveries.fetch(vendor.id, []).each do |fulfillment|
+ deliveries.fetch(seller.id, []).each do |fulfillment|
next if fulfillment.taxable_basis.zero?
- lines << write(rate: shipping_rate, vendor: vendor, order: order,
+ lines << write(rate: shipping_rate, seller: seller, order: order,
fulfillment: fulfillment, tax: taxes[shipping_rate])
end
@@ -111,28 +111,28 @@ module Spree
# construction and this becomes the plain "the seller's deliveries".
#
# @return [Hash{Integer=>Array<Spree::Fulfillment>}]
- def deliveries_by_vendor(order)
+ def deliveries_by_seller(order)
order.fulfillments.includes(fulfillment_items: :line_item).group_by do |fulfillment|
- sellers = fulfillment.fulfillment_items.map { |item| item.line_item&.vendor_id }.uniq
+ sellers = fulfillment.fulfillment_items.map { |item| item.line_item&.seller_id }.uniq
sellers.one? ? sellers.first : nil
end.except(nil)
end
- def resolve(line_item:, vendor:, order:, rates:, categories:)
+ def resolve(line_item:, seller:, order:, rates:, categories:)
Spree.commissions_resolve_rate_service.call(
- line_item: line_item, vendor: vendor, store: order.store, currency: order.currency,
+ line_item: line_item, seller: seller, store: order.store, currency: order.currency,
rates: rates, categories: categories
).value
end
- def resolve_tax(rate:, vendor:, order:)
- Spree.commissions_resolve_tax_rate_service.call(rate: rate, vendor: vendor, order: order).value
+ def resolve_tax(rate:, seller:, order:)
+ Spree.commissions_resolve_tax_rate_service.call(rate: rate, seller: seller, order: order).value
end
- def write(rate:, vendor:, order:, tax:, line_item: nil, fulfillment: nil)
+ def write(rate:, seller:, order:, tax:, line_item: nil, fulfillment: nil)
line = Spree.commissions_calculate_line_service.call(
- rate: rate, vendor: vendor, order: order,
+ rate: rate, seller: seller, order: order,
line_item: line_item, fulfillment: fulfillment, commission_tax: tax
).value
line.save!
diff --git a/spree/core/app/services/spree/commissions/resolve_rate.rb b/spree/core/app/services/spree/commissions/resolve_rate.rb
index f25af3728a..b50830d37b 100644
--- a/spree/core/app/services/spree/commissions/resolve_rate.rb
+++ b/spree/core/app/services/spree/commissions/resolve_rate.rb
@@ -20,7 +20,7 @@ module Spree
prepend Spree::ServiceModule::Base
# @param line_item [Spree::LineItem] the sale being commissioned
- # @param vendor [Spree::Vendor] its seller
+ # @param seller [Spree::Seller] its seller
# @param store [Spree::Store]
# @param currency [String] the order's currency
# @param rates [Array<Spree::CommissionRate>, nil] pre-loaded candidates,
@@ -30,11 +30,11 @@ module Spree
# product's categories with their ancestors, resolved once for the
# order — see .categories_for
# @return [Spree::CommissionRate, nil]
- def call(line_item:, vendor:, store:, currency: nil, rates: nil, categories: nil)
+ def call(line_item:, seller:, store:, currency: nil, rates: nil, categories: nil)
currency ||= line_item.currency
candidates = rates || self.class.candidates_for(store)
context = Spree::Commissions::Context.new(
- vendor: vendor,
+ seller: seller,
order: line_item.order,
line_item: line_item,
currency: currency,
diff --git a/spree/core/app/services/spree/commissions/resolve_tax_rate.rb b/spree/core/app/services/spree/commissions/resolve_tax_rate.rb
index 43e5f54e4b..a58a4c44b3 100644
--- a/spree/core/app/services/spree/commissions/resolve_tax_rate.rb
+++ b/spree/core/app/services/spree/commissions/resolve_tax_rate.rb
@@ -24,13 +24,13 @@ module Spree
prepend Spree::ServiceModule::Base
# @param rate [Spree::CommissionRate]
- # @param vendor [Spree::Vendor] the seller being invoiced
+ # @param seller [Spree::Seller] the seller being invoiced
# @param order [Spree::Order]
# @return [Spree::CommissionTax]
- def call(rate:, vendor:, order:)
+ def call(rate:, seller:, order:)
return success(configured(rate.commission_tax_rate)) if rate.commission_tax_rate.present?
- from_provider = provider_tax(vendor: vendor, order: order)
+ from_provider = provider_tax(seller: seller, order: order)
return success(from_provider) if from_provider
success(configured(order.store.preferred_default_commission_tax_rate))
@@ -53,8 +53,8 @@ module Spree
# Commission is written while an order is being placed, so a tax service
# being unreachable must never cost the marketplace a checkout: the error
# is reported and the configured default applies.
- def provider_tax(vendor:, order:)
- address = vendor.billing_address
+ def provider_tax(seller:, order:)
+ address = seller.billing_address
amount = order.tax_provider.service_tax_rate(address: address, store: order.store)
return nil if amount.blank?
@@ -68,7 +68,7 @@ module Spree
Rails.error.report(
error,
handled: true,
- context: { vendor_id: vendor.id, order_id: order.id },
+ context: { seller_id: seller.id, order_id: order.id },
source: 'spree.core'
)
nil
diff --git a/spree/core/app/workflows/spree/carts/complete.rb b/spree/core/app/workflows/spree/carts/complete.rb
index 5717f0b0e1..f606776d18 100644
--- a/spree/core/app/workflows/spree/carts/complete.rb
+++ b/spree/core/app/workflows/spree/carts/complete.rb
@@ -156,7 +156,7 @@ module Spree
end
# Exactly one of cart.order (single partition) or, later, the
- # multi-vendor order group.
+ # multi-seller order group.
def completion_result(cart)
cart.order
end
diff --git a/spree/core/app/workflows/spree/orders/cancel.rb b/spree/core/app/workflows/spree/orders/cancel.rb
index 5e647108b5..be79d70cb2 100644
--- a/spree/core/app/workflows/spree/orders/cancel.rb
+++ b/spree/core/app/workflows/spree/orders/cancel.rb
@@ -34,7 +34,7 @@ module Spree
step :ensure_cancellable
- # Veto point — vendor policy, already-dispatched guards. Before the
+ # Veto point — seller policy, already-dispatched guards. Before the
# transaction: nothing is written yet, and payment settlement has
# not run.
run_hooks :before_cancel
diff --git a/spree/core/app/workflows/spree/vendors/approve.rb b/spree/core/app/workflows/spree/sellers/approve.rb
similarity index 53%
rename from spree/core/app/workflows/spree/vendors/approve.rb
rename to spree/core/app/workflows/spree/sellers/approve.rb
index b9a7fa9bf7..087e7b623e 100644
--- a/spree/core/app/workflows/spree/vendors/approve.rb
+++ b/spree/core/app/workflows/spree/sellers/approve.rb
@@ -1,13 +1,13 @@
module Spree
- module Vendors
- # Lets a vendor trade. Also the way back for one that was suspended or
+ module Sellers
+ # Lets a seller trade. Also the way back for one that was suspended or
# turned down, which is why the guard admits more than the linear path.
class Approve < Spree::Workflow
hooks :validate, :after_approve
- # @param vendor [Spree::Vendor]
+ # @param seller [Spree::Seller]
# @param approver [Object, nil] the staff member approving
- def perform(vendor:, approver: nil)
+ def perform(seller:, approver: nil)
super
step :ensure_approvable
@@ -18,26 +18,26 @@ module Spree
end
run_hooks :after_approve
- vendor.publish_event('vendor.approved')
- success(vendor.reload)
+ seller.publish_event('seller.approved')
+ success(seller.reload)
end
private
def ensure_approvable
- failure(vendor, :already_approved) if vendor.approved?
+ failure(seller, :already_approved) if seller.approved?
- return if vendor.onboarding? || vendor.ready_for_review? ||
- vendor.suspended? || vendor.rejected?
+ return if seller.onboarding? || seller.ready_for_review? ||
+ seller.suspended? || seller.rejected?
- failure(vendor, :not_approvable)
+ failure(seller, :not_approvable)
end
- # Lifting a suspension clears the holiday with it: a vendor coming back
+ # Lifting a suspension clears the holiday with it: a seller coming back
# is coming back to sell, and leaving them invisible would look like the
# approval had not worked.
def mark_approved
- vendor.update!(status: 'approved', holiday_mode_until: nil)
+ seller.update!(status: 'approved', holiday_mode_until: nil)
end
end
end
diff --git a/spree/core/app/workflows/spree/vendors/invite.rb b/spree/core/app/workflows/spree/sellers/invite.rb
similarity index 59%
rename from spree/core/app/workflows/spree/vendors/invite.rb
rename to spree/core/app/workflows/spree/sellers/invite.rb
index 061a143600..2a10906abf 100644
--- a/spree/core/app/workflows/spree/vendors/invite.rb
+++ b/spree/core/app/workflows/spree/sellers/invite.rb
@@ -1,7 +1,7 @@
module Spree
- module Vendors
- # Invites someone to run a vendor: sends them an invitation to the vendor's
- # own team and marks the vendor as awaiting their acceptance.
+ module Sellers
+ # Invites someone to run a seller: sends them an invitation to the seller's
+ # own team and marks the seller as awaiting their acceptance.
#
# Accepting the invitation is what creates the membership — that happens on
# the existing invitation rail, not here, so this workflow only opens the
@@ -12,12 +12,12 @@ module Spree
# The invitation sent, so hook handlers can reach it.
attr_reader :invitation
- # @param vendor [Spree::Vendor]
+ # @param seller [Spree::Seller]
# @param email [String] who to invite
# @param inviter [Object] the staff member inviting them
- # @param role [Spree::Role, nil] the vendor role they accept into;
- # defaults to the vendor's own admin role
- def perform(vendor:, email:, inviter:, role: nil)
+ # @param role [Spree::Role, nil] the seller role they accept into;
+ # defaults to the seller's own admin role
+ def perform(seller:, email:, inviter:, role: nil)
super
step :ensure_invitable
@@ -29,32 +29,32 @@ module Spree
end
run_hooks :after_invite
- vendor.publish_event('vendor.invited')
- success(vendor.reload)
+ seller.publish_event('seller.invited')
+ success(seller.reload)
end
private
# Re-inviting is deliberate: an invitation expires, or the first one goes
- # to the wrong address. What cannot be re-opened is a vendor already
+ # to the wrong address. What cannot be re-opened is a seller already
# trading or already turned away.
def ensure_invitable
- return if vendor.pending? || vendor.invited? || vendor.canceled?
+ return if seller.pending? || seller.invited? || seller.canceled?
- failure(vendor, :not_invitable)
+ failure(seller, :not_invitable)
end
- # The invitation validates that the role is one this vendor owns, so a
+ # The invitation validates that the role is one this seller owns, so a
# role naming somewhere else comes back as a 422 rather than access
# granted elsewhere.
def send_invitation
- @invitation = vendor.invitations.new(email: email, role: role, inviter: inviter)
+ @invitation = seller.invitations.new(email: email, role: role, inviter: inviter)
failure(@invitation, @invitation.errors) unless @invitation.save
end
def mark_invited
- vendor.update!(status: 'invited')
+ seller.update!(status: 'invited')
end
end
end
diff --git a/spree/core/app/workflows/spree/vendors/reject.rb b/spree/core/app/workflows/spree/sellers/reject.rb
similarity index 59%
rename from spree/core/app/workflows/spree/vendors/reject.rb
rename to spree/core/app/workflows/spree/sellers/reject.rb
index d625bcc1ed..9306050cae 100644
--- a/spree/core/app/workflows/spree/vendors/reject.rb
+++ b/spree/core/app/workflows/spree/sellers/reject.rb
@@ -1,15 +1,15 @@
module Spree
- module Vendors
+ module Sellers
# Turns down an applicant. Distinct from suspension: this one never traded,
# so what they are told is that they were not admitted rather than that
# they have been stopped.
class Reject < Spree::Workflow
hooks :validate, :after_reject
- # @param vendor [Spree::Vendor]
+ # @param seller [Spree::Seller]
# @param reason [String, nil] why, for the applicant and the audit trail
# @param rejected_by [Object, nil] the staff member rejecting
- def perform(vendor:, reason: nil, rejected_by: nil)
+ def perform(seller:, reason: nil, rejected_by: nil)
super
step :ensure_rejectable
@@ -20,32 +20,32 @@ module Spree
end
run_hooks :after_reject
- vendor.publish_event('vendor.rejected')
- success(vendor.reload)
+ seller.publish_event('seller.rejected')
+ success(seller.reload)
end
private
- # Only an applicant can be turned down. A trading vendor is suspended,
+ # Only an applicant can be turned down. A trading seller is suspended,
# which is reversible and says something different.
def ensure_rejectable
- failure(vendor, :already_rejected) if vendor.rejected?
- failure(vendor, :cannot_reject_approved) if vendor.approved?
+ failure(seller, :already_rejected) if seller.rejected?
+ failure(seller, :cannot_reject_approved) if seller.approved?
- return if vendor.pending? || vendor.invited? || vendor.onboarding? || vendor.ready_for_review?
+ return if seller.pending? || seller.invited? || seller.onboarding? || seller.ready_for_review?
- failure(vendor, :not_rejectable)
+ failure(seller, :not_rejectable)
end
def mark_rejected
- vendor.update!(status: 'rejected')
+ seller.update!(status: 'rejected')
record_reason
end
def record_reason
return if reason.blank?
- vendor.update!(metadata: vendor.metadata.to_h.merge('rejection_reason' => reason))
+ seller.update!(metadata: seller.metadata.to_h.merge('rejection_reason' => reason))
end
end
end
diff --git a/spree/core/app/workflows/spree/vendors/suspend.rb b/spree/core/app/workflows/spree/sellers/suspend.rb
similarity index 53%
rename from spree/core/app/workflows/spree/vendors/suspend.rb
rename to spree/core/app/workflows/spree/sellers/suspend.rb
index 605b667b3b..8bc22e9feb 100644
--- a/spree/core/app/workflows/spree/vendors/suspend.rb
+++ b/spree/core/app/workflows/spree/sellers/suspend.rb
@@ -1,14 +1,14 @@
module Spree
- module Vendors
- # Halts a trading vendor: their catalog stops selling, their record and
- # history stay. Reversible through Spree::Vendors::Approve.
+ module Sellers
+ # Halts a trading seller: their catalog stops selling, their record and
+ # history stay. Reversible through Spree::Sellers::Approve.
class Suspend < Spree::Workflow
hooks :validate, :after_suspend
- # @param vendor [Spree::Vendor]
- # @param reason [String, nil] why, for the vendor and the audit trail
+ # @param seller [Spree::Seller]
+ # @param reason [String, nil] why, for the seller and the audit trail
# @param suspended_by [Object, nil] the staff member suspending
- def perform(vendor:, reason: nil, suspended_by: nil)
+ def perform(seller:, reason: nil, suspended_by: nil)
super
step :ensure_suspendable
@@ -19,27 +19,27 @@ module Spree
end
run_hooks :after_suspend
- vendor.publish_event('vendor.suspended')
- success(vendor.reload)
+ seller.publish_event('seller.suspended')
+ success(seller.reload)
end
private
- # Anyone already admitted can be stopped — including a vendor still
+ # Anyone already admitted can be stopped — including a seller still
# setting themselves up, since a marketplace may need to halt someone
- # mid-onboarding. What cannot be suspended is a vendor who has not been
+ # mid-onboarding. What cannot be suspended is a seller who has not been
# admitted at all; turning those away is Reject, which says something
# different and is not the same undo.
def ensure_suspendable
- failure(vendor, :already_suspended) if vendor.suspended?
+ failure(seller, :already_suspended) if seller.suspended?
- return if vendor.approved? || vendor.onboarding? || vendor.ready_for_review?
+ return if seller.approved? || seller.onboarding? || seller.ready_for_review?
- failure(vendor, :not_suspendable)
+ failure(seller, :not_suspendable)
end
def mark_suspended
- vendor.update!(status: 'suspended')
+ seller.update!(status: 'suspended')
record_reason
end
@@ -48,7 +48,7 @@ module Spree
def record_reason
return if reason.blank?
- vendor.update!(metadata: vendor.metadata.to_h.merge('suspension_reason' => reason))
+ seller.update!(metadata: seller.metadata.to_h.merge('suspension_reason' => reason))
end
end
end
diff --git a/spree/core/config/locales/en.yml b/spree/core/config/locales/en.yml
index 738309570c..03cfe11825 100644
--- a/spree/core/config/locales/en.yml
+++ b/spree/core/config/locales/en.yml
@@ -727,7 +727,7 @@ en:
product_rule:
description: Charges this rate only for the selected products
name: Product
- vendor_rule:
+ seller_rule:
description: Charges this rate only when the seller is one of the selected
name: Seller
company: Company
@@ -1066,7 +1066,7 @@ en:
link_description: 'To accept this invitation, please click the link below:'
subject: Invitation to join %{resource_name}
thanks: Thank you,
- invitation_role_resource_mismatch: must belong to the same store or vendor as the invitation
+ invitation_role_resource_mismatch: must belong to the same store or seller as the invitation
invitations: Invitations
invited_by: Invited by
iso: ISO Alpha-2
@@ -1504,6 +1504,25 @@ en:
select: Select
select_stock: Select stock
selected_quantity_not_available: selected of %{item} is not available.
+ seller: Seller
+ seller_access_denied: You do not have access to this seller.
+ seller_mailer:
+ approved_email:
+ action: Go to your dashboard
+ heading: You're approved
+ message: Your application to sell on %{store_name} has been approved. You can now list products and start taking orders.
+ subject: You're approved to sell on %{store_name}
+ get_in_touch: If you think this is a mistake, reply to this email or contact us at %{store_email}.
+ greeting: Hi %{seller_name},
+ rejected_email:
+ heading: About your application
+ message: Your application to sell on %{store_name} has not been accepted.
+ subject: Your application to sell on %{store_name}
+ suspended_email:
+ heading: Your account has been suspended
+ message: Selling on %{store_name} has been paused for your account. Your products and order history are unaffected.
+ subject: Your %{store_name} account has been suspended
+ seller_membership_required: This account does not belong to any seller.
send_consumer_transactional_emails: Send Customer Transactional Emails
seo: SEO
seo_title: SEO Title
@@ -1685,25 +1704,6 @@ en:
value: Value
variant: Variant
variants: Variants
- vendor: Vendor
- vendor_access_denied: You do not have access to this vendor.
- vendor_mailer:
- approved_email:
- action: Go to your dashboard
- heading: You're approved
- message: Your application to sell on %{store_name} has been approved. You can now list products and start taking orders.
- subject: You're approved to sell on %{store_name}
- get_in_touch: If you think this is a mistake, reply to this email or contact us at %{store_email}.
- greeting: Hi %{vendor_name},
- rejected_email:
- heading: About your application
- message: Your application to sell on %{store_name} has not been accepted.
- subject: Your application to sell on %{store_name}
- suspended_email:
- heading: Your account has been suspended
- message: Selling on %{store_name} has been paused for your account. Your products and order history are unaffected.
- subject: Your %{store_name} account has been suspended
- vendor_membership_required: This account does not belong to any vendor.
verified: Verified
verified_at: Verified at
version: Version
diff --git a/spree/core/db/migrate/20250410061306_create_spree_invitations.rb b/spree/core/db/migrate/20250410061306_create_spree_invitations.rb
index bb4a6d408b..6245245fe4 100644
--- a/spree/core/db/migrate/20250410061306_create_spree_invitations.rb
+++ b/spree/core/db/migrate/20250410061306_create_spree_invitations.rb
@@ -5,7 +5,7 @@ class CreateSpreeInvitations < ActiveRecord::Migration[7.2]
t.string :token, index: { unique: true }, null: false
t.string :status, null: false, index: true
- t.references :resource, polymorphic: true, index: true, null: false # eg. Store, Vendor, Account
+ t.references :resource, polymorphic: true, index: true, null: false # eg. Store, Seller, Account
t.references :inviter, polymorphic: true, index: true, null: false
t.references :invitee, polymorphic: true, index: true
t.references :role, null: false
diff --git a/spree/core/db/migrate/20260815000002_add_resource_to_spree_roles.rb b/spree/core/db/migrate/20260815000002_add_resource_to_spree_roles.rb
index 48e6efbbde..3192c73cab 100644
--- a/spree/core/db/migrate/20260815000002_add_resource_to_spree_roles.rb
+++ b/spree/core/db/migrate/20260815000002_add_resource_to_spree_roles.rb
@@ -1,6 +1,6 @@
class AddResourceToSpreeRoles < ActiveRecord::Migration[8.1]
# A role now names what it governs: a Spree::Store for back-office staff, a
- # Spree::Vendor for a marketplace seller. That one fact replaces two — roles
+ # Spree::Seller for a marketplace seller. That one fact replaces two — roles
# were global, so nothing said which store owned a definition, and nothing
# said which panel a role belonged to.
#
diff --git a/spree/core/db/migrate/20260816000001_create_spree_vendors.rb b/spree/core/db/migrate/20260816000001_create_spree_sellers.rb
similarity index 58%
rename from spree/core/db/migrate/20260816000001_create_spree_vendors.rb
rename to spree/core/db/migrate/20260816000001_create_spree_sellers.rb
index 8c862f0601..47a5ee34af 100644
--- a/spree/core/db/migrate/20260816000001_create_spree_vendors.rb
+++ b/spree/core/db/migrate/20260816000001_create_spree_sellers.rb
@@ -1,6 +1,6 @@
-class CreateSpreeVendors < ActiveRecord::Migration[8.1]
+class CreateSpreeSellers < ActiveRecord::Migration[8.1]
def change
- create_table :spree_vendors do |t|
+ create_table :spree_sellers do |t|
t.references :store, null: false
t.string :name, null: false
t.string :slug, null: false
@@ -11,20 +11,20 @@ class CreateSpreeVendors < ActiveRecord::Migration[8.1]
t.references :billing_address
t.references :returns_address
- # Vendor acceptance of the store's seller terms — the timestamp is the
+ # Seller acceptance of the store's seller terms — the timestamp is the
# record of it, so onboarding can ask again when the terms change.
t.datetime :terms_accepted_at
- # Set while the vendor is away: their catalog stays but stops selling.
+ # Set while the seller is away: their catalog stays but stops selling.
t.datetime :holiday_mode_until
# Settlement configuration. Both nil mean "use the store's default", so
- # a vendor only carries a value once it deviates.
+ # a seller only carries a value once it deviates.
t.string :payouts_schedule_interval
t.decimal :minimum_payout_amount, precision: 10, scale: 2
- # Who remits consumer tax on this vendor's sales — 'vendor' (they are
+ # Who remits consumer tax on this seller's sales — 'seller' (they are
# merchant of record) or 'platform' (marketplace-facilitator rules).
- t.string :tax_remittance, null: false, default: 'vendor'
+ t.string :tax_remittance, null: false, default: 'seller'
if t.respond_to?(:jsonb)
t.jsonb :metadata
@@ -36,23 +36,23 @@ class CreateSpreeVendors < ActiveRecord::Migration[8.1]
t.datetime :deleted_at
end
- add_index :spree_vendors, [:store_id, :slug], unique: true
- add_index :spree_vendors, [:store_id, :status]
- add_index :spree_vendors, :deleted_at
+ add_index :spree_sellers, [:store_id, :slug], unique: true
+ add_index :spree_sellers, [:store_id, :status]
+ add_index :spree_sellers, :deleted_at
# Mobility table-backend translations, mirroring spree_collection_translations.
- create_table :spree_vendor_translations do |t|
+ create_table :spree_seller_translations do |t|
t.string :name
t.text :about
t.string :locale, null: false
- t.references :spree_vendor, null: false, index: false
+ t.references :spree_seller, null: false, index: false
t.timestamps null: false
t.datetime :deleted_at
end
- add_index :spree_vendor_translations, :locale, name: 'index_spree_vendor_translations_on_locale'
- add_index :spree_vendor_translations, [:spree_vendor_id, :locale], unique: true,
- name: 'index_vendor_translations_on_vendor_and_locale'
+ add_index :spree_seller_translations, :locale, name: 'index_spree_seller_translations_on_locale'
+ add_index :spree_seller_translations, [:spree_seller_id, :locale], unique: true,
+ name: 'index_seller_translations_on_seller_and_locale'
end
end
diff --git a/spree/core/db/migrate/20260816000002_add_vendor_to_spree_products.rb b/spree/core/db/migrate/20260816000002_add_seller_to_spree_products.rb
similarity index 58%
rename from spree/core/db/migrate/20260816000002_add_vendor_to_spree_products.rb
rename to spree/core/db/migrate/20260816000002_add_seller_to_spree_products.rb
index 157eda1a50..c5c789b591 100644
--- a/spree/core/db/migrate/20260816000002_add_vendor_to_spree_products.rb
+++ b/spree/core/db/migrate/20260816000002_add_seller_to_spree_products.rb
@@ -1,10 +1,10 @@
-class AddVendorToSpreeProducts < ActiveRecord::Migration[8.1]
+class AddSellerToSpreeProducts < ActiveRecord::Migration[8.1]
# Which seller owns this product. Nil is the operator's own first-party
# catalog, which is every product on a store that sells nothing but its own.
#
- # Replaces the guarded Spree::VendorConcern hook the Enterprise module used
+ # Replaces the guarded Spree::SellerConcern hook the Enterprise module used
# to fill: the marketplace is core now, so the column is too.
def change
- add_reference :spree_products, :vendor, index: true
+ add_reference :spree_products, :seller, index: true
end
end
diff --git a/spree/core/db/migrate/20260816210001_create_spree_commission_rates.rb b/spree/core/db/migrate/20260816210001_create_spree_commission_rates.rb
index b602c66da6..278e881598 100644
--- a/spree/core/db/migrate/20260816210001_create_spree_commission_rates.rb
+++ b/spree/core/db/migrate/20260816210001_create_spree_commission_rates.rb
@@ -12,7 +12,7 @@ class CreateSpreeCommissionRates < ActiveRecord::Migration[8.1]
t.boolean :enabled, null: false, default: true
# Resolution order: the list is walked top-down and the first matching
# rate wins, so what an operator sees in the table IS the precedence.
- # Seeds arrive product-before-category-before-vendor, which is the
+ # Seeds arrive product-before-category-before-seller, which is the
# conventional ladder; reordering is dragging a row.
t.integer :position, null: false, default: 0
@@ -26,7 +26,7 @@ class CreateSpreeCommissionRates < ActiveRecord::Migration[8.1]
# Commission base: net (ex-VAT) item price by default, which is the EU
# rule — the fee is a separate supply from the consumer's item sale.
t.boolean :tax_inclusive, null: false, default: false
- # Also commission the vendor order's delivery revenue.
+ # Also commission the seller order's delivery revenue.
t.boolean :include_shipping, null: false, default: false
# Overrides the tax provider's answer for VAT on the commission. Null
diff --git a/spree/core/db/migrate/20260816210002_create_spree_commission_lines.rb b/spree/core/db/migrate/20260816210002_create_spree_commission_lines.rb
index 396e755e6a..e5a23c3f48 100644
--- a/spree/core/db/migrate/20260816210002_create_spree_commission_lines.rb
+++ b/spree/core/db/migrate/20260816210002_create_spree_commission_lines.rb
@@ -2,7 +2,7 @@ class CreateSpreeCommissionLines < ActiveRecord::Migration[8.1]
def change
create_table :spree_commission_lines do |t|
t.references :order, null: false
- t.references :vendor, null: false
+ t.references :seller, null: false
# Exactly one of these two: the commissioned item, or the commissioned
# delivery when the rate carries include_shipping. Their indexes are
# declared below, unique.
@@ -55,7 +55,7 @@ class CreateSpreeCommissionLines < ActiveRecord::Migration[8.1]
name: 'chk_spree_commission_lines_one_subject'
end
- add_index :spree_commission_lines, [:vendor_id, :created_at]
+ add_index :spree_commission_lines, [:seller_id, :created_at]
# Reporting asks "what did we charge, where, and how was it treated" —
# the same questions Spree::TaxLine indexes for.
add_index :spree_commission_lines, :taxability_reason
diff --git a/spree/core/db/migrate/20260817000001_add_vendor_to_spree_line_items.rb b/spree/core/db/migrate/20260817000001_add_seller_to_spree_line_items.rb
similarity index 74%
rename from spree/core/db/migrate/20260817000001_add_vendor_to_spree_line_items.rb
rename to spree/core/db/migrate/20260817000001_add_seller_to_spree_line_items.rb
index 440c9c474b..a7bb5f4cda 100644
--- a/spree/core/db/migrate/20260817000001_add_vendor_to_spree_line_items.rb
+++ b/spree/core/db/migrate/20260817000001_add_seller_to_spree_line_items.rb
@@ -1,15 +1,15 @@
-class AddVendorToSpreeLineItems < ActiveRecord::Migration[8.1]
+class AddSellerToSpreeLineItems < ActiveRecord::Migration[8.1]
# Which seller this line was bought from, snapshotted at the moment it was
# added. Nil is the operator's own first-party item.
#
# Denormalized on purpose rather than walked through the variant on read:
- # the order split partitions on it, vendor order lists and ability scoping
+ # the order split partitions on it, seller order lists and ability scoping
# filter on it, and once a product can be sold by several sellers the
# *product* can no longer answer which one a customer actually bought from.
#
# Snapshotting also keeps a placed order truthful — a seller's catalog can
# change hands afterwards, and the line still records who sold it.
def change
- add_reference :spree_line_items, :vendor, index: true
+ add_reference :spree_line_items, :seller, index: true
end
end
diff --git a/spree/core/lib/spree/core.rb b/spree/core/lib/spree/core.rb
index c396ad49a4..d15d160494 100644
--- a/spree/core/lib/spree/core.rb
+++ b/spree/core/lib/spree/core.rb
@@ -472,7 +472,7 @@ module Spree
# `/tags` autocomplete endpoint to validate `taggable_type`. Apps extend
# the list in an initializer:
#
- # Spree.taggable_types << 'MyApp::Vendor'
+ # Spree.taggable_types << 'MyApp::Seller'
def self.taggable_types
Rails.application.config.spree.taggable_types
end
@@ -584,7 +584,7 @@ module Spree
Rails.application.config.spree.admin_authentication_strategies = value
end
- # Registry of authentication strategy classes for the Vendor API.
+ # Registry of authentication strategy classes for the Seller API.
#
# Login policy is per surface, not per principal: marketplace sellers and the
# store's own staff are both Spree.admin_user_class, so a store that requires
@@ -592,16 +592,16 @@ module Spree
# registry's :email strategy in place.
#
# @return [Spree::Authentication::StrategyRegistry]
- # @example Registering an SSO strategy for vendor users
- # Spree.vendor_authentication_strategies.add(:okta, MyApp::Auth::OktaStrategy)
- def self.vendor_authentication_strategies
- Rails.application.config.spree.vendor_authentication_strategies
+ # @example Registering an SSO strategy for seller users
+ # Spree.seller_authentication_strategies.add(:okta, MyApp::Auth::OktaStrategy)
+ def self.seller_authentication_strategies
+ Rails.application.config.spree.seller_authentication_strategies
end
- # @param value [Spree::Authentication::StrategyRegistry] the registry to use for Vendor API authentication dispatch
+ # @param value [Spree::Authentication::StrategyRegistry] the registry to use for Seller API authentication dispatch
# @return [Spree::Authentication::StrategyRegistry] the assigned registry
- def self.vendor_authentication_strategies=(value)
- Rails.application.config.spree.vendor_authentication_strategies = value
+ def self.seller_authentication_strategies=(value)
+ Rails.application.config.spree.seller_authentication_strategies = value
end
def self.analytics
@@ -645,9 +645,9 @@ module Spree
# associations, and scopes across Spree models.
#
# @example Adding custom searchable fields
- # Spree.ransack.add_attribute(Spree::Product, :vendor_id)
- # Spree.ransack.add_scope(Spree::Product, :by_vendor)
- # Spree.ransack.add_association(Spree::Product, :vendor)
+ # Spree.ransack.add_attribute(Spree::Product, :seller_id)
+ # Spree.ransack.add_scope(Spree::Product, :by_seller)
+ # Spree.ransack.add_association(Spree::Product, :seller)
#
# @return [Spree::RansackConfiguration] the ransack configuration instance
def self.ransack
diff --git a/spree/core/lib/spree/core/dependencies.rb b/spree/core/lib/spree/core/dependencies.rb
index 44610f9428..e65ba1d4d4 100644
--- a/spree/core/lib/spree/core/dependencies.rb
+++ b/spree/core/lib/spree/core/dependencies.rb
@@ -104,11 +104,11 @@ module Spree
claim_deny_workflow: 'Spree::Claims::Deny',
claim_cancel_workflow: 'Spree::Claims::Cancel',
- # vendors
- vendor_invite_workflow: 'Spree::Vendors::Invite',
- vendor_approve_workflow: 'Spree::Vendors::Approve',
- vendor_suspend_workflow: 'Spree::Vendors::Suspend',
- vendor_reject_workflow: 'Spree::Vendors::Reject',
+ # sellers
+ seller_invite_workflow: 'Spree::Sellers::Invite',
+ seller_approve_workflow: 'Spree::Sellers::Approve',
+ seller_suspend_workflow: 'Spree::Sellers::Suspend',
+ seller_reject_workflow: 'Spree::Sellers::Reject',
# commissions — what a marketplace charges its sellers. Swappable
# because the pricing of a marketplace's own service is exactly the
diff --git a/spree/core/lib/spree/core/engine.rb b/spree/core/lib/spree/core/engine.rb
index 6fac615a09..f89398751f 100644
--- a/spree/core/lib/spree/core/engine.rb
+++ b/spree/core/lib/spree/core/engine.rb
@@ -46,7 +46,7 @@ module Spree
:subscribers,
:store_authentication_strategies,
:admin_authentication_strategies,
- :vendor_authentication_strategies)
+ :seller_authentication_strategies)
SpreeCalculators = Struct.new(:shipping_methods, :tax_rates, :promotion_actions_create_adjustments, :promotion_actions_create_item_adjustments)
PromoEnvironment = Struct.new(:rules, :actions)
PricingEnvironment = Struct.new(:rules)
@@ -292,9 +292,9 @@ module Spree
Spree::OrderRouting::Rules::DefaultLocation
]
- # Commission targeting rule kinds (docs/plans/6.0-multi-vendor-marketplace.md).
+ # Commission targeting rule kinds (docs/plans/6.0-multi-seller-marketplace.md).
Rails.application.config.spree.commission_rules.concat [
- Spree::CommissionRules::VendorRule,
+ Spree::CommissionRules::SellerRule,
Spree::CommissionRules::CategoryRule,
Spree::CommissionRules::ProductRule,
Spree::CommissionRules::ItemTotalRule
@@ -412,7 +412,7 @@ module Spree
Spree::Category,
Spree::Store,
Spree::Policy,
- Spree::Vendor
+ Spree::Seller
]
# Resources that expose tags via `acts_as_taggable_on :tags`. The
@@ -420,7 +420,7 @@ module Spree
# `taggable_type`, and the SPA `<TagCombobox>` targets them by name.
# Extend in an app initializer (after :load_config_initializers) to
# surface custom taggables — e.g.
- # Rails.application.config.spree.taggable_types << 'MyApp::Vendor'.
+ # Rails.application.config.spree.taggable_types << 'MyApp::Seller'.
Rails.application.config.spree.taggable_types = [
'Spree::Product',
'Spree::Order',
@@ -467,7 +467,7 @@ module Spree
Spree::TaxRate,
Spree::Category,
Spree::Variant,
- Spree::Vendor,
+ Spree::Seller,
Spree.customer_class
]
@@ -527,7 +527,7 @@ module Spree
Rails.application.config.spree.admin_authentication_strategies = Spree::Authentication::StrategyRegistry.new(
email: Spree::Authentication::Strategies::EmailPasswordStrategy
)
- Rails.application.config.spree.vendor_authentication_strategies = Spree::Authentication::StrategyRegistry.new(
+ Rails.application.config.spree.seller_authentication_strategies = Spree::Authentication::StrategyRegistry.new(
email: Spree::Authentication::Strategies::EmailPasswordStrategy
)
end
diff --git a/spree/core/lib/spree/core/permission_configuration.rb b/spree/core/lib/spree/core/permission_configuration.rb
index 816dd77260..792443c4e5 100644
--- a/spree/core/lib/spree/core/permission_configuration.rb
+++ b/spree/core/lib/spree/core/permission_configuration.rb
@@ -21,7 +21,7 @@ module Spree
WRITE_PREFIX = 'write_'.freeze
# A role's audience is its owning resource, lowercased — a role on a
- # `Spree::Store` is `:store`, one on a `Spree::Vendor` is `:vendor` (see
+ # `Spree::Store` is `:store`, one on a `Spree::Seller` is `:seller` (see
# `Spree::Role#audience`).
#
# The store's own back office is the baseline: every resource is grantable
@@ -102,7 +102,7 @@ module Spree
# @param subjects [Proc, Array] CanCanCan subjects the keys grant
# @param write [Boolean]
# @param audiences [Array<Symbol>] the audiences beyond staff whose roles
- # may hold these keys (`%i[vendor]`). Empty by default — opening a
+ # may hold these keys (`%i[seller]`). Empty by default — opening a
# resource to another audience exposes it to a principal outside the
# store's own staff, so it is a deliberate act. Never open `settings`,
# `staff` or `api_keys`.
@@ -171,7 +171,7 @@ module Spree
# nothing, so a panel that does not exist yet reads as granting nothing
# rather than raising.
#
- # @param audience [Symbol, String] `:store`, `:vendor`, …
+ # @param audience [Symbol, String] `:store`, `:seller`, …
# @return [Array<Resource>] in registration order
def grantable_resources(audience)
resources.select { |resource| resource.grantable_to?(audience) }
@@ -277,20 +277,20 @@ module Spree
# are lambdas so model classes resolve at activation, not load, time.
# rubocop:disable Metrics/MethodLength
def register_default_resources
- register_resource(:orders, group: :orders, audiences: %i[vendor], subjects: -> {
+ register_resource(:orders, group: :orders, audiences: %i[seller], subjects: -> {
[Spree::Order, Spree::LineItem, Spree::TaxLine, Spree::Discount, Spree::Fee,
Spree::Return, Spree::Exchange, Spree::Claim, Spree::TaxIdentifier,
Spree::CustomField]
})
register_resource(:payments, group: :orders, subjects: -> { [Spree::Payment] })
- register_resource(:fulfillments, group: :orders, audiences: %i[vendor], subjects: -> { [Spree::Fulfillment] })
+ register_resource(:fulfillments, group: :orders, audiences: %i[seller], subjects: -> { [Spree::Fulfillment] })
register_resource(:refunds, group: :orders, subjects: -> { [Spree::Refund] })
register_resource(:gift_cards, group: :orders, subjects: -> {
[Spree::GiftCard, Spree::GiftCardBatch]
})
register_resource(:store_credits, group: :orders, subjects: -> { [Spree::StoreCredit] })
- register_resource(:products, group: :catalog, audiences: %i[vendor], subjects: -> {
+ register_resource(:products, group: :catalog, audiences: %i[seller], subjects: -> {
[Spree::Product, Spree::ProductType, Spree::Variant, Spree::OptionType,
Spree::OptionValue, Spree::Price, Spree::PriceList, Spree::PriceRule,
Spree::Asset, Spree::ProductPublication, Spree::CustomField]
@@ -301,7 +301,7 @@ module Spree
register_resource(:collections, group: :catalog, subjects: -> {
[Spree::Collection, Spree::ProductCollection, Spree::CollectionRule]
})
- register_resource(:stock, group: :catalog, audiences: %i[vendor], subjects: -> {
+ register_resource(:stock, group: :catalog, audiences: %i[seller], subjects: -> {
[Spree::StockItem, Spree::StockLocation, Spree::StockMovement,
Spree::StockTransfer, Spree::StockReservation]
})
@@ -338,13 +338,13 @@ module Spree
})
# Running the marketplace: admitting sellers, approving them, suspending
- # them. Deliberately not opened to the vendor audience — a seller
+ # them. Deliberately not opened to the seller audience — a seller
# administering other sellers is the one thing this key must not allow.
- register_resource(:vendors, group: :access, subjects: -> { [Spree::Vendor] })
+ register_resource(:sellers, group: :access, subjects: -> { [Spree::Seller] })
# What the marketplace charges its sellers. Its own resource rather than
- # part of `settings`, and closed to the vendor audience for the same
- # reason `vendors` is: a seller must never be able to read, let alone
+ # part of `settings`, and closed to the seller audience for the same
+ # reason `sellers` is: a seller must never be able to read, let alone
# set, what anyone is charged.
register_resource(:commissions, group: :access, subjects: -> {
[Spree::CommissionRate, Spree::CommissionRule, Spree::CommissionLine]
@@ -353,19 +353,19 @@ module Spree
# A seller editing their own record: profile, branding, addresses,
# onboarding.
#
- # A symbol subject, not `Spree::Vendor`: that class belongs to `vendors`
+ # A symbol subject, not `Spree::Seller`: that class belongs to `sellers`
# above — the operator's key — and claiming it twice would make
# `resource_for_subject` answer by registration order, besides letting a
- # seller's key manage vendor records generally. A symbol grants a real
+ # seller's key manage seller records generally. A symbol grants a real
# `can` rule (so `authorize!` on the seller branch resolves) while
# staying invisible to `resource_for_subject`, which matches Classes
- # only. Which vendor they may touch is still `current_vendor`
+ # only. Which seller they may touch is still `current_seller`
# scope-fetching, never an ability rule.
- register_resource(:vendor_profile, group: :access, subjects: -> { [:vendor_profile] },
- audiences: %i[vendor])
+ register_resource(:seller_profile, group: :access, subjects: -> { [:seller_profile] },
+ audiences: %i[seller])
register_resource(:dashboard, group: :analytics, subjects: -> { [:dashboard] },
- write: false, audiences: %i[vendor])
+ write: false, audiences: %i[seller])
end
# rubocop:enable Metrics/MethodLength
end
diff --git a/spree/core/lib/spree/core/ransack_configuration.rb b/spree/core/lib/spree/core/ransack_configuration.rb
index 86c368e26c..37d1b453df 100644
--- a/spree/core/lib/spree/core/ransack_configuration.rb
+++ b/spree/core/lib/spree/core/ransack_configuration.rb
@@ -5,9 +5,9 @@ module Spree
# configurations without using decorators.
#
# @example Adding custom searchable fields
- # Spree.ransack.add_attribute(Spree::Product, :vendor_id)
- # Spree.ransack.add_scope(Spree::Product, :by_vendor)
- # Spree.ransack.add_association(Spree::Product, :vendor)
+ # Spree.ransack.add_attribute(Spree::Product, :seller_id)
+ # Spree.ransack.add_scope(Spree::Product, :by_seller)
+ # Spree.ransack.add_association(Spree::Product, :seller)
#
class RansackConfiguration
def initialize
diff --git a/spree/core/lib/spree/testing_support/factories/commission_rate_factory.rb b/spree/core/lib/spree/testing_support/factories/commission_rate_factory.rb
index 160992ef25..56d369fc32 100644
--- a/spree/core/lib/spree/testing_support/factories/commission_rate_factory.rb
+++ b/spree/core/lib/spree/testing_support/factories/commission_rate_factory.rb
@@ -30,12 +30,12 @@ FactoryBot.define do
# Reference lists go through the preference writers, so ids are
# scope-checked in specs exactly as they are through the API.
- factory :commission_vendor_rule, class: Spree::CommissionRules::VendorRule do
+ factory :commission_seller_rule, class: Spree::CommissionRules::SellerRule do
commission_rate { create(:commission_rate) }
- transient { vendors { [] } }
+ transient { sellers { [] } }
after(:build) do |rule, evaluator|
- rule.preferred_vendor_ids = Array(evaluator.vendors).map(&:id) if evaluator.vendors.present?
+ rule.preferred_seller_ids = Array(evaluator.sellers).map(&:id) if evaluator.sellers.present?
end
end
@@ -63,7 +63,7 @@ FactoryBot.define do
factory :commission_line, class: Spree::CommissionLine do
order { create(:order) }
- vendor { create(:vendor) }
+ seller { create(:seller) }
line_item { create(:line_item) }
kind { 'percentage' }
rate { 10 }
diff --git a/spree/core/lib/spree/testing_support/factories/vendor_factory.rb b/spree/core/lib/spree/testing_support/factories/seller_factory.rb
similarity index 81%
rename from spree/core/lib/spree/testing_support/factories/vendor_factory.rb
rename to spree/core/lib/spree/testing_support/factories/seller_factory.rb
index 1ba879f094..dba6336802 100644
--- a/spree/core/lib/spree/testing_support/factories/vendor_factory.rb
+++ b/spree/core/lib/spree/testing_support/factories/seller_factory.rb
@@ -1,6 +1,6 @@
FactoryBot.define do
- factory :vendor, class: Spree::Vendor do
- sequence(:name) { |n| "Vendor #{n}" }
+ factory :seller, class: Spree::Seller do
+ sequence(:name) { |n| "Seller #{n}" }
store { Spree::Store.default || create(:store) }
status { 'pending' }
@@ -23,8 +23,8 @@ FactoryBot.define do
end
trait :with_logo do
- after(:create) do |vendor|
- vendor.logo.attach(
+ after(:create) do |seller|
+ seller.logo.attach(
io: File.new(Spree::Core::Engine.root.join('spec', 'fixtures', 'thinking-cat.jpg')),
filename: 'thinking-cat.jpg'
)
diff --git a/spree/core/spec/fixtures/files/products_import.csv b/spree/core/spec/fixtures/files/products_import.csv
index 6aa7e7c2b3..10f47c58c4 100644
--- a/spree/core/spec/fixtures/files/products_import.csv
+++ b/spree/core/spec/fixtures/files/products_import.csv
@@ -1,4 +1,4 @@
-slug,sku,name,status,vendor_name,brand_name,description,meta_title,meta_description,meta_keywords,tags,labels,price,compare_at_price,currency,width,height,depth,dimensions_unit,weight,weight_unit,available_on,discontinue_on,track_inventory,inventory_count,inventory_backorderable,tax_category,digital,image1_src,image2_src,image3_src,option1_name,option1_value,option2_name,option2_value,option3_name,option3_value,category1,category2,category3,custom_field.properties.fit,custom_field.properties.manufacturer,custom_field.properties.material,custom_field.custom.brand,custom_field.custom.material
+slug,sku,name,status,seller_name,brand_name,description,meta_title,meta_description,meta_keywords,tags,labels,price,compare_at_price,currency,width,height,depth,dimensions_unit,weight,weight_unit,available_on,discontinue_on,track_inventory,inventory_count,inventory_backorderable,tax_category,digital,image1_src,image2_src,image3_src,option1_name,option1_value,option2_name,option2_value,option3_name,option3_value,category1,category2,category3,custom_field.properties.fit,custom_field.properties.manufacturer,custom_field.properties.material,custom_field.custom.brand,custom_field.custom.material
denim-shirt,"",Denim Shirt,draft,,,Adipisci sapiente velit nihil ullam. Placeat cumque ipsa cupiditate velit magni sapiente mollitia dolorum. Veritatis esse illo eos perferendis. Perspiciatis vel iusto odio eveniet quam officia quidem. Fugiat a ipsum tempore optio accusantium autem in fugit.,,,,"","",0.0,0.0,USD,,,,,0.0,lb,2025-10-09 14:35:53,,true,100,true,Default,false,,,,,,,,,,Men -> Shirts,Women,Sportswear,Lose,Wannabe,90% Cotton 10% Elastan,,
denim-shirt,DENIM-SHIRT-XS-BLUE,,,,,,,,,,,62.99,0.0,USD,,,,,0.0,lb,2025-10-09 14:35:53,,true,100,true,Clothing,false,,,,Color,Blue,Size,XS,,,,,
denim-shirt,DENIM-SHIRT-S-BLUE,,,,,,,,,,,62.99,0.0,USD,,,,,0.0,lb,2025-10-09 14:35:53,,true,100,true,Clothing,false,,,,Color,Blue,Size,S,,,,,
diff --git a/spree/core/spec/lib/spree/core/permission_configuration_spec.rb b/spree/core/spec/lib/spree/core/permission_configuration_spec.rb
index d649a1c2fd..9c2a281969 100644
--- a/spree/core/spec/lib/spree/core/permission_configuration_spec.rb
+++ b/spree/core/spec/lib/spree/core/permission_configuration_spec.rb
@@ -54,27 +54,27 @@ RSpec.describe Spree::PermissionConfiguration do
end
it 'grants a resource to the audiences it names, store included' do
- configuration.register_resource(:reviews, group: :catalog, audiences: %i[vendor], subjects: [Spree::Product])
+ configuration.register_resource(:reviews, group: :catalog, audiences: %i[seller], subjects: [Spree::Product])
- expect(configuration.resource(:reviews).audiences).to contain_exactly(:store, :vendor)
+ expect(configuration.resource(:reviews).audiences).to contain_exactly(:store, :seller)
end
it 'withholds unnamed audiences' do
configuration.register_resource(:reviews, group: :catalog, subjects: [Spree::Product])
- expect(configuration.resource(:reviews)).not_to be_grantable_to(:vendor)
- expect(configuration.grantable_keys(:vendor)).not_to include('read_reviews')
+ expect(configuration.resource(:reviews)).not_to be_grantable_to(:seller)
+ expect(configuration.grantable_keys(:seller)).not_to include('read_reviews')
end
- it 'opens the seller-facing core resources to vendors' do
- expect(configuration.grantable_keys(:vendor)).to include(
+ it 'opens the seller-facing core resources to sellers' do
+ expect(configuration.grantable_keys(:seller)).to include(
'read_products', 'write_products', 'read_orders', 'write_orders',
'read_fulfillments', 'write_fulfillments', 'read_stock', 'write_stock', 'read_dashboard'
)
end
- it 'never opens the operator-only resources to vendors' do
- expect(configuration.grantable_keys(:vendor)).not_to include(
+ it 'never opens the operator-only resources to sellers' do
+ expect(configuration.grantable_keys(:seller)).not_to include(
'read_settings', 'write_settings', 'read_staff', 'write_staff',
'read_api_keys', 'write_api_keys', 'read_payments', 'read_refunds'
)
@@ -211,32 +211,32 @@ RSpec.describe Spree::PermissionConfiguration do
end
end
- describe 'vendor_profile' do
+ describe 'seller_profile' do
let(:store) { @default_store }
- let(:vendor) { create(:vendor, store: store) }
+ let(:seller) { create(:seller, store: store) }
let(:user) { create(:admin_user) }
let(:seller_ability) do
- role = create(:role, name: 'seller', resource: vendor, permissions: %w[write_vendor_profile])
+ role = create(:role, name: 'seller', resource: seller, permissions: %w[write_seller_profile])
create(:role_user, role: role, user: user)
- Spree::Ability.new(user, resource: vendor)
+ Spree::Ability.new(user, resource: seller)
end
# A key that grants no subject silently authorizes nothing: `authorize!` on
# the seller branch would fail closed with the permission apparently held.
it 'grants a real ability rule' do
- expect(seller_ability).to be_can(:manage, :vendor_profile)
+ expect(seller_ability).to be_can(:manage, :seller_profile)
end
# The subject is a symbol so it cannot be confused with the operator's
- # `vendors` key, which owns the Spree::Vendor class.
- it 'does not let a seller manage vendor records' do
- expect(seller_ability).not_to be_can(:manage, vendor)
+ # `sellers` key, which owns the Spree::Seller class.
+ it 'does not let a seller manage seller records' do
+ expect(seller_ability).not_to be_can(:manage, seller)
end
- it 'leaves Spree::Vendor mapped to the operator resource' do
- expect(Spree.permissions.resource_for_subject(Spree::Vendor).name).to eq(:vendors)
+ it 'leaves Spree::Seller mapped to the operator resource' do
+ expect(Spree.permissions.resource_for_subject(Spree::Seller).name).to eq(:sellers)
end
end
end
diff --git a/spree/core/spec/lib/spree/core/ransack_configuration_spec.rb b/spree/core/spec/lib/spree/core/ransack_configuration_spec.rb
index 43874f1ba4..40f59f9571 100644
--- a/spree/core/spec/lib/spree/core/ransack_configuration_spec.rb
+++ b/spree/core/spec/lib/spree/core/ransack_configuration_spec.rb
@@ -5,73 +5,73 @@ RSpec.describe Spree::RansackConfiguration do
describe '#add_attribute' do
it 'adds an attribute to a model' do
- config.add_attribute(Spree::Product, :vendor_id)
+ config.add_attribute(Spree::Product, :seller_id)
- expect(config.custom_attributes_for(Spree::Product)).to contain_exactly('vendor_id')
+ expect(config.custom_attributes_for(Spree::Product)).to contain_exactly('seller_id')
end
it 'adds to existing attributes when called multiple times' do
- config.add_attribute(Spree::Product, :vendor_id)
+ config.add_attribute(Spree::Product, :seller_id)
config.add_attribute(Spree::Product, :brand_name)
- expect(config.custom_attributes_for(Spree::Product)).to contain_exactly('vendor_id', 'brand_name')
+ expect(config.custom_attributes_for(Spree::Product)).to contain_exactly('seller_id', 'brand_name')
end
it 'does not duplicate attributes' do
- config.add_attribute(Spree::Product, :vendor_id)
- config.add_attribute(Spree::Product, :vendor_id)
+ config.add_attribute(Spree::Product, :seller_id)
+ config.add_attribute(Spree::Product, :seller_id)
- expect(config.custom_attributes_for(Spree::Product)).to contain_exactly('vendor_id')
+ expect(config.custom_attributes_for(Spree::Product)).to contain_exactly('seller_id')
end
it 'converts symbol to string' do
- config.add_attribute(Spree::Product, :vendor_id)
+ config.add_attribute(Spree::Product, :seller_id)
- expect(config.custom_attributes_for(Spree::Product)).to eq(['vendor_id'])
+ expect(config.custom_attributes_for(Spree::Product)).to eq(['seller_id'])
end
end
describe '#add_association' do
it 'adds an association to a model' do
- config.add_association(Spree::Product, :vendor)
+ config.add_association(Spree::Product, :seller)
- expect(config.custom_associations_for(Spree::Product)).to contain_exactly('vendor')
+ expect(config.custom_associations_for(Spree::Product)).to contain_exactly('seller')
end
it 'adds to existing associations when called multiple times' do
- config.add_association(Spree::Product, :vendor)
+ config.add_association(Spree::Product, :seller)
config.add_association(Spree::Product, :brand)
- expect(config.custom_associations_for(Spree::Product)).to contain_exactly('vendor', 'brand')
+ expect(config.custom_associations_for(Spree::Product)).to contain_exactly('seller', 'brand')
end
it 'does not duplicate associations' do
- config.add_association(Spree::Product, :vendor)
- config.add_association(Spree::Product, :vendor)
+ config.add_association(Spree::Product, :seller)
+ config.add_association(Spree::Product, :seller)
- expect(config.custom_associations_for(Spree::Product)).to contain_exactly('vendor')
+ expect(config.custom_associations_for(Spree::Product)).to contain_exactly('seller')
end
end
describe '#add_scope' do
it 'adds a scope to a model' do
- config.add_scope(Spree::Product, :by_vendor)
+ config.add_scope(Spree::Product, :by_seller)
- expect(config.custom_scopes_for(Spree::Product)).to contain_exactly('by_vendor')
+ expect(config.custom_scopes_for(Spree::Product)).to contain_exactly('by_seller')
end
it 'adds to existing scopes when called multiple times' do
- config.add_scope(Spree::Product, :by_vendor)
+ config.add_scope(Spree::Product, :by_seller)
config.add_scope(Spree::Product, :featured)
- expect(config.custom_scopes_for(Spree::Product)).to contain_exactly('by_vendor', 'featured')
+ expect(config.custom_scopes_for(Spree::Product)).to contain_exactly('by_seller', 'featured')
end
it 'does not duplicate scopes' do
- config.add_scope(Spree::Product, :by_vendor)
- config.add_scope(Spree::Product, :by_vendor)
+ config.add_scope(Spree::Product, :by_seller)
+ config.add_scope(Spree::Product, :by_seller)
- expect(config.custom_scopes_for(Spree::Product)).to contain_exactly('by_vendor')
+ expect(config.custom_scopes_for(Spree::Product)).to contain_exactly('by_seller')
end
end
@@ -95,9 +95,9 @@ RSpec.describe Spree::RansackConfiguration do
describe '#reset!' do
it 'clears all custom configurations' do
- config.add_attribute(Spree::Product, :vendor_id)
+ config.add_attribute(Spree::Product, :seller_id)
config.add_scope(Spree::Order, :by_region)
- config.add_association(Spree::Variant, :vendor)
+ config.add_association(Spree::Variant, :seller)
config.reset!
diff --git a/spree/core/spec/models/spree/ability_spec.rb b/spree/core/spec/models/spree/ability_spec.rb
index 3283ecb92b..af4ccf0273 100644
--- a/spree/core/spec/models/spree/ability_spec.rb
+++ b/spree/core/spec/models/spree/ability_spec.rb
@@ -191,7 +191,7 @@ describe Spree::Ability, type: :model do
end
end
- # A non-store resource stands in for a marketplace vendor until the Vendor
+ # A non-store resource stands in for a marketplace seller until the Seller
# model lands: what matters is that the role is owned by something other
# than the store, on the store's own turf.
context 'with a role held on a non-store resource' do
@@ -199,7 +199,7 @@ describe Spree::Ability, type: :model do
before do
# Open orders to the stand-in's audience, as the catalog opens it to
- # marketplace vendors.
+ # marketplace sellers.
Spree.permissions.register_resource(
:orders, group: :orders, audiences: %i[customer_group], subjects: -> { [Spree::Order] }
)
@@ -286,12 +286,12 @@ describe Spree::Ability, type: :model do
end
end
- # A marketplace vendor's staff hold roles owned by the vendor. Store-admin
- # authority must come only from the store's own roles, or a vendor picker
- # would inherit the whole store — including, for an `admin`-named vendor
+ # A marketplace seller's staff hold roles owned by the seller. Store-admin
+ # authority must come only from the store's own roles, or a seller picker
+ # would inherit the whole store — including, for an `admin`-named seller
# role, full access.
context 'with an assignment scoped to a non-store resource' do
- let(:vendor_like) { Spree::DummyModel.create!(name: 'Vendor A') }
+ let(:seller_like) { Spree::DummyModel.create!(name: 'Seller A') }
before do
Spree.permissions.register_resource(
@@ -303,7 +303,7 @@ describe Spree::Ability, type: :model do
it 'grants nothing in the store admin' do
admin.role_users.create!(
- role: create(:role, name: 'vendor_catalog', permissions: %w[write_products], resource: vendor_like)
+ role: create(:role, name: 'seller_catalog', permissions: %w[write_products], resource: seller_like)
)
expect(staff_ability).not_to be_able_to :manage, store.products.new
@@ -312,7 +312,7 @@ describe Spree::Ability, type: :model do
end
it 'does not confer full access through an admin-named role' do
- admin.role_users.create!(role: Spree::Role.default_admin_role(vendor_like))
+ admin.role_users.create!(role: Spree::Role.default_admin_role(seller_like))
expect(staff_ability).not_to be_able_to :manage, :all
expect(staff_ability.permission_keys).to eq([])
diff --git a/spree/core/spec/models/spree/commission_line_spec.rb b/spree/core/spec/models/spree/commission_line_spec.rb
index 1cbfebfa85..384c5078c7 100644
--- a/spree/core/spec/models/spree/commission_line_spec.rb
+++ b/spree/core/spec/models/spree/commission_line_spec.rb
@@ -3,29 +3,29 @@ require 'spec_helper'
RSpec.describe Spree::CommissionLine, type: :model do
let(:store) { @default_store }
let(:order) { create(:order, store: store) }
- let(:vendor) { create(:vendor, :approved, store: store) }
+ let(:seller) { create(:seller, :approved, store: store) }
let(:line_item) { create(:line_item, order: order) }
let(:fulfillment) { create(:fulfillment, order: order) }
describe 'what it is charged against' do
it 'accepts an item' do
- expect(build(:commission_line, order: order, vendor: vendor, line_item: line_item)).to be_valid
+ expect(build(:commission_line, order: order, seller: seller, line_item: line_item)).to be_valid
end
it 'accepts a delivery' do
expect(
- build(:commission_line, order: order, vendor: vendor, line_item: nil, fulfillment: fulfillment)
+ build(:commission_line, order: order, seller: seller, line_item: nil, fulfillment: fulfillment)
).to be_valid
end
it 'refuses both at once' do
expect(
- build(:commission_line, order: order, vendor: vendor, line_item: line_item, fulfillment: fulfillment)
+ build(:commission_line, order: order, seller: seller, line_item: line_item, fulfillment: fulfillment)
).not_to be_valid
end
it 'refuses neither' do
- expect(build(:commission_line, order: order, vendor: vendor, line_item: nil)).not_to be_valid
+ expect(build(:commission_line, order: order, seller: seller, line_item: nil)).not_to be_valid
end
end
@@ -33,7 +33,7 @@ RSpec.describe Spree::CommissionLine, type: :model do
# because a marketplace still has to explain a charge it already made.
it 'outlives the rate it was calculated from' do
rate = create(:commission_rate, store: store)
- line = create(:commission_line, order: order, vendor: vendor, line_item: line_item, commission_rate: rate)
+ line = create(:commission_line, order: order, seller: seller, line_item: line_item, commission_rate: rate)
rate.destroy
diff --git a/spree/core/spec/models/spree/commission_rate_spec.rb b/spree/core/spec/models/spree/commission_rate_spec.rb
index 5fadb82b02..bd301d5b2a 100644
--- a/spree/core/spec/models/spree/commission_rate_spec.rb
+++ b/spree/core/spec/models/spree/commission_rate_spec.rb
@@ -168,8 +168,8 @@ RSpec.describe Spree::CommissionRate, type: :model do
end
describe '#matches?' do
- let(:vendor) { create(:vendor, store: store) }
- let(:other_vendor) { create(:vendor, store: store) }
+ let(:seller) { create(:seller, store: store) }
+ let(:other_seller) { create(:seller, store: store) }
let(:cameras) { create(:category, store: store) }
let(:audio) { create(:category, store: store) }
let(:product) { create(:product, store: store) }
@@ -178,7 +178,7 @@ RSpec.describe Spree::CommissionRate, type: :model do
def context(categories: [cameras])
Spree::Commissions::Context.new(
- vendor: vendor, order: order, line_item: line_item, categories: categories
+ seller: seller, order: order, line_item: line_item, categories: categories
)
end
@@ -188,14 +188,14 @@ RSpec.describe Spree::CommissionRate, type: :model do
it 'matches a rule naming the seller' do
rate = create(:commission_rate, store: store)
- create(:commission_vendor_rule, commission_rate: rate, vendors: [vendor])
+ create(:commission_seller_rule, commission_rate: rate, sellers: [seller])
expect(rate.reload.matches?(context)).to be true
end
it 'does not match a rule naming someone else' do
rate = create(:commission_rate, store: store)
- create(:commission_vendor_rule, commission_rate: rate, vendors: [other_vendor])
+ create(:commission_seller_rule, commission_rate: rate, sellers: [other_seller])
expect(rate.reload.matches?(context)).to be false
end
@@ -213,7 +213,7 @@ RSpec.describe Spree::CommissionRate, type: :model do
# this category" — the pairing a marketplace actually sells.
it 'requires every rule to agree' do
rate = create(:commission_rate, store: store)
- create(:commission_vendor_rule, commission_rate: rate, vendors: [vendor])
+ create(:commission_seller_rule, commission_rate: rate, sellers: [seller])
create(:commission_category_rule, commission_rate: rate, categories: [audio])
expect(rate.reload.matches?(context)).to be false
@@ -221,7 +221,7 @@ RSpec.describe Spree::CommissionRate, type: :model do
it 'matches a seller-and-category pairing when both hold' do
rate = create(:commission_rate, store: store)
- create(:commission_vendor_rule, commission_rate: rate, vendors: [vendor])
+ create(:commission_seller_rule, commission_rate: rate, sellers: [seller])
create(:commission_category_rule, commission_rate: rate, categories: [cameras])
expect(rate.reload.matches?(context)).to be true
@@ -231,7 +231,7 @@ RSpec.describe Spree::CommissionRate, type: :model do
# be read as "every seller" — that would charge sales nobody targeted.
it 'does not match a rule that names nobody' do
rate = create(:commission_rate, store: store)
- create(:commission_vendor_rule, commission_rate: rate)
+ create(:commission_seller_rule, commission_rate: rate)
expect(rate.reload.matches?(context)).to be false
end
@@ -277,12 +277,12 @@ RSpec.describe Spree::CommissionRate, type: :model do
end
describe '#rules=' do
- let(:vendor) { create(:vendor, store: store) }
+ let(:seller) { create(:seller, store: store) }
let(:category) { create(:category, store: store) }
it 'replaces the rate targeting wholesale' do
rate = create(:commission_rate, store: store)
- create(:commission_vendor_rule, commission_rate: rate, vendors: [vendor])
+ create(:commission_seller_rule, commission_rate: rate, sellers: [seller])
rate.update!(rules: [{ type: 'category_rule', preferences: { category_ids: [category.id] } }])
@@ -295,19 +295,19 @@ RSpec.describe Spree::CommissionRate, type: :model do
# second one beside it.
it 'edits the rule of a kind the rate already carries' do
rate = create(:commission_rate, store: store)
- first_vendor = create(:vendor, store: store)
- second_vendor = create(:vendor, store: store)
- rate.update!(rules: [{ type: 'vendor_rule', preferences: { vendor_ids: [first_vendor.id] } }])
+ first_seller = create(:seller, store: store)
+ second_seller = create(:seller, store: store)
+ rate.update!(rules: [{ type: 'seller_rule', preferences: { seller_ids: [first_seller.id] } }])
- rate.update!(rules: [{ type: 'vendor_rule', preferences: { vendor_ids: [second_vendor.id] } }])
+ rate.update!(rules: [{ type: 'seller_rule', preferences: { seller_ids: [second_seller.id] } }])
expect(rate.reload.commission_rules.count).to eq(1)
- expect(rate.commission_rules.first.preferred_vendor_ids.map(&:to_s)).to eq([second_vendor.id.to_s])
+ expect(rate.commission_rules.first.preferred_seller_ids.map(&:to_s)).to eq([second_seller.id.to_s])
end
it 'clears the targeting when given nothing' do
rate = create(:commission_rate, store: store)
- create(:commission_vendor_rule, commission_rate: rate, vendors: [vendor])
+ create(:commission_seller_rule, commission_rate: rate, sellers: [seller])
rate.update!(rules: [])
@@ -319,18 +319,18 @@ RSpec.describe Spree::CommissionRate, type: :model do
# having the id silently dropped.
it 'refuses a record belonging to another marketplace' do
rate = create(:commission_rate, store: store)
- foreign_vendor = create(:vendor, store: create(:store))
+ foreign_seller = create(:seller, store: create(:store))
expect {
- rate.update!(rules: [{ type: 'vendor_rule', preferences: { vendor_ids: [foreign_vendor.id] } }])
+ rate.update!(rules: [{ type: 'seller_rule', preferences: { seller_ids: [foreign_seller.id] } }])
}.to raise_error(ActiveRecord::RecordNotFound)
end
it 'builds rules on a rate that does not exist yet' do
rate = create(:commission_rate, store: store,
- rules: [{ type: 'vendor_rule', preferences: { vendor_ids: [vendor.id] } }])
+ rules: [{ type: 'seller_rule', preferences: { seller_ids: [seller.id] } }])
- expect(rate.reload.commission_rules.map(&:class)).to eq([Spree::CommissionRules::VendorRule])
+ expect(rate.reload.commission_rules.map(&:class)).to eq([Spree::CommissionRules::SellerRule])
end
end
@@ -377,20 +377,20 @@ RSpec.describe Spree::CommissionRate, type: :model do
# A rate is paranoid, so `destroy` is a soft delete — and cascading from one
# would take rules that cannot be restored with it.
describe 'retiring a rate' do
- let(:vendor) { create(:vendor, store: store) }
+ let(:seller) { create(:seller, store: store) }
# Retired, not deleted: a commission line is explained by the rule that
# matched it, so the conditions have to stay readable after the rate stops
# applying to anything.
it 'retires its rules with it rather than deleting them' do
rate = create(:commission_rate, store: store)
- create(:commission_vendor_rule, commission_rate: rate, vendors: [vendor])
+ create(:commission_seller_rule, commission_rate: rate, sellers: [seller])
rate.destroy
expect(Spree::CommissionRule.where(commission_rate_id: rate.id)).to be_empty
retired = Spree::CommissionRule.with_deleted.find_by(commission_rate_id: rate.id)
- expect(retired.preferred_vendor_ids.map(&:to_s)).to eq([vendor.id.to_s])
+ expect(retired.preferred_seller_ids.map(&:to_s)).to eq([seller.id.to_s])
end
# "Which rate charged this" has to stay answerable after the rate is
@@ -398,7 +398,7 @@ RSpec.describe Spree::CommissionRate, type: :model do
it 'leaves the lines it already charged pointing at it' do
rate = create(:commission_rate, store: store)
order = create(:order, store: store)
- line = create(:commission_line, order: order, vendor: vendor,
+ line = create(:commission_line, order: order, seller: seller,
line_item: create(:line_item, order: order), commission_rate: rate)
rate.destroy
@@ -414,7 +414,7 @@ RSpec.describe Spree::CommissionRate, type: :model do
it 'is false once it carries a rule' do
rate = create(:commission_rate, store: store)
- create(:commission_vendor_rule, commission_rate: rate, vendors: [create(:vendor, store: store)])
+ create(:commission_seller_rule, commission_rate: rate, sellers: [create(:seller, store: store)])
expect(rate.reload).not_to be_global
end
diff --git a/spree/core/spec/models/spree/commission_rules/product_rule_spec.rb b/spree/core/spec/models/spree/commission_rules/product_rule_spec.rb
index b03fed9685..72b1bba637 100644
--- a/spree/core/spec/models/spree/commission_rules/product_rule_spec.rb
+++ b/spree/core/spec/models/spree/commission_rules/product_rule_spec.rb
@@ -33,7 +33,7 @@ RSpec.describe Spree::CommissionRules::ProductRule do
rule.save!
context = Spree::Commissions::Context.new(
- vendor: create(:vendor, :approved, store: store),
+ seller: create(:seller, :approved, store: store),
order: create(:order, store: store),
line_item: create(:line_item, variant: product.default_variant)
)
diff --git a/spree/core/spec/models/spree/concerns/ransackable_attributes_spec.rb b/spree/core/spec/models/spree/concerns/ransackable_attributes_spec.rb
index d259bc4f5e..fd24e6c844 100644
--- a/spree/core/spec/models/spree/concerns/ransackable_attributes_spec.rb
+++ b/spree/core/spec/models/spree/concerns/ransackable_attributes_spec.rb
@@ -15,9 +15,9 @@ RSpec.describe Spree::RansackableAttributes do
end
it 'merges custom attributes from Spree.ransack' do
- Spree.ransack.add_attribute(Spree::Product, :vendor_id)
+ Spree.ransack.add_attribute(Spree::Product, :seller_id)
- expect(Spree::Product.ransackable_attributes).to include('vendor_id')
+ expect(Spree::Product.ransackable_attributes).to include('seller_id')
end
it 'does not duplicate attributes' do
@@ -33,9 +33,9 @@ RSpec.describe Spree::RansackableAttributes do
end
it 'merges custom associations from Spree.ransack' do
- Spree.ransack.add_association(Spree::Product, :vendor)
+ Spree.ransack.add_association(Spree::Product, :seller)
- expect(Spree::Product.ransackable_associations).to include('vendor')
+ expect(Spree::Product.ransackable_associations).to include('seller')
end
it 'does not duplicate associations' do
@@ -51,9 +51,9 @@ RSpec.describe Spree::RansackableAttributes do
end
it 'merges custom scopes from Spree.ransack' do
- Spree.ransack.add_scope(Spree::Product, :by_vendor)
+ Spree.ransack.add_scope(Spree::Product, :by_seller)
- expect(Spree::Product.ransackable_scopes).to include('by_vendor')
+ expect(Spree::Product.ransackable_scopes).to include('by_seller')
end
it 'does not duplicate scopes' do
diff --git a/spree/core/spec/models/spree/exports/orders_spec.rb b/spree/core/spec/models/spree/exports/orders_spec.rb
index 1acc114fbb..e1ad716bb2 100644
--- a/spree/core/spec/models/spree/exports/orders_spec.rb
+++ b/spree/core/spec/models/spree/exports/orders_spec.rb
@@ -34,7 +34,7 @@ RSpec.describe Spree::Exports::Orders, type: :model do
'Item Total Price',
'Item requires shipping',
'Item taxbale',
- 'Item Vendor',
+ 'Item Seller',
'Category lvl0',
'Category lvl1',
'Category lvl2',
@@ -104,7 +104,7 @@ RSpec.describe Spree::Exports::Orders, type: :model do
'Item Total Price',
'Item requires shipping',
'Item taxbale',
- 'Item Vendor',
+ 'Item Seller',
'Category lvl0',
'Category lvl1',
'Category lvl2',
diff --git a/spree/core/spec/models/spree/exports/products_spec.rb b/spree/core/spec/models/spree/exports/products_spec.rb
index af0605ce64..2749d800ce 100644
--- a/spree/core/spec/models/spree/exports/products_spec.rb
+++ b/spree/core/spec/models/spree/exports/products_spec.rb
@@ -34,7 +34,7 @@ RSpec.describe Spree::Exports::Products, type: :model do
'name',
'slug',
'status',
- 'vendor_name',
+ 'seller_name',
'description',
'meta_title',
'meta_description',
@@ -84,7 +84,7 @@ RSpec.describe Spree::Exports::Products, type: :model do
'name',
'slug',
'status',
- 'vendor_name',
+ 'seller_name',
'description',
'meta_title',
'meta_description',
diff --git a/spree/core/spec/models/spree/import_spec.rb b/spree/core/spec/models/spree/import_spec.rb
index d2d294b873..99aa0d2892 100644
--- a/spree/core/spec/models/spree/import_spec.rb
+++ b/spree/core/spec/models/spree/import_spec.rb
@@ -147,7 +147,7 @@ RSpec.describe Spree::Import, :job, type: :model do
'sku',
'name',
'status',
- 'vendor_name',
+ 'seller_name',
'brand_name',
'description',
'meta_title',
@@ -311,7 +311,7 @@ RSpec.describe Spree::Import, :job, type: :model do
end
it 'returns columns that are not mapped' do
- expect(import.unmapped_file_columns).to include('vendor_name', 'brand_name', 'labels', 'custom_field.properties.fit', 'custom_field.properties.manufacturer', 'custom_field.properties.material')
+ expect(import.unmapped_file_columns).to include('seller_name', 'brand_name', 'labels', 'custom_field.properties.fit', 'custom_field.properties.manufacturer', 'custom_field.properties.material')
expect(import.unmapped_file_columns).not_to include('slug')
end
end
diff --git a/spree/core/spec/models/spree/line_item_spec.rb b/spree/core/spec/models/spree/line_item_spec.rb
index d2142d3f2f..56f573caea 100644
--- a/spree/core/spec/models/spree/line_item_spec.rb
+++ b/spree/core/spec/models/spree/line_item_spec.rb
@@ -857,17 +857,17 @@ describe Spree::LineItem, type: :model do
end
end
- describe 'vendor' do
+ describe 'seller' do
let(:store) { @default_store }
- let(:vendor) { create(:vendor, store: store, name: 'Sparks Audio') }
+ let(:seller) { create(:seller, store: store, name: 'Sparks Audio') }
let(:cart) { create(:cart, store: store) }
it "snapshots the seller from the line's product" do
- product = create(:product, store: store, vendor: vendor)
+ product = create(:product, store: store, seller: seller)
line_item = create(:line_item, cart: cart, variant: product.default_variant, quantity: 1)
- expect(line_item.reload.vendor).to eq(vendor)
+ expect(line_item.reload.seller).to eq(seller)
end
# Nil is the operator's own catalog, which is every line on a store that
@@ -877,17 +877,17 @@ describe Spree::LineItem, type: :model do
line_item = create(:line_item, cart: cart, variant: product.default_variant, quantity: 1)
- expect(line_item.reload.vendor_id).to be_nil
+ expect(line_item.reload.seller_id).to be_nil
end
it 'follows the product while the line is still in a cart' do
product = create(:product, store: store)
line_item = create(:line_item, cart: cart, variant: product.default_variant, quantity: 1)
- product.update!(vendor: vendor)
+ product.update!(seller: seller)
line_item.reload.update!(quantity: 2)
- expect(line_item.reload.vendor).to eq(vendor)
+ expect(line_item.reload.seller).to eq(seller)
end
# An admin draft is persisted but not placed, so its lines keep following
@@ -897,10 +897,10 @@ describe Spree::LineItem, type: :model do
product = create(:product, store: store)
line_item = create(:line_item, order: draft, variant: product.default_variant, quantity: 1)
- product.update!(vendor: vendor)
+ product.update!(seller: seller)
line_item.reload.update!(quantity: 2)
- expect(line_item.reload.vendor).to eq(vendor)
+ expect(line_item.reload.seller).to eq(seller)
end
# A placed order records who sold each line. The catalog changing hands
@@ -910,21 +910,21 @@ describe Spree::LineItem, type: :model do
it 'keeps the seller it was bought from' do
line_item = order.line_items.first
- line_item.update_columns(vendor_id: vendor.id)
- line_item.variant.product.update!(vendor: create(:vendor, store: store))
+ line_item.update_columns(seller_id: seller.id)
+ line_item.variant.product.update!(seller: create(:seller, store: store))
line_item.reload.update!(quantity: 3)
- expect(line_item.reload.vendor).to eq(vendor)
+ expect(line_item.reload.seller).to eq(seller)
end
it 'keeps a first-party line first-party' do
line_item = order.line_items.first
- line_item.variant.product.update!(vendor: vendor)
+ line_item.variant.product.update!(seller: seller)
line_item.reload.update!(quantity: 2)
- expect(line_item.reload.vendor_id).to be_nil
+ expect(line_item.reload.seller_id).to be_nil
end
end
end
diff --git a/spree/core/spec/models/spree/report_line_items/products_performance_spec.rb b/spree/core/spec/models/spree/report_line_items/products_performance_spec.rb
index b963e9ffaa..84300ef054 100644
--- a/spree/core/spec/models/spree/report_line_items/products_performance_spec.rb
+++ b/spree/core/spec/models/spree/report_line_items/products_performance_spec.rb
@@ -12,9 +12,9 @@ RSpec.describe Spree::ReportLineItems::ProductsPerformance do
subject { report.line_items.first }
- describe '#vendor' do
- it 'returns vendor name from record' do
- expect(subject.vendor).to eq(variant.try(:vendor_name))
+ describe '#seller' do
+ it 'returns seller name from record' do
+ expect(subject.seller).to eq(variant.try(:seller_name))
end
end
diff --git a/spree/core/spec/models/spree/role_spec.rb b/spree/core/spec/models/spree/role_spec.rb
index 5dc7964152..55a967d805 100644
--- a/spree/core/spec/models/spree/role_spec.rb
+++ b/spree/core/spec/models/spree/role_spec.rb
@@ -3,9 +3,9 @@ require 'spec_helper'
describe Spree::Role do
let(:role) { create(:role) }
let(:user) { create(:user) }
- # A non-store resource stands in for a marketplace vendor until that model
+ # A non-store resource stands in for a marketplace seller until that model
# lands: what matters is that the role is owned by something else.
- let(:vendor_like) { create(:customer_group) }
+ let(:seller_like) { create(:customer_group) }
describe 'with users' do
before do
@@ -28,7 +28,7 @@ describe Spree::Role do
# Names are unique per owner, so another resource may legitimately call a
# role "admin" — it must never be mistaken for the store super-role.
it 'ignores a same-named role owned by something else' do
- foreign_admin = create(:role, name: 'admin', resource: vendor_like)
+ foreign_admin = create(:role, name: 'admin', resource: seller_like)
admin_role = Spree::Role.default_admin_role(@default_store)
@@ -80,8 +80,8 @@ describe Spree::Role do
it 'reads its audience from the owning resource' do
expect(build(:role).audience).to eq(:store)
expect(build(:role)).to be_staff
- expect(build(:role, resource: vendor_like).audience).to eq(:customer_group)
- expect(build(:role, resource: vendor_like)).not_to be_staff
+ expect(build(:role, resource: seller_like).audience).to eq(:customer_group)
+ expect(build(:role, resource: seller_like)).not_to be_staff
end
it 'is required' do
@@ -99,23 +99,23 @@ describe Spree::Role do
it 'allows the same name under a different owner' do
create(:role, name: 'Manager', resource: @default_store)
- expect(build(:role, name: 'Manager', resource: vendor_like)).to be_valid
+ expect(build(:role, name: 'Manager', resource: seller_like)).to be_valid
expect(build(:role, name: 'Manager', resource: create(:store))).to be_valid
end
it 'still rejects a duplicate name under one owner' do
- create(:role, name: 'Manager', resource: vendor_like)
+ create(:role, name: 'Manager', resource: seller_like)
- expect(build(:role, name: 'Manager', resource: vendor_like)).not_to be_valid
+ expect(build(:role, name: 'Manager', resource: seller_like)).not_to be_valid
end
it 'scopes roles to their owner' do
staff_role = create(:role)
- other_role = create(:role, resource: vendor_like)
+ other_role = create(:role, resource: seller_like)
expect(Spree::Role.for_resource(@default_store)).to include(staff_role)
expect(Spree::Role.for_resource(@default_store)).not_to include(other_role)
- expect(Spree::Role.for_resource(vendor_like)).to eq([other_role])
+ expect(Spree::Role.for_resource(seller_like)).to eq([other_role])
end
end
@@ -129,11 +129,11 @@ describe Spree::Role do
after { Spree.permissions.reset! }
it 'allows a non-store role to hold keys its audience is granted' do
- expect(build(:role, resource: vendor_like, permissions: %w[write_products])).to be_valid
+ expect(build(:role, resource: seller_like, permissions: %w[write_products])).to be_valid
end
it 'refuses keys its audience is not granted' do
- role = build(:role, resource: vendor_like, permissions: %w[write_products write_settings])
+ role = build(:role, resource: seller_like, permissions: %w[write_products write_settings])
expect(role).not_to be_valid
expect(role.errors[:permissions].join).to include('write_settings')
@@ -168,7 +168,7 @@ describe Spree::Role do
# The protection is the store's super-role, not the name: another resource
# may call a role "admin" and it stays an ordinary, editable role.
it 'leaves a same-named role owned by something else editable' do
- foreign_admin = create(:role, name: 'admin', resource: vendor_like)
+ foreign_admin = create(:role, name: 'admin', resource: seller_like)
foreign_admin.name = 'renamed'
expect(foreign_admin).to be_mutable
diff --git a/spree/core/spec/models/spree/seller_spec.rb b/spree/core/spec/models/spree/seller_spec.rb
new file mode 100644
index 0000000000..2bd6b073f9
--- /dev/null
+++ b/spree/core/spec/models/spree/seller_spec.rb
@@ -0,0 +1,239 @@
+require 'spec_helper'
+
+describe Spree::Seller do
+ let(:store) { @default_store }
+
+ describe 'statuses' do
+ it 'starts pending and moves only through workflows' do
+ expect(described_class.default_status).to eq('pending')
+ expect(described_class.statuses).to include('approved', 'suspended', 'rejected')
+ # A state machine would have generated these; the absence is the point.
+ expect(described_class).not_to respond_to(:state_machines)
+ end
+
+ it 'generates a predicate and a scope per status' do
+ seller = create(:seller, :approved)
+
+ expect(seller).to be_approved
+ expect(seller).not_to be_pending
+ expect(described_class.approved).to include(seller)
+ end
+
+ it 'rejects an unknown status' do
+ expect(build(:seller, status: 'flourishing')).not_to be_valid
+ end
+ end
+
+ describe 'slug' do
+ it 'derives from the name when absent' do
+ expect(create(:seller, name: 'Bright Sparks Ltd').slug).to eq('bright-sparks-ltd')
+ end
+
+ it 'keeps an explicit slug' do
+ expect(create(:seller, name: 'Bright Sparks', slug: 'sparks').slug).to eq('sparks')
+ end
+
+ it 'is unique within a store' do
+ create(:seller, slug: 'sparks', store: store)
+
+ expect(build(:seller, slug: 'sparks', store: store)).not_to be_valid
+ end
+
+ it 'may repeat on another store' do
+ create(:seller, slug: 'sparks', store: store)
+
+ expect(build(:seller, slug: 'sparks', store: create(:store))).to be_valid
+ end
+ end
+
+ describe '#sellable?' do
+ it 'is true once approved' do
+ expect(create(:seller, :approved)).to be_sellable
+ end
+
+ it 'is false while unapproved' do
+ expect(create(:seller, :onboarding)).not_to be_sellable
+ end
+
+ # The catalog stays; what stops is selling.
+ it 'is false while on holiday' do
+ seller = create(:seller, :on_holiday)
+
+ expect(seller).to be_on_holiday
+ expect(seller).not_to be_sellable
+ expect(described_class.sellable).not_to include(seller)
+ end
+
+ it 'resumes once the holiday has passed' do
+ seller = create(:seller, :approved, holiday_mode_until: 1.day.ago)
+
+ expect(seller).not_to be_on_holiday
+ expect(described_class.sellable).to include(seller)
+ end
+ end
+
+ describe 'teams' do
+ let(:seller) { create(:seller, :approved) }
+ let(:staffer) { create(:admin_user, :without_admin_role) }
+
+ it 'owns its own roles, separate from the store' do
+ role = create(:role, name: 'Packer', resource: seller)
+
+ expect(seller.roles).to include(role)
+ expect(store.roles).not_to include(role)
+ end
+
+ it 'adds a user through a role it owns' do
+ seller.add_user(staffer, create(:role, name: 'Packer', resource: seller))
+
+ expect(seller.users).to include(staffer)
+ expect(staffer.sellers).to include(seller)
+ end
+
+ it 'refuses a role belonging to the store' do
+ store_role = create(:role, name: 'Packer', resource: store)
+
+ expect { seller.add_user(staffer, store_role) }.to raise_error(ArgumentError)
+ end
+
+ # Membership on a seller is not membership of the store's back office.
+ it 'does not make its team store staff' do
+ seller.add_user(staffer, create(:role, name: 'Packer', resource: seller))
+
+ expect(staffer.stores).not_to include(store)
+ expect(Spree::Ability.new(staffer, store: store).permission_keys).to be_empty
+ end
+
+ # The seller login refuses anyone this is false for, so a store's own staff
+ # cannot mint a seller token.
+ it 'marks its team as seller members' do
+ expect(staffer).not_to be_seller_member
+
+ seller.add_user(staffer, create(:role, name: 'Packer', resource: seller))
+
+ expect(staffer.reload).to be_seller_member
+ end
+
+ it 'does not mark store staff as seller members' do
+ store.add_user(staffer, create(:role, name: 'Support', resource: store))
+
+ expect(staffer.reload).not_to be_seller_member
+ end
+ end
+
+ describe 'products' do
+ # Every seller-scoped read is rooted in this association, so a seller from
+ # another store would put one store's catalog inside another store's seller.
+ it 'refuses a seller from another store' do
+ foreign = create(:seller, :approved, store: create(:store))
+
+ expect(build(:product, store: store, seller: foreign)).not_to be_valid
+ end
+
+ it 'accepts a seller from the same store' do
+ expect(build(:product, store: store, seller: create(:seller, :approved, store: store))).to be_valid
+ end
+
+ # A product's store is not frozen after create, so the pair can also be
+ # broken from the other side — by moving the product and leaving the
+ # seller behind.
+ it 'refuses moving to a store the seller does not belong to' do
+ product = create(:product, store: store, seller: create(:seller, :approved, store: store))
+
+ product.store = create(:store)
+
+ expect(product).not_to be_valid
+ expect(product.errors[:seller]).to be_present
+ end
+
+ it 'keeps them when the seller is destroyed' do
+ seller = create(:seller, :approved)
+ product = create(:product, store: store, seller: seller)
+
+ seller.destroy
+
+ expect(product.reload.seller_id).to be_nil
+ end
+ end
+
+ describe 'translations' do
+ it 'stores a translated name and about per locale' do
+ seller = create(:seller, name: 'Bright Sparks', about: '<p>We make lamps.</p>')
+
+ Mobility.with_locale(:fr) do
+ seller.update!(name: 'Étincelles', about: '<p>Nous fabriquons des lampes.</p>')
+ end
+
+ expect(seller.reload.name).to eq('Bright Sparks')
+ expect(Mobility.with_locale(:fr) { seller.reload.name }).to eq('Étincelles')
+ end
+
+ it 'is registered as a translatable resource' do
+ expect(Spree.translatable_resources).to include(described_class)
+ end
+ end
+
+ describe 'custom fields' do
+ # Including the concern is not enough — a resource the registry does not
+ # list has no way to define fields for it.
+ it 'is registered as a custom-field resource' do
+ expect(Spree.custom_fields.enabled_resources).to include(described_class)
+ end
+ end
+
+ describe 'settlement configuration' do
+ it 'defaults to the seller remitting its own tax' do
+ expect(create(:seller).tax_remittance).to eq('seller')
+ end
+
+ it 'rejects an unknown remittance or interval' do
+ expect(build(:seller, tax_remittance: 'someone_else')).not_to be_valid
+ expect(build(:seller, payouts_schedule_interval: 'fortnightly')).not_to be_valid
+ end
+
+ # Nil means "use the store's default", so it stays valid.
+ it 'allows both to be unset' do
+ expect(build(:seller, payouts_schedule_interval: nil, minimum_payout_amount: nil)).to be_valid
+ end
+ end
+
+ describe 'addresses' do
+ let(:seller) { create(:seller) }
+
+ it 'writes an address from nested attributes' do
+ seller.update!(billing_address: { first_name: 'Ada', last_name: 'Lovelace',
+ address1: '1 Seller Way', city: 'London',
+ postal_code: 'EC1A 1BB', country_code: 'GB', phone: '555' })
+
+ expect(seller.reload.billing_address.address1).to eq('1 Seller Way')
+ end
+
+ # A seller is paranoid, so destroy is a soft delete. Taking the addresses
+ # with it would hard-delete rows a restored seller still points at.
+ it 'keeps its addresses when soft-deleted, and finds them again on restore' do
+ seller.update!(billing_address: create(:address))
+ address_id = seller.billing_address_id
+
+ seller.destroy
+
+ expect(Spree::Address.exists?(address_id)).to be(true)
+ seller.restore
+ expect(seller.reload.billing_address_id).to eq(address_id)
+ end
+ end
+
+ describe 'deletion' do
+ let(:seller) { create(:seller) }
+
+ # A role refuses deletion while anyone holds it. That guard is for deleting
+ # a role on its own; when the whole seller goes, its team goes with it.
+ it 'takes its team with it, so an invited seller stays deletable' do
+ Spree::Sellers::Invite.call(seller: seller, email: '[email protected]',
+ inviter: create(:admin_user))
+
+ expect(seller.destroy).to be_truthy
+ expect(Spree::Role.where(resource: seller)).to be_empty
+ expect(Spree::Invitation.where(resource: seller)).to be_empty
+ end
+ end
+end
diff --git a/spree/core/spec/models/spree/stock_transfer_spec.rb b/spree/core/spec/models/spree/stock_transfer_spec.rb
index 5c58008167..3d04e28f24 100644
--- a/spree/core/spec/models/spree/stock_transfer_spec.rb
+++ b/spree/core/spec/models/spree/stock_transfer_spec.rb
@@ -95,7 +95,7 @@ module Spree
)
end
- it 'receives new inventory (from a vendor)' do
+ it 'receives new inventory (from a seller)' do
subject
expect(destination_location.count_on_hand(variant)).to eq 5
diff --git a/spree/core/spec/models/spree/vendor_spec.rb b/spree/core/spec/models/spree/vendor_spec.rb
deleted file mode 100644
index 92f65cca2d..0000000000
--- a/spree/core/spec/models/spree/vendor_spec.rb
+++ /dev/null
@@ -1,239 +0,0 @@
-require 'spec_helper'
-
-describe Spree::Vendor do
- let(:store) { @default_store }
-
- describe 'statuses' do
- it 'starts pending and moves only through workflows' do
- expect(described_class.default_status).to eq('pending')
- expect(described_class.statuses).to include('approved', 'suspended', 'rejected')
- # A state machine would have generated these; the absence is the point.
- expect(described_class).not_to respond_to(:state_machines)
- end
-
- it 'generates a predicate and a scope per status' do
- vendor = create(:vendor, :approved)
-
- expect(vendor).to be_approved
- expect(vendor).not_to be_pending
- expect(described_class.approved).to include(vendor)
- end
-
- it 'rejects an unknown status' do
- expect(build(:vendor, status: 'flourishing')).not_to be_valid
- end
- end
-
- describe 'slug' do
- it 'derives from the name when absent' do
- expect(create(:vendor, name: 'Bright Sparks Ltd').slug).to eq('bright-sparks-ltd')
- end
-
- it 'keeps an explicit slug' do
- expect(create(:vendor, name: 'Bright Sparks', slug: 'sparks').slug).to eq('sparks')
- end
-
- it 'is unique within a store' do
- create(:vendor, slug: 'sparks', store: store)
-
- expect(build(:vendor, slug: 'sparks', store: store)).not_to be_valid
- end
-
- it 'may repeat on another store' do
- create(:vendor, slug: 'sparks', store: store)
-
- expect(build(:vendor, slug: 'sparks', store: create(:store))).to be_valid
- end
- end
-
- describe '#sellable?' do
- it 'is true once approved' do
- expect(create(:vendor, :approved)).to be_sellable
- end
-
- it 'is false while unapproved' do
- expect(create(:vendor, :onboarding)).not_to be_sellable
- end
-
- # The catalog stays; what stops is selling.
- it 'is false while on holiday' do
- vendor = create(:vendor, :on_holiday)
-
- expect(vendor).to be_on_holiday
- expect(vendor).not_to be_sellable
- expect(described_class.sellable).not_to include(vendor)
- end
-
- it 'resumes once the holiday has passed' do
- vendor = create(:vendor, :approved, holiday_mode_until: 1.day.ago)
-
- expect(vendor).not_to be_on_holiday
- expect(described_class.sellable).to include(vendor)
- end
- end
-
- describe 'teams' do
- let(:vendor) { create(:vendor, :approved) }
- let(:staffer) { create(:admin_user, :without_admin_role) }
-
- it 'owns its own roles, separate from the store' do
- role = create(:role, name: 'Packer', resource: vendor)
-
- expect(vendor.roles).to include(role)
- expect(store.roles).not_to include(role)
- end
-
- it 'adds a user through a role it owns' do
- vendor.add_user(staffer, create(:role, name: 'Packer', resource: vendor))
-
- expect(vendor.users).to include(staffer)
- expect(staffer.vendors).to include(vendor)
- end
-
- it 'refuses a role belonging to the store' do
- store_role = create(:role, name: 'Packer', resource: store)
-
- expect { vendor.add_user(staffer, store_role) }.to raise_error(ArgumentError)
- end
-
- # Membership on a vendor is not membership of the store's back office.
- it 'does not make its team store staff' do
- vendor.add_user(staffer, create(:role, name: 'Packer', resource: vendor))
-
- expect(staffer.stores).not_to include(store)
- expect(Spree::Ability.new(staffer, store: store).permission_keys).to be_empty
- end
-
- # The vendor login refuses anyone this is false for, so a store's own staff
- # cannot mint a vendor token.
- it 'marks its team as vendor members' do
- expect(staffer).not_to be_vendor_member
-
- vendor.add_user(staffer, create(:role, name: 'Packer', resource: vendor))
-
- expect(staffer.reload).to be_vendor_member
- end
-
- it 'does not mark store staff as vendor members' do
- store.add_user(staffer, create(:role, name: 'Support', resource: store))
-
- expect(staffer.reload).not_to be_vendor_member
- end
- end
-
- describe 'products' do
- # Every vendor-scoped read is rooted in this association, so a seller from
- # another store would put one store's catalog inside another store's vendor.
- it 'refuses a seller from another store' do
- foreign = create(:vendor, :approved, store: create(:store))
-
- expect(build(:product, store: store, vendor: foreign)).not_to be_valid
- end
-
- it 'accepts a seller from the same store' do
- expect(build(:product, store: store, vendor: create(:vendor, :approved, store: store))).to be_valid
- end
-
- # A product's store is not frozen after create, so the pair can also be
- # broken from the other side — by moving the product and leaving the
- # seller behind.
- it 'refuses moving to a store the seller does not belong to' do
- product = create(:product, store: store, vendor: create(:vendor, :approved, store: store))
-
- product.store = create(:store)
-
- expect(product).not_to be_valid
- expect(product.errors[:vendor]).to be_present
- end
-
- it 'keeps them when the vendor is destroyed' do
- vendor = create(:vendor, :approved)
- product = create(:product, store: store, vendor: vendor)
-
- vendor.destroy
-
- expect(product.reload.vendor_id).to be_nil
- end
- end
-
- describe 'translations' do
- it 'stores a translated name and about per locale' do
- vendor = create(:vendor, name: 'Bright Sparks', about: '<p>We make lamps.</p>')
-
- Mobility.with_locale(:fr) do
- vendor.update!(name: 'Étincelles', about: '<p>Nous fabriquons des lampes.</p>')
- end
-
- expect(vendor.reload.name).to eq('Bright Sparks')
- expect(Mobility.with_locale(:fr) { vendor.reload.name }).to eq('Étincelles')
- end
-
- it 'is registered as a translatable resource' do
- expect(Spree.translatable_resources).to include(described_class)
- end
- end
-
- describe 'custom fields' do
- # Including the concern is not enough — a resource the registry does not
- # list has no way to define fields for it.
- it 'is registered as a custom-field resource' do
- expect(Spree.custom_fields.enabled_resources).to include(described_class)
- end
- end
-
- describe 'settlement configuration' do
- it 'defaults to the vendor remitting its own tax' do
- expect(create(:vendor).tax_remittance).to eq('vendor')
- end
-
- it 'rejects an unknown remittance or interval' do
- expect(build(:vendor, tax_remittance: 'someone_else')).not_to be_valid
- expect(build(:vendor, payouts_schedule_interval: 'fortnightly')).not_to be_valid
- end
-
- # Nil means "use the store's default", so it stays valid.
- it 'allows both to be unset' do
- expect(build(:vendor, payouts_schedule_interval: nil, minimum_payout_amount: nil)).to be_valid
- end
- end
-
- describe 'addresses' do
- let(:vendor) { create(:vendor) }
-
- it 'writes an address from nested attributes' do
- vendor.update!(billing_address: { first_name: 'Ada', last_name: 'Lovelace',
- address1: '1 Vendor Way', city: 'London',
- postal_code: 'EC1A 1BB', country_code: 'GB', phone: '555' })
-
- expect(vendor.reload.billing_address.address1).to eq('1 Vendor Way')
- end
-
- # A vendor is paranoid, so destroy is a soft delete. Taking the addresses
- # with it would hard-delete rows a restored vendor still points at.
- it 'keeps its addresses when soft-deleted, and finds them again on restore' do
- vendor.update!(billing_address: create(:address))
- address_id = vendor.billing_address_id
-
- vendor.destroy
-
- expect(Spree::Address.exists?(address_id)).to be(true)
- vendor.restore
- expect(vendor.reload.billing_address_id).to eq(address_id)
- end
- end
-
- describe 'deletion' do
- let(:vendor) { create(:vendor) }
-
- # A role refuses deletion while anyone holds it. That guard is for deleting
- # a role on its own; when the whole vendor goes, its team goes with it.
- it 'takes its team with it, so an invited vendor stays deletable' do
- Spree::Vendors::Invite.call(vendor: vendor, email: '[email protected]',
- inviter: create(:admin_user))
-
- expect(vendor.destroy).to be_truthy
- expect(Spree::Role.where(resource: vendor)).to be_empty
- expect(Spree::Invitation.where(resource: vendor)).to be_empty
- end
- end
-end
diff --git a/spree/core/spec/presenters/spree/csv/product_variant_presenter_spec.rb b/spree/core/spec/presenters/spree/csv/product_variant_presenter_spec.rb
index 56f8ced318..7fa3e1cd42 100644
--- a/spree/core/spec/presenters/spree/csv/product_variant_presenter_spec.rb
+++ b/spree/core/spec/presenters/spree/csv/product_variant_presenter_spec.rb
@@ -21,7 +21,7 @@ RSpec.describe Spree::CSV::ProductVariantPresenter do
expect(subject[2]).to eq product.name
expect(subject[3]).to eq product.slug
expect(subject[4]).to eq product.status
- expect(subject[5]).to eq product.try(:vendor_name)
+ expect(subject[5]).to eq product.try(:seller_name)
expect(subject[6]).to eq product.description&.html_safe
expect(subject[7]).to eq product.meta_title
expect(subject[8]).to eq product.meta_description
@@ -71,7 +71,7 @@ RSpec.describe Spree::CSV::ProductVariantPresenter do
it 'returns nil for product-level fields' do
expect(subject[2]).to be_nil # name
expect(subject[4]).to be_nil # status
- expect(subject[5]).to be_nil # vendor_name
+ expect(subject[5]).to be_nil # seller_name
end
it 'returns variant specific fields' do
diff --git a/spree/core/spec/services/spree/commissions/calculate_line_spec.rb b/spree/core/spec/services/spree/commissions/calculate_line_spec.rb
index 05efa62793..6a2d6ee31e 100644
--- a/spree/core/spec/services/spree/commissions/calculate_line_spec.rb
+++ b/spree/core/spec/services/spree/commissions/calculate_line_spec.rb
@@ -4,14 +4,14 @@ RSpec.describe Spree::Commissions::CalculateLine do
subject(:calculate) { described_class }
let(:store) { @default_store }
- let(:vendor) { create(:vendor, :approved, store: store) }
+ let(:seller) { create(:seller, :approved, store: store) }
let(:order) { create(:order, store: store, currency: 'USD') }
let(:line_item) { create(:line_item, order: order, price: 100, quantity: 1) }
let(:rate) { create(:commission_rate, store: store, kind: 'percentage', value: 10) }
def call(**overrides)
calculate.call(
- { rate: rate, vendor: vendor, order: order, line_item: line_item,
+ { rate: rate, seller: seller, order: order, line_item: line_item,
commission_tax: Spree::CommissionTax.untaxed }.merge(overrides)
).value
end
@@ -209,12 +209,12 @@ RSpec.describe Spree::Commissions::CalculateLine do
end
it 'refuses to price nothing' do
- expect(calculate.call(rate: rate, vendor: vendor, order: order)).to be_failure
+ expect(calculate.call(rate: rate, seller: seller, order: order)).to be_failure
end
# Both would silently commission the item and drop the delivery.
it 'refuses to price an item and a delivery at once' do
- result = calculate.call(rate: rate, vendor: vendor, order: order,
+ result = calculate.call(rate: rate, seller: seller, order: order,
line_item: line_item, fulfillment: create(:fulfillment, order: order))
expect(result).to be_failure
diff --git a/spree/core/spec/services/spree/commissions/commission_order_spec.rb b/spree/core/spec/services/spree/commissions/commission_order_spec.rb
index 1422a4aa7f..ddb81e0fd6 100644
--- a/spree/core/spec/services/spree/commissions/commission_order_spec.rb
+++ b/spree/core/spec/services/spree/commissions/commission_order_spec.rb
@@ -2,14 +2,14 @@ require 'spec_helper'
RSpec.describe Spree::Commissions::CommissionOrder do
let(:store) { @default_store }
- let(:vendor) { create(:vendor, :approved, store: store) }
- let(:other_vendor) { create(:vendor, :approved, store: store) }
+ let(:seller) { create(:seller, :approved, store: store) }
+ let(:other_seller) { create(:seller, :approved, store: store) }
let(:order) { create(:order, store: store, currency: 'USD') }
let!(:rate) { create(:commission_rate, store: store, kind: 'percentage', value: 10) }
def line_for(seller, price: 100)
- product = create(:product, store: store, vendor: seller)
+ product = create(:product, store: store, seller: seller)
create(:line_item, order: order, variant: product.default_variant, price: price, quantity: 1)
end
@@ -18,12 +18,12 @@ RSpec.describe Spree::Commissions::CommissionOrder do
end
it 'charges the seller of each item sold' do
- line = line_for(vendor)
+ line = line_for(seller)
lines = commission
expect(lines.size).to eq(1)
- expect(lines.first).to have_attributes(vendor: vendor, line_item: line, amount: 10, order: order)
+ expect(lines.first).to have_attributes(seller: seller, line_item: line, amount: 10, order: order)
end
it 'leaves the marketplace own items alone' do
@@ -33,20 +33,20 @@ RSpec.describe Spree::Commissions::CommissionOrder do
end
it 'charges each seller on a mixed order separately' do
- line_for(vendor, price: 100)
- line_for(other_vendor, price: 50)
+ line_for(seller, price: 100)
+ line_for(other_seller, price: 50)
lines = commission
- expect(lines.map(&:vendor)).to match_array([vendor, other_vendor])
- expect(lines.find { |l| l.vendor == vendor }.amount).to eq(10)
- expect(lines.find { |l| l.vendor == other_vendor }.amount).to eq(5)
+ expect(lines.map(&:seller)).to match_array([seller, other_seller])
+ expect(lines.find { |l| l.seller == seller }.amount).to eq(10)
+ expect(lines.find { |l| l.seller == other_seller }.amount).to eq(5)
end
# A commission line is a settlement record: charging twice for one sale is
# the failure that matters most here.
it 'does not charge again for an order it already commissioned' do
- line_for(vendor)
+ line_for(seller)
commission
@@ -57,7 +57,7 @@ RSpec.describe Spree::Commissions::CommissionOrder do
# writing, and the loser reports the winner's lines rather than failing a
# checkout over work already done.
it 'reports the existing lines when another delivery got there first' do
- line_for(vendor)
+ line_for(seller)
# Stands in for the winner committing between this caller's guard and its
# own write — the index raises, and the loser has to recover from it
# rather than failing the checkout.
@@ -72,13 +72,13 @@ RSpec.describe Spree::Commissions::CommissionOrder do
it 'writes nothing when no rate matches the sale' do
rate.update!(enabled: false)
- line_for(vendor)
+ line_for(seller)
expect(commission).to be_empty
end
it 'never touches what the customer pays' do
- line_for(vendor)
+ line_for(seller)
total_before = order.reload.total
commission
@@ -100,37 +100,37 @@ RSpec.describe Spree::Commissions::CommissionOrder do
end
it 'charges the delivery when the rate includes shipping' do
- fulfillment_carrying(line_for(vendor))
+ fulfillment_carrying(line_for(seller))
delivery_line = commission.find(&:fulfillment_id)
expect(delivery_line.amount).to eq(2)
- expect(delivery_line.vendor).to eq(vendor)
+ expect(delivery_line.seller).to eq(seller)
end
it 'leaves delivery alone when the rate does not include shipping' do
rate.update!(include_shipping: false)
- fulfillment_carrying(line_for(vendor))
+ fulfillment_carrying(line_for(seller))
expect(commission.select(&:fulfillment_id)).to be_empty
end
it 'charges a delivery only to the seller whose goods it carries' do
- mine = line_for(vendor)
- theirs = line_for(other_vendor)
+ mine = line_for(seller)
+ theirs = line_for(other_seller)
fulfillment_carrying(mine)
fulfillment_carrying(theirs, cost: 0)
delivery_lines = commission.select(&:fulfillment_id)
- expect(delivery_lines.map(&:vendor)).to eq([vendor])
+ expect(delivery_lines.map(&:seller)).to eq([seller])
end
# Before the split, one delivery can carry two sellers' goods. It belongs
# to neither alone: billing both charges one parcel twice, and picking one
# bills the wrong seller.
it 'leaves a delivery shared between sellers uncommissioned' do
- fulfillment_carrying(line_for(vendor), line_for(other_vendor))
+ fulfillment_carrying(line_for(seller), line_for(other_seller))
lines = commission
@@ -139,7 +139,7 @@ RSpec.describe Spree::Commissions::CommissionOrder do
end
it 'charges nothing for a free delivery' do
- fulfillment_carrying(line_for(vendor), cost: 0)
+ fulfillment_carrying(line_for(seller), cost: 0)
expect(commission.select(&:fulfillment_id)).to be_empty
end
@@ -149,8 +149,8 @@ RSpec.describe Spree::Commissions::CommissionOrder do
# Each rate may carry its own tax override, so a basket governed by two
# rates must not have the first one's answer applied to both.
it 'taxes each line by the rate that governed it' do
- generic = line_for(vendor, price: 100)
- special_product = create(:product, store: store, vendor: vendor)
+ generic = line_for(seller, price: 100)
+ special_product = create(:product, store: store, seller: seller)
special_line = create(:line_item, order: order, variant: special_product.default_variant,
price: 100, quantity: 1)
@@ -168,8 +168,8 @@ RSpec.describe Spree::Commissions::CommissionOrder do
# The figure alone cannot justify itself on an invoice — the seller has to
# be able to see why their fee was taxed the way it was.
it 'records the treatment and jurisdiction on the line' do
- line_for(vendor)
- vendor.update!(billing_address: create(:address, country_iso: 'DE'))
+ line_for(seller)
+ seller.update!(billing_address: create(:address, country_iso: 'DE'))
allow_any_instance_of(Spree::TaxProvider::Internal).to receive(:service_tax_rate).and_return(0.19)
line = commission.first
@@ -182,7 +182,7 @@ RSpec.describe Spree::Commissions::CommissionOrder do
# One rate governing a whole basket is one question about where the seller
# sits, so the tax engine is consulted once rather than per item.
it 'asks the tax engine once for a basket governed by one rate' do
- 3.times { line_for(vendor) }
+ 3.times { line_for(seller) }
asked = 0
allow_any_instance_of(Spree::TaxProvider::Internal).to receive(:service_tax_rate) do
asked += 1
@@ -200,10 +200,10 @@ RSpec.describe Spree::Commissions::CommissionOrder do
# The line's own snapshot is the record of who sold it — the catalog
# changing hands afterwards must never move the charge.
it 'follows the line snapshot rather than the product today' do
- line = line_for(vendor)
- line.variant.product.update!(vendor: other_vendor)
+ line = line_for(seller)
+ line.variant.product.update!(seller: other_seller)
- expect(commission.first.vendor).to eq(vendor)
+ expect(commission.first.seller).to eq(seller)
end
end
end
diff --git a/spree/core/spec/services/spree/commissions/resolve_rate_spec.rb b/spree/core/spec/services/spree/commissions/resolve_rate_spec.rb
index 9c3da03d5d..f57fd1c31b 100644
--- a/spree/core/spec/services/spree/commissions/resolve_rate_spec.rb
+++ b/spree/core/spec/services/spree/commissions/resolve_rate_spec.rb
@@ -2,14 +2,14 @@ require 'spec_helper'
RSpec.describe Spree::Commissions::ResolveRate do
let(:store) { @default_store }
- let(:vendor) { create(:vendor, :approved, store: store) }
- let(:other_vendor) { create(:vendor, :approved, store: store) }
- let(:product) { create(:product, store: store, vendor: vendor) }
+ let(:seller) { create(:seller, :approved, store: store) }
+ let(:other_seller) { create(:seller, :approved, store: store) }
+ let(:product) { create(:product, store: store, seller: seller) }
let(:order) { create(:order, store: store, currency: 'USD') }
let(:line_item) { create(:line_item, order: order, variant: product.default_variant) }
def resolve(currency: 'USD')
- described_class.call(line_item: line_item, vendor: vendor, store: store, currency: currency).value
+ described_class.call(line_item: line_item, seller: seller, store: store, currency: currency).value
end
it 'returns nothing when the marketplace has configured no rates' do
@@ -46,21 +46,21 @@ RSpec.describe Spree::Commissions::ResolveRate do
it 'skips a higher-placed rate whose targeting does not match' do
fallback = create(:commission_rate, store: store)
mismatched = create(:commission_rate, store: store)
- create(:commission_vendor_rule, commission_rate: mismatched, vendors: [other_vendor])
+ create(:commission_seller_rule, commission_rate: mismatched, sellers: [other_seller])
expect(resolve).to eq(fallback)
end
- # Which rule type a rate names decides nothing — a vendor-targeted rate
+ # Which rule type a rate names decides nothing — a seller-targeted rate
# placed above a product-targeted one wins, and that is the point of making
# the order editable rather than inferring specificity.
it 'lets the operator order beat any notion of how specific a rule is' do
product_rate = create(:commission_rate, store: store)
create(:commission_product_rule, commission_rate: product_rate, products: [product])
- vendor_rate = create(:commission_rate, store: store)
- create(:commission_vendor_rule, commission_rate: vendor_rate, vendors: [vendor])
+ seller_rate = create(:commission_rate, store: store)
+ create(:commission_seller_rule, commission_rate: seller_rate, sellers: [seller])
- expect(resolve).to eq(vendor_rate)
+ expect(resolve).to eq(seller_rate)
product_rate.move_to_top
@@ -83,7 +83,7 @@ RSpec.describe Spree::Commissions::ResolveRate do
it 'matches a rate targeting the seller' do
rate = create(:commission_rate, store: store)
- create(:commission_vendor_rule, commission_rate: rate, vendors: [vendor])
+ create(:commission_seller_rule, commission_rate: rate, sellers: [seller])
expect(resolve).to eq(rate)
end
diff --git a/spree/core/spec/services/spree/commissions/resolve_tax_rate_spec.rb b/spree/core/spec/services/spree/commissions/resolve_tax_rate_spec.rb
index 302494547e..e39447a729 100644
--- a/spree/core/spec/services/spree/commissions/resolve_tax_rate_spec.rb
+++ b/spree/core/spec/services/spree/commissions/resolve_tax_rate_spec.rb
@@ -3,12 +3,12 @@ require 'spec_helper'
RSpec.describe Spree::Commissions::ResolveTaxRate do
let(:store) { @default_store }
let(:billing_address) { create(:address, country_iso: 'DE') }
- let(:vendor) { create(:vendor, :approved, store: store, billing_address: billing_address) }
+ let(:seller) { create(:seller, :approved, store: store, billing_address: billing_address) }
let(:order) { create(:order, store: store) }
let(:rate) { create(:commission_rate, store: store) }
def resolve
- described_class.call(rate: rate, vendor: vendor, order: order).value
+ described_class.call(rate: rate, seller: seller, order: order).value
end
def resolved_rate
diff --git a/spree/core/spec/services/spree/commissions/typical_setup_spec.rb b/spree/core/spec/services/spree/commissions/typical_setup_spec.rb
index c89e817232..e8ee80d5b3 100644
--- a/spree/core/spec/services/spree/commissions/typical_setup_spec.rb
+++ b/spree/core/spec/services/spree/commissions/typical_setup_spec.rb
@@ -10,13 +10,13 @@ require 'spec_helper'
# of them.
RSpec.describe 'a typical commission setup' do
let(:store) { @default_store }
- let(:vendor) { create(:vendor, :approved, store: store) }
+ let(:seller) { create(:seller, :approved, store: store) }
let(:cameras) { create(:category, store: store) }
let(:order) { create(:order, store: store, currency: 'USD') }
- let(:promoted) { create(:product, store: store, vendor: vendor).tap { |p| p.categories << cameras } }
- let(:camera) { create(:product, store: store, vendor: vendor).tap { |p| p.categories << cameras } }
- let(:other_goods) { create(:product, store: store, vendor: vendor) }
+ let(:promoted) { create(:product, store: store, seller: seller).tap { |p| p.categories << cameras } }
+ let(:camera) { create(:product, store: store, seller: seller).tap { |p| p.categories << cameras } }
+ let(:other_goods) { create(:product, store: store, seller: seller) }
let(:first_party) { create(:product, store: store) }
before do
@@ -25,7 +25,7 @@ RSpec.describe 'a typical commission setup' do
update!(enabled: true, value: 20)
seller_deal = create(:commission_rate, store: store, name: 'Acme deal', value: 12)
- create(:commission_vendor_rule, commission_rate: seller_deal, vendors: [vendor])
+ create(:commission_seller_rule, commission_rate: seller_deal, sellers: [seller])
category_rate = create(:commission_rate, store: store, name: 'Cameras', value: 8)
create(:commission_category_rule, commission_rate: category_rate, categories: [cameras])
@@ -37,7 +37,7 @@ RSpec.describe 'a typical commission setup' do
def rate_for(product)
line = create(:line_item, order: order, variant: product.default_variant, price: 100)
Spree::Commissions::ResolveRate.call(
- line_item: line, vendor: product.vendor, store: store, currency: 'USD'
+ line_item: line, seller: product.seller, store: store, currency: 'USD'
).value
end
diff --git a/spree/core/spec/spec_helper.rb b/spree/core/spec/spec_helper.rb
index acfcc2d0ec..cf5f00f83f 100644
--- a/spree/core/spec/spec_helper.rb
+++ b/spree/core/spec/spec_helper.rb
@@ -23,7 +23,7 @@ if ENV['COVERAGE']
add_filter '/lib/tasks/'
add_filter '/script/'
add_filter '/spec/'
- add_filter '/vendor/'
+ add_filter '/seller/'
# CI_SHARD distinguishes runners; TEST_ENV_NUMBER distinguishes the parallel
# rspec processes within a runner — both are needed so concurrent processes
diff --git a/spree/core/spec/workflows/spree/carts/complete_spec.rb b/spree/core/spec/workflows/spree/carts/complete_spec.rb
index 5e58f02b05..38885ea082 100644
--- a/spree/core/spec/workflows/spree/carts/complete_spec.rb
+++ b/spree/core/spec/workflows/spree/carts/complete_spec.rb
@@ -10,25 +10,25 @@ module Spree
# The split partitions on this column, so it has to survive the copy from
# cart line to order line — and be right at the moment of placement, since
# the catalog can change hands while an item sits in a cart.
- describe 'the vendor snapshot' do
- let(:vendor) { create(:vendor, store: store, name: 'Sparks Audio') }
+ describe 'the seller snapshot' do
+ let(:seller) { create(:seller, store: store, name: 'Sparks Audio') }
it 'carries onto the order lines' do
ready_cart.line_items.each do |line_item|
- line_item.variant.product.update!(vendor: vendor)
- line_item.update!(vendor: vendor)
+ line_item.variant.product.update!(seller: seller)
+ line_item.update!(seller: seller)
end
result = described_class.call(cart: ready_cart)
expect(result).to be_success
- expect(result.value.line_items.map(&:vendor_id).uniq).to eq([vendor.id])
+ expect(result.value.line_items.map(&:seller_id).uniq).to eq([seller.id])
end
it 'leaves first-party lines without a seller' do
result = described_class.call(cart: ready_cart)
- expect(result.value.line_items.map(&:vendor_id).uniq).to eq([nil])
+ expect(result.value.line_items.map(&:seller_id).uniq).to eq([nil])
end
end
diff --git a/spree/core/spec/workflows/spree/sellers/lifecycle_spec.rb b/spree/core/spec/workflows/spree/sellers/lifecycle_spec.rb
new file mode 100644
index 0000000000..f34516fd23
--- /dev/null
+++ b/spree/core/spec/workflows/spree/sellers/lifecycle_spec.rb
@@ -0,0 +1,143 @@
+require 'spec_helper'
+
+RSpec.describe 'Spree::Sellers workflows' do
+ let(:store) { @default_store }
+ let(:seller) { create(:seller, store: store) }
+ let(:staff) { create(:admin_user) }
+
+ before { Spree.hooks.clear! }
+ after { Spree.hooks.clear! }
+
+ describe Spree::Sellers::Invite do
+ subject(:result) { described_class.call(seller: seller, email: '[email protected]', inviter: staff) }
+
+ it 'sends an invitation to the seller and marks it invited' do
+ expect(result).to be_success
+ expect(seller.reload).to be_invited
+ expect(seller.invitations.last.email).to eq('[email protected]')
+ end
+
+ it "invites into the seller's own admin role, not the store's" do
+ expect(result.value.invitations.last.role.resource).to eq(seller)
+ end
+
+ it 'refuses a role belonging to somewhere else' do
+ store_role = Spree::Role.default_admin_role(store)
+
+ outcome = described_class.call(seller: seller, email: '[email protected]', inviter: staff, role: store_role)
+
+ expect(outcome).to be_failure
+ expect(seller.reload).to be_pending
+ end
+
+ it 'refuses a seller already trading' do
+ seller.update!(status: 'approved')
+
+ expect(described_class.call(seller: seller, email: '[email protected]', inviter: staff)).to be_failure
+ end
+
+ it 're-invites one whose first invitation went astray' do
+ result
+ expect(described_class.call(seller: seller, email: '[email protected]', inviter: staff)).to be_success
+ end
+
+ it 'runs validate handlers before anything is written' do
+ Spree.hooks.register('sellers.invite.validate') { |workflow| workflow.reject!('not this one') }
+
+ expect(result).to be_failure
+ expect(seller.reload).to be_pending
+ expect(seller.invitations).to be_empty
+ end
+ end
+
+ describe Spree::Sellers::Approve do
+ it 'lets an applicant under review trade' do
+ seller.update!(status: 'ready_for_review')
+
+ expect(described_class.call(seller: seller)).to be_success
+ expect(seller.reload).to be_approved
+ end
+
+ it 'lifts a suspension, and the holiday it was hiding behind' do
+ seller.update!(status: 'suspended', holiday_mode_until: 2.weeks.from_now)
+
+ expect(described_class.call(seller: seller)).to be_success
+ expect(seller.reload).to be_sellable
+ end
+
+ it 'refuses one already approved' do
+ seller.update!(status: 'approved')
+
+ expect(described_class.call(seller: seller)).to be_failure
+ end
+
+ it 'refuses one that has not been invited yet' do
+ expect(described_class.call(seller: seller)).to be_failure
+ end
+ end
+
+ describe Spree::Sellers::Suspend do
+ before { seller.update!(status: 'approved') }
+
+ it 'stops a trading seller' do
+ expect(described_class.call(seller: seller)).to be_success
+ expect(seller.reload).to be_suspended
+ expect(seller).not_to be_sellable
+ end
+
+ it 'keeps the reason with the seller' do
+ described_class.call(seller: seller, reason: 'Counterfeit goods')
+
+ expect(seller.reload.metadata['suspension_reason']).to eq('Counterfeit goods')
+ end
+
+ it 'refuses one already suspended' do
+ seller.update!(status: 'suspended')
+
+ expect(described_class.call(seller: seller)).to be_failure
+ end
+ end
+
+ describe Spree::Sellers::Reject do
+ it 'turns down an applicant' do
+ seller.update!(status: 'ready_for_review')
+
+ expect(described_class.call(seller: seller, reason: 'Incomplete paperwork')).to be_success
+ expect(seller.reload).to be_rejected
+ expect(seller.metadata['rejection_reason']).to eq('Incomplete paperwork')
+ end
+
+ # A trading seller is suspended instead — reversible, and a different
+ # thing to tell them.
+ it 'refuses one already approved' do
+ seller.update!(status: 'approved')
+
+ expect(described_class.call(seller: seller)).to be_failure
+ end
+
+ it 'can be undone by approving' do
+ seller.update!(status: 'ready_for_review')
+ described_class.call(seller: seller)
+
+ expect(Spree::Sellers::Approve.call(seller: seller.reload)).to be_success
+ expect(seller.reload).to be_approved
+ end
+ end
+
+ describe 'lifecycle hooks' do
+ it 'reports each transition to its own hook' do
+ seen = []
+ %w[invite approve suspend reject].each do |action|
+ Spree.hooks.register("sellers.#{action}.after_#{action}") { |_workflow| seen << action }
+ end
+
+ Spree::Sellers::Invite.call(seller: seller, email: '[email protected]', inviter: staff)
+ seller.update!(status: 'ready_for_review')
+ Spree::Sellers::Approve.call(seller: seller)
+ Spree::Sellers::Suspend.call(seller: seller.reload)
+ Spree::Sellers::Reject.call(seller: create(:seller, store: store))
+
+ expect(seen).to eq(%w[invite approve suspend reject])
+ end
+ end
+end
diff --git a/spree/core/spec/workflows/spree/vendors/lifecycle_spec.rb b/spree/core/spec/workflows/spree/vendors/lifecycle_spec.rb
deleted file mode 100644
index 293400584a..0000000000
--- a/spree/core/spec/workflows/spree/vendors/lifecycle_spec.rb
+++ /dev/null
@@ -1,143 +0,0 @@
-require 'spec_helper'
-
-RSpec.describe 'Spree::Vendors workflows' do
- let(:store) { @default_store }
- let(:vendor) { create(:vendor, store: store) }
- let(:staff) { create(:admin_user) }
-
- before { Spree.hooks.clear! }
- after { Spree.hooks.clear! }
-
- describe Spree::Vendors::Invite do
- subject(:result) { described_class.call(vendor: vendor, email: '[email protected]', inviter: staff) }
-
- it 'sends an invitation to the vendor and marks it invited' do
- expect(result).to be_success
- expect(vendor.reload).to be_invited
- expect(vendor.invitations.last.email).to eq('[email protected]')
- end
-
- it "invites into the vendor's own admin role, not the store's" do
- expect(result.value.invitations.last.role.resource).to eq(vendor)
- end
-
- it 'refuses a role belonging to somewhere else' do
- store_role = Spree::Role.default_admin_role(store)
-
- outcome = described_class.call(vendor: vendor, email: '[email protected]', inviter: staff, role: store_role)
-
- expect(outcome).to be_failure
- expect(vendor.reload).to be_pending
- end
-
- it 'refuses a vendor already trading' do
- vendor.update!(status: 'approved')
-
- expect(described_class.call(vendor: vendor, email: '[email protected]', inviter: staff)).to be_failure
- end
-
- it 're-invites one whose first invitation went astray' do
- result
- expect(described_class.call(vendor: vendor, email: '[email protected]', inviter: staff)).to be_success
- end
-
- it 'runs validate handlers before anything is written' do
- Spree.hooks.register('vendors.invite.validate') { |workflow| workflow.reject!('not this one') }
-
- expect(result).to be_failure
- expect(vendor.reload).to be_pending
- expect(vendor.invitations).to be_empty
- end
- end
-
- describe Spree::Vendors::Approve do
- it 'lets an applicant under review trade' do
- vendor.update!(status: 'ready_for_review')
-
- expect(described_class.call(vendor: vendor)).to be_success
- expect(vendor.reload).to be_approved
- end
-
- it 'lifts a suspension, and the holiday it was hiding behind' do
- vendor.update!(status: 'suspended', holiday_mode_until: 2.weeks.from_now)
-
- expect(described_class.call(vendor: vendor)).to be_success
- expect(vendor.reload).to be_sellable
- end
-
- it 'refuses one already approved' do
- vendor.update!(status: 'approved')
-
- expect(described_class.call(vendor: vendor)).to be_failure
- end
-
- it 'refuses one that has not been invited yet' do
- expect(described_class.call(vendor: vendor)).to be_failure
- end
- end
-
- describe Spree::Vendors::Suspend do
- before { vendor.update!(status: 'approved') }
-
- it 'stops a trading vendor' do
- expect(described_class.call(vendor: vendor)).to be_success
- expect(vendor.reload).to be_suspended
- expect(vendor).not_to be_sellable
- end
-
- it 'keeps the reason with the vendor' do
- described_class.call(vendor: vendor, reason: 'Counterfeit goods')
-
- expect(vendor.reload.metadata['suspension_reason']).to eq('Counterfeit goods')
- end
-
- it 'refuses one already suspended' do
- vendor.update!(status: 'suspended')
-
- expect(described_class.call(vendor: vendor)).to be_failure
- end
- end
-
- describe Spree::Vendors::Reject do
- it 'turns down an applicant' do
- vendor.update!(status: 'ready_for_review')
-
- expect(described_class.call(vendor: vendor, reason: 'Incomplete paperwork')).to be_success
- expect(vendor.reload).to be_rejected
- expect(vendor.metadata['rejection_reason']).to eq('Incomplete paperwork')
- end
-
- # A trading vendor is suspended instead — reversible, and a different
- # thing to tell them.
- it 'refuses one already approved' do
- vendor.update!(status: 'approved')
-
- expect(described_class.call(vendor: vendor)).to be_failure
- end
-
- it 'can be undone by approving' do
- vendor.update!(status: 'ready_for_review')
- described_class.call(vendor: vendor)
-
- expect(Spree::Vendors::Approve.call(vendor: vendor.reload)).to be_success
- expect(vendor.reload).to be_approved
- end
- end
-
- describe 'lifecycle hooks' do
- it 'reports each transition to its own hook' do
- seen = []
- %w[invite approve suspend reject].each do |action|
- Spree.hooks.register("vendors.#{action}.after_#{action}") { |_workflow| seen << action }
- end
-
- Spree::Vendors::Invite.call(vendor: vendor, email: '[email protected]', inviter: staff)
- vendor.update!(status: 'ready_for_review')
- Spree::Vendors::Approve.call(vendor: vendor)
- Spree::Vendors::Suspend.call(vendor: vendor.reload)
- Spree::Vendors::Reject.call(vendor: create(:vendor, store: store))
-
- expect(seen).to eq(%w[invite approve suspend reject])
- end
- end
-end
diff --git a/spree/emails/app/mailers/spree/vendor_mailer.rb b/spree/emails/app/mailers/spree/seller_mailer.rb
similarity index 64%
rename from spree/emails/app/mailers/spree/vendor_mailer.rb
rename to spree/emails/app/mailers/spree/seller_mailer.rb
index de133367da..a49657a19e 100644
--- a/spree/emails/app/mailers/spree/vendor_mailer.rb
+++ b/spree/emails/app/mailers/spree/seller_mailer.rb
@@ -1,58 +1,58 @@
module Spree
# Tells a seller what just happened to them on the marketplace.
#
- # Deliberately vendor-facing only: the legacy module also copied every store
+ # Deliberately seller-facing only: the legacy module also copied every store
# admin on approvals and onboarding, which on a marketplace with many sellers
# is a lot of mail about something staff can already see in the dashboard.
# Marketplace-side notifications ride the event and webhook surface instead.
- class VendorMailer < BaseMailer
+ class SellerMailer < BaseMailer
helper Spree::MailHelper
- # @param vendor [Spree::Vendor, Integer]
- def approved_email(vendor)
- @vendor = load_vendor(vendor)
+ # @param seller [Spree::Seller, Integer]
+ def approved_email(seller)
+ @seller = load_seller(seller)
# Where the seller signs in. Resolved rather than built from the store URL
# so a hosted dashboard, a dev Vite server and a mounted build all work.
@dashboard_url = Spree::Stores::DashboardUrl.call(store: store).presence
- deliver_to_vendor('vendor_mailer.approved_email.subject')
+ deliver_to_seller('seller_mailer.approved_email.subject')
end
# Carries no reason: the operator's note is an internal record, and a
# suspended seller is told to get in touch rather than handed a verdict.
- def suspended_email(vendor)
- @vendor = load_vendor(vendor)
+ def suspended_email(seller)
+ @seller = load_seller(seller)
- deliver_to_vendor('vendor_mailer.suspended_email.subject')
+ deliver_to_seller('seller_mailer.suspended_email.subject')
end
- def rejected_email(vendor)
- @vendor = load_vendor(vendor)
+ def rejected_email(seller)
+ @seller = load_seller(seller)
- deliver_to_vendor('vendor_mailer.rejected_email.subject')
+ deliver_to_seller('seller_mailer.rejected_email.subject')
end
private
- def load_vendor(vendor)
- vendor.respond_to?(:id) ? vendor : Spree::Vendor.find(vendor)
+ def load_seller(seller)
+ seller.respond_to?(:id) ? seller : Spree::Seller.find(seller)
end
def store
- @store ||= @vendor.store || Spree::Store.default
+ @store ||= @seller.store || Spree::Store.default
end
- # The team plus the address the vendor gave for contact — before anyone has
+ # The team plus the address the seller gave for contact — before anyone has
# accepted an invitation the team is empty, and that address is the only way
# to reach them.
def recipients
- (@vendor.users.pluck(:email) << @vendor.contact_email).compact_blank.uniq(&:downcase)
+ (@seller.users.pluck(:email) << @seller.contact_email).compact_blank.uniq(&:downcase)
end
# Takes the key, not the translated string: resolving the subject outside
# the block would render it in whatever locale the job happens to run
# under, so a seller could get an English subject over a German email.
- def deliver_to_vendor(subject_key)
+ def deliver_to_seller(subject_key)
addresses = recipients
return message.perform_deliveries = false if addresses.empty?
diff --git a/spree/emails/app/subscribers/spree/vendor_email_subscriber.rb b/spree/emails/app/subscribers/spree/seller_email_subscriber.rb
similarity index 53%
rename from spree/emails/app/subscribers/spree/vendor_email_subscriber.rb
rename to spree/emails/app/subscribers/spree/seller_email_subscriber.rb
index 9d2c4830e6..0626033e46 100644
--- a/spree/emails/app/subscribers/spree/vendor_email_subscriber.rb
+++ b/spree/emails/app/subscribers/spree/seller_email_subscriber.rb
@@ -1,21 +1,21 @@
# frozen_string_literal: true
module Spree
- # Turns the vendor lifecycle events into seller-facing mail.
+ # Turns the seller lifecycle events into seller-facing mail.
#
# Nothing is sent from the workflows themselves: a transition publishes an
# event, and mail is one listener among several (webhooks, analytics) rather
# than a step the transition waits on.
#
- # `vendor.invited` is deliberately absent — inviting a vendor creates an
+ # `seller.invited` is deliberately absent — inviting a seller creates an
# Invitation, which already mails the invitee through InvitationEmailSubscriber.
# A second email would be the same news to the same address.
- class VendorEmailSubscriber < Spree::Subscriber
- subscribes_to 'vendor.approved', 'vendor.suspended', 'vendor.rejected'
+ class SellerEmailSubscriber < Spree::Subscriber
+ subscribes_to 'seller.approved', 'seller.suspended', 'seller.rejected'
- on 'vendor.approved', :send_approved_email
- on 'vendor.suspended', :send_suspended_email
- on 'vendor.rejected', :send_rejected_email
+ on 'seller.approved', :send_approved_email
+ on 'seller.suspended', :send_suspended_email
+ on 'seller.rejected', :send_rejected_email
private
@@ -32,15 +32,15 @@ module Spree
end
def deliver(event, mailer_method)
- vendor = find_vendor(event)
- return unless vendor
- return unless vendor.store&.prefers_send_vendor_transactional_emails?
+ seller = find_seller(event)
+ return unless seller
+ return unless seller.store&.prefers_send_seller_transactional_emails?
- VendorMailer.public_send(mailer_method, vendor.id).deliver_later
+ SellerMailer.public_send(mailer_method, seller.id).deliver_later
end
- def find_vendor(event)
- Spree::Vendor.find_by_prefix_id(event.payload['id'])
+ def find_seller(event)
+ Spree::Seller.find_by_prefix_id(event.payload['id'])
end
end
end
diff --git a/spree/emails/app/views/spree/seller_mailer/approved_email.html.erb b/spree/emails/app/views/spree/seller_mailer/approved_email.html.erb
new file mode 100644
index 0000000000..b042701c01
--- /dev/null
+++ b/spree/emails/app/views/spree/seller_mailer/approved_email.html.erb
@@ -0,0 +1,8 @@
+<%= render layout: 'spree/shared/mailer_hero' do %>
+ <h1><%= Spree.t('seller_mailer.approved_email.heading') %></h1>
+ <p class="greeting"><%= Spree.t('seller_mailer.greeting', seller_name: @seller.name) %></p>
+ <p><%= Spree.t('seller_mailer.approved_email.message', store_name: current_store.name) %></p>
+ <% if @dashboard_url %>
+ <%= render 'spree/shared/mailer_button', url: @dashboard_url, label: Spree.t('seller_mailer.approved_email.action') %>
+ <% end %>
+<% end %>
diff --git a/spree/emails/app/views/spree/seller_mailer/approved_email.text.erb b/spree/emails/app/views/spree/seller_mailer/approved_email.text.erb
new file mode 100644
index 0000000000..613550783f
--- /dev/null
+++ b/spree/emails/app/views/spree/seller_mailer/approved_email.text.erb
@@ -0,0 +1,8 @@
+<%= Spree.t('seller_mailer.greeting', seller_name: @seller.name) %>
+
+<%= Spree.t('seller_mailer.approved_email.message', store_name: current_store.name) %>
+<% if @dashboard_url %>
+<%= Spree.t('seller_mailer.approved_email.action') %>: <%= @dashboard_url %>
+<% end %>
+
+<%= Spree.t('order_mailer.store_team', store_name: current_store.name) %>
diff --git a/spree/emails/app/views/spree/seller_mailer/rejected_email.html.erb b/spree/emails/app/views/spree/seller_mailer/rejected_email.html.erb
new file mode 100644
index 0000000000..19a7ad7243
--- /dev/null
+++ b/spree/emails/app/views/spree/seller_mailer/rejected_email.html.erb
@@ -0,0 +1,6 @@
+<%= render layout: 'spree/shared/mailer_hero' do %>
+ <h1><%= Spree.t('seller_mailer.rejected_email.heading') %></h1>
+ <p class="greeting"><%= Spree.t('seller_mailer.greeting', seller_name: @seller.name) %></p>
+ <p><%= Spree.t('seller_mailer.rejected_email.message', store_name: current_store.name) %></p>
+ <p class="sub"><%= Spree.t('seller_mailer.get_in_touch', store_email: current_store.mail_from_address) %></p>
+<% end %>
diff --git a/spree/emails/app/views/spree/seller_mailer/rejected_email.text.erb b/spree/emails/app/views/spree/seller_mailer/rejected_email.text.erb
new file mode 100644
index 0000000000..c50142aec6
--- /dev/null
+++ b/spree/emails/app/views/spree/seller_mailer/rejected_email.text.erb
@@ -0,0 +1,7 @@
+<%= Spree.t('seller_mailer.greeting', seller_name: @seller.name) %>
+
+<%= Spree.t('seller_mailer.rejected_email.message', store_name: current_store.name) %>
+
+<%= Spree.t('seller_mailer.get_in_touch', store_email: current_store.mail_from_address) %>
+
+<%= Spree.t('order_mailer.store_team', store_name: current_store.name) %>
diff --git a/spree/emails/app/views/spree/seller_mailer/suspended_email.html.erb b/spree/emails/app/views/spree/seller_mailer/suspended_email.html.erb
new file mode 100644
index 0000000000..1660d0767f
--- /dev/null
+++ b/spree/emails/app/views/spree/seller_mailer/suspended_email.html.erb
@@ -0,0 +1,6 @@
+<%= render layout: 'spree/shared/mailer_hero' do %>
+ <h1><%= Spree.t('seller_mailer.suspended_email.heading') %></h1>
+ <p class="greeting"><%= Spree.t('seller_mailer.greeting', seller_name: @seller.name) %></p>
+ <p><%= Spree.t('seller_mailer.suspended_email.message', store_name: current_store.name) %></p>
+ <p class="sub"><%= Spree.t('seller_mailer.get_in_touch', store_email: current_store.mail_from_address) %></p>
+<% end %>
diff --git a/spree/emails/app/views/spree/seller_mailer/suspended_email.text.erb b/spree/emails/app/views/spree/seller_mailer/suspended_email.text.erb
new file mode 100644
index 0000000000..d21ccb973f
--- /dev/null
+++ b/spree/emails/app/views/spree/seller_mailer/suspended_email.text.erb
@@ -0,0 +1,7 @@
+<%= Spree.t('seller_mailer.greeting', seller_name: @seller.name) %>
+
+<%= Spree.t('seller_mailer.suspended_email.message', store_name: current_store.name) %>
+
+<%= Spree.t('seller_mailer.get_in_touch', store_email: current_store.mail_from_address) %>
+
+<%= Spree.t('order_mailer.store_team', store_name: current_store.name) %>
diff --git a/spree/emails/app/views/spree/vendor_mailer/approved_email.html.erb b/spree/emails/app/views/spree/vendor_mailer/approved_email.html.erb
deleted file mode 100644
index 501467e4a1..0000000000
--- a/spree/emails/app/views/spree/vendor_mailer/approved_email.html.erb
+++ /dev/null
@@ -1,8 +0,0 @@
-<%= render layout: 'spree/shared/mailer_hero' do %>
- <h1><%= Spree.t('vendor_mailer.approved_email.heading') %></h1>
- <p class="greeting"><%= Spree.t('vendor_mailer.greeting', vendor_name: @vendor.name) %></p>
- <p><%= Spree.t('vendor_mailer.approved_email.message', store_name: current_store.name) %></p>
- <% if @dashboard_url %>
- <%= render 'spree/shared/mailer_button', url: @dashboard_url, label: Spree.t('vendor_mailer.approved_email.action') %>
- <% end %>
-<% end %>
diff --git a/spree/emails/app/views/spree/vendor_mailer/approved_email.text.erb b/spree/emails/app/views/spree/vendor_mailer/approved_email.text.erb
deleted file mode 100644
index a1616ca233..0000000000
--- a/spree/emails/app/views/spree/vendor_mailer/approved_email.text.erb
+++ /dev/null
@@ -1,8 +0,0 @@
-<%= Spree.t('vendor_mailer.greeting', vendor_name: @vendor.name) %>
-
-<%= Spree.t('vendor_mailer.approved_email.message', store_name: current_store.name) %>
-<% if @dashboard_url %>
-<%= Spree.t('vendor_mailer.approved_email.action') %>: <%= @dashboard_url %>
-<% end %>
-
-<%= Spree.t('order_mailer.store_team', store_name: current_store.name) %>
diff --git a/spree/emails/app/views/spree/vendor_mailer/rejected_email.html.erb b/spree/emails/app/views/spree/vendor_mailer/rejected_email.html.erb
deleted file mode 100644
index 2ad1570242..0000000000
--- a/spree/emails/app/views/spree/vendor_mailer/rejected_email.html.erb
+++ /dev/null
@@ -1,6 +0,0 @@
-<%= render layout: 'spree/shared/mailer_hero' do %>
- <h1><%= Spree.t('vendor_mailer.rejected_email.heading') %></h1>
- <p class="greeting"><%= Spree.t('vendor_mailer.greeting', vendor_name: @vendor.name) %></p>
- <p><%= Spree.t('vendor_mailer.rejected_email.message', store_name: current_store.name) %></p>
- <p class="sub"><%= Spree.t('vendor_mailer.get_in_touch', store_email: current_store.mail_from_address) %></p>
-<% end %>
diff --git a/spree/emails/app/views/spree/vendor_mailer/rejected_email.text.erb b/spree/emails/app/views/spree/vendor_mailer/rejected_email.text.erb
deleted file mode 100644
index b9a41dadc2..0000000000
--- a/spree/emails/app/views/spree/vendor_mailer/rejected_email.text.erb
+++ /dev/null
@@ -1,7 +0,0 @@
-<%= Spree.t('vendor_mailer.greeting', vendor_name: @vendor.name) %>
-
-<%= Spree.t('vendor_mailer.rejected_email.message', store_name: current_store.name) %>
-
-<%= Spree.t('vendor_mailer.get_in_touch', store_email: current_store.mail_from_address) %>
-
-<%= Spree.t('order_mailer.store_team', store_name: current_store.name) %>
diff --git a/spree/emails/app/views/spree/vendor_mailer/suspended_email.html.erb b/spree/emails/app/views/spree/vendor_mailer/suspended_email.html.erb
deleted file mode 100644
index 01ca0cb894..0000000000
--- a/spree/emails/app/views/spree/vendor_mailer/suspended_email.html.erb
+++ /dev/null
@@ -1,6 +0,0 @@
-<%= render layout: 'spree/shared/mailer_hero' do %>
- <h1><%= Spree.t('vendor_mailer.suspended_email.heading') %></h1>
- <p class="greeting"><%= Spree.t('vendor_mailer.greeting', vendor_name: @vendor.name) %></p>
- <p><%= Spree.t('vendor_mailer.suspended_email.message', store_name: current_store.name) %></p>
- <p class="sub"><%= Spree.t('vendor_mailer.get_in_touch', store_email: current_store.mail_from_address) %></p>
-<% end %>
diff --git a/spree/emails/app/views/spree/vendor_mailer/suspended_email.text.erb b/spree/emails/app/views/spree/vendor_mailer/suspended_email.text.erb
deleted file mode 100644
index 4087f46841..0000000000
--- a/spree/emails/app/views/spree/vendor_mailer/suspended_email.text.erb
+++ /dev/null
@@ -1,7 +0,0 @@
-<%= Spree.t('vendor_mailer.greeting', vendor_name: @vendor.name) %>
-
-<%= Spree.t('vendor_mailer.suspended_email.message', store_name: current_store.name) %>
-
-<%= Spree.t('vendor_mailer.get_in_touch', store_email: current_store.mail_from_address) %>
-
-<%= Spree.t('order_mailer.store_team', store_name: current_store.name) %>
diff --git a/spree/emails/lib/spree/emails/engine.rb b/spree/emails/lib/spree/emails/engine.rb
index 643323bd62..803f9577c2 100644
--- a/spree/emails/lib/spree/emails/engine.rb
+++ b/spree/emails/lib/spree/emails/engine.rb
@@ -25,7 +25,7 @@ module Spree
Spree::ReturnEmailSubscriber,
Spree::NewsletterSubscriberEmailSubscriber,
Spree::CustomerEmailSubscriber,
- Spree::VendorEmailSubscriber
+ Spree::SellerEmailSubscriber
]
end
end
diff --git a/spree/emails/spec/mailers/spree/vendor_mailer_spec.rb b/spree/emails/spec/mailers/spree/seller_mailer_spec.rb
similarity index 77%
rename from spree/emails/spec/mailers/spree/vendor_mailer_spec.rb
rename to spree/emails/spec/mailers/spree/seller_mailer_spec.rb
index 5a945969fc..54211d9cff 100644
--- a/spree/emails/spec/mailers/spree/vendor_mailer_spec.rb
+++ b/spree/emails/spec/mailers/spree/seller_mailer_spec.rb
@@ -2,12 +2,12 @@
require 'spec_helper'
-RSpec.describe Spree::VendorMailer do
+RSpec.describe Spree::SellerMailer do
let(:store) { create(:store, name: 'Sparks Marketplace') }
- let(:vendor) { create(:vendor, store: store, name: 'Sparks Audio', contact_email: '[email protected]') }
+ let(:seller) { create(:seller, store: store, name: 'Sparks Audio', contact_email: '[email protected]') }
describe '#approved_email' do
- subject(:message) { described_class.approved_email(vendor.id) }
+ subject(:message) { described_class.approved_email(seller.id) }
it 'tells the seller they can trade' do
expect(message.subject).to include('Sparks Marketplace')
@@ -21,7 +21,7 @@ RSpec.describe Spree::VendorMailer do
end
describe '#suspended_email' do
- subject(:message) { described_class.suspended_email(vendor.id) }
+ subject(:message) { described_class.suspended_email(seller.id) }
it 'tells the seller selling has stopped, and how to reach the operator' do
expect(message.to).to eq(['[email protected]'])
@@ -31,14 +31,14 @@ RSpec.describe Spree::VendorMailer do
# The operator's note is an internal record — a suspended seller is asked to
# get in touch rather than handed the verdict verbatim.
it 'does not leak the operator note' do
- vendor.update!(metadata: { 'suspension_reason' => 'Counterfeit goods' })
+ seller.update!(metadata: { 'suspension_reason' => 'Counterfeit goods' })
expect(message.body.encoded).not_to include('Counterfeit goods')
end
end
describe '#rejected_email' do
- subject(:message) { described_class.rejected_email(vendor.id) }
+ subject(:message) { described_class.rejected_email(seller.id) }
it 'tells the applicant they were not admitted' do
expect(message.to).to eq(['[email protected]'])
@@ -46,7 +46,7 @@ RSpec.describe Spree::VendorMailer do
end
it 'does not leak the operator note' do
- vendor.update!(metadata: { 'rejection_reason' => 'Incomplete paperwork' })
+ seller.update!(metadata: { 'rejection_reason' => 'Incomplete paperwork' })
expect(message.body.encoded).not_to include('Incomplete paperwork')
end
@@ -59,13 +59,13 @@ RSpec.describe Spree::VendorMailer do
before do
I18n.backend.store_translations(
:de,
- spree: { vendor_mailer: { approved_email: { subject: 'DE-SUBJECT', heading: 'DE-HEADING' } } }
+ spree: { seller_mailer: { approved_email: { subject: 'DE-SUBJECT', heading: 'DE-HEADING' } } }
)
store.update!(default_locale: 'de', supported_locales: 'en,de')
end
it 'renders the subject in the store locale, not the job locale' do
- message = I18n.with_locale(:en) { described_class.approved_email(vendor.id) }
+ message = I18n.with_locale(:en) { described_class.approved_email(seller.id) }
expect(message.subject).to include('DE-SUBJECT')
end
@@ -74,16 +74,16 @@ RSpec.describe Spree::VendorMailer do
describe 'recipients' do
it 'reaches the whole team plus the contact address' do
member = create(:admin_user, email: '[email protected]')
- vendor.add_user(member)
+ seller.add_user(member)
- expect(described_class.approved_email(vendor.id).to).
+ expect(described_class.approved_email(seller.id).to).
to match_array(['[email protected]', '[email protected]'])
end
it 'does not send at all when there is nobody to tell' do
- vendor.update!(contact_email: nil)
+ seller.update!(contact_email: nil)
- expect(described_class.approved_email(vendor.id).to).to be_blank
+ expect(described_class.approved_email(seller.id).to).to be_blank
end
end
end
diff --git a/spree/emails/spec/subscribers/spree/vendor_email_subscriber_spec.rb b/spree/emails/spec/subscribers/spree/seller_email_subscriber_spec.rb
similarity index 51%
rename from spree/emails/spec/subscribers/spree/vendor_email_subscriber_spec.rb
rename to spree/emails/spec/subscribers/spree/seller_email_subscriber_spec.rb
index 89f0d02dee..da62a122e0 100644
--- a/spree/emails/spec/subscribers/spree/vendor_email_subscriber_spec.rb
+++ b/spree/emails/spec/subscribers/spree/seller_email_subscriber_spec.rb
@@ -2,9 +2,9 @@
require 'spec_helper'
-RSpec.describe Spree::VendorEmailSubscriber do
+RSpec.describe Spree::SellerEmailSubscriber do
let(:store) { create(:store) }
- let(:vendor) { create(:vendor, store: store, contact_email: '[email protected]') }
+ let(:seller) { create(:seller, store: store, contact_email: '[email protected]') }
let(:subscriber) { described_class.new }
# The `on` DSL routes through `call` by event name.
@@ -14,28 +14,28 @@ RSpec.describe Spree::VendorEmailSubscriber do
end
before do
- store.update!(preferences: store.preferences.merge(send_vendor_transactional_emails: true))
+ store.update!(preferences: store.preferences.merge(send_seller_transactional_emails: true))
end
- describe 'vendor.approved event' do
+ describe 'seller.approved event' do
it 'sends the approved email' do
- expect(Spree::VendorMailer).to receive(:approved_email).with(vendor.id).
+ expect(Spree::SellerMailer).to receive(:approved_email).with(seller.id).
and_return(double(deliver_later: true))
- subscriber.call(mock_event(vendor, 'vendor.approved'))
+ subscriber.call(mock_event(seller, 'seller.approved'))
end
# Sellers are a different audience from shoppers, so silencing customer
# receipts must not silence seller mail, and vice versa.
- context 'when the store does not prefer vendor transactional emails' do
+ context 'when the store does not prefer seller transactional emails' do
before do
- store.update!(preferences: store.preferences.merge(send_vendor_transactional_emails: false))
+ store.update!(preferences: store.preferences.merge(send_seller_transactional_emails: false))
end
it 'sends nothing' do
- expect(Spree::VendorMailer).not_to receive(:approved_email)
+ expect(Spree::SellerMailer).not_to receive(:approved_email)
- subscriber.call(mock_event(vendor, 'vendor.approved'))
+ subscriber.call(mock_event(seller, 'seller.approved'))
end
end
@@ -44,47 +44,47 @@ RSpec.describe Spree::VendorEmailSubscriber do
store.update!(preferences: store.preferences.merge(send_consumer_transactional_emails: false))
end
- it 'still tells the vendor' do
- expect(Spree::VendorMailer).to receive(:approved_email).and_return(double(deliver_later: true))
+ it 'still tells the seller' do
+ expect(Spree::SellerMailer).to receive(:approved_email).and_return(double(deliver_later: true))
- subscriber.call(mock_event(vendor, 'vendor.approved'))
+ subscriber.call(mock_event(seller, 'seller.approved'))
end
end
- context 'when the vendor is gone' do
+ context 'when the seller is gone' do
it 'does not raise' do
- event = mock_event(vendor, 'vendor.approved')
- vendor.destroy
+ event = mock_event(seller, 'seller.approved')
+ seller.destroy
expect { subscriber.call(event) }.not_to raise_error
end
end
end
- describe 'vendor.suspended event' do
+ describe 'seller.suspended event' do
it 'sends the suspended email' do
- expect(Spree::VendorMailer).to receive(:suspended_email).with(vendor.id).
+ expect(Spree::SellerMailer).to receive(:suspended_email).with(seller.id).
and_return(double(deliver_later: true))
- subscriber.call(mock_event(vendor, 'vendor.suspended'))
+ subscriber.call(mock_event(seller, 'seller.suspended'))
end
end
- describe 'vendor.rejected event' do
+ describe 'seller.rejected event' do
it 'sends the rejected email' do
- expect(Spree::VendorMailer).to receive(:rejected_email).with(vendor.id).
+ expect(Spree::SellerMailer).to receive(:rejected_email).with(seller.id).
and_return(double(deliver_later: true))
- subscriber.call(mock_event(vendor, 'vendor.rejected'))
+ subscriber.call(mock_event(seller, 'seller.rejected'))
end
end
- # Inviting a vendor creates an Invitation, which mails the invitee through
- # InvitationEmailSubscriber. A vendor.invited email would be a second message
+ # Inviting a seller creates an Invitation, which mails the invitee through
+ # InvitationEmailSubscriber. A seller.invited email would be a second message
# to the same address about the same thing.
- describe 'vendor.invited event' do
+ describe 'seller.invited event' do
it 'is not subscribed to' do
- expect(described_class.subscription_patterns).not_to include('vendor.invited')
+ expect(described_class.subscription_patterns).not_to include('seller.invited')
end
end
end
diff --git a/spree/emails/spec/subscribers/spree/vendor_lifecycle_emails_spec.rb b/spree/emails/spec/subscribers/spree/seller_lifecycle_emails_spec.rb
similarity index 65%
rename from spree/emails/spec/subscribers/spree/vendor_lifecycle_emails_spec.rb
rename to spree/emails/spec/subscribers/spree/seller_lifecycle_emails_spec.rb
index 3eba9459d2..ec27517a57 100644
--- a/spree/emails/spec/subscribers/spree/vendor_lifecycle_emails_spec.rb
+++ b/spree/emails/spec/subscribers/spree/seller_lifecycle_emails_spec.rb
@@ -5,15 +5,15 @@ require 'spec_helper'
# The unit specs mock the event. This one drives the real workflows, so a
# transition that stops publishing its event — or a subscriber left out of the
# engine's registration list — fails here rather than going quietly unnoticed.
-RSpec.describe 'vendor lifecycle emails', events: true do
+RSpec.describe 'seller lifecycle emails', events: true do
let(:store) { create(:store) }
- let(:vendor) do
- create(:vendor, store: store, contact_email: '[email protected]', status: 'ready_for_review')
+ let(:seller) do
+ create(:seller, store: store, contact_email: '[email protected]', status: 'ready_for_review')
end
it 'tells the seller when they are approved' do
perform_enqueued_jobs do
- expect { Spree::Vendors::Approve.call(vendor: vendor) }.
+ expect { Spree::Sellers::Approve.call(seller: seller) }.
to change { ActionMailer::Base.deliveries.count }.by(1)
end
@@ -23,10 +23,10 @@ RSpec.describe 'vendor lifecycle emails', events: true do
end
it 'tells the seller when they are suspended' do
- vendor.update!(status: 'approved')
+ seller.update!(status: 'approved')
perform_enqueued_jobs do
- expect { Spree::Vendors::Suspend.call(vendor: vendor, reason: 'Counterfeit goods') }.
+ expect { Spree::Sellers::Suspend.call(seller: seller, reason: 'Counterfeit goods') }.
to change { ActionMailer::Base.deliveries.count }.by(1)
end
@@ -36,28 +36,28 @@ RSpec.describe 'vendor lifecycle emails', events: true do
it 'tells the applicant when they are rejected' do
perform_enqueued_jobs do
- expect { Spree::Vendors::Reject.call(vendor: vendor) }.
+ expect { Spree::Sellers::Reject.call(seller: seller) }.
to change { ActionMailer::Base.deliveries.count }.by(1)
end
end
- it 'sends nothing when the store has vendor emails switched off' do
- store.update!(preferences: store.preferences.merge(send_vendor_transactional_emails: false))
+ it 'sends nothing when the store has seller emails switched off' do
+ store.update!(preferences: store.preferences.merge(send_seller_transactional_emails: false))
perform_enqueued_jobs do
- expect { Spree::Vendors::Approve.call(vendor: vendor) }.
+ expect { Spree::Sellers::Approve.call(seller: seller) }.
not_to change { ActionMailer::Base.deliveries.count }
end
end
- # Inviting already mails through the invitation rail; a vendor email here
+ # Inviting already mails through the invitation rail; a seller email here
# would be the same news twice.
- it 'sends exactly one email when a vendor is invited' do
- pending_vendor = create(:vendor, store: store, contact_email: '[email protected]')
+ it 'sends exactly one email when a seller is invited' do
+ pending_seller = create(:seller, store: store, contact_email: '[email protected]')
perform_enqueued_jobs do
expect do
- Spree::Vendors::Invite.call(vendor: pending_vendor, email: '[email protected]',
+ Spree::Sellers::Invite.call(seller: pending_seller, email: '[email protected]',
inviter: create(:admin_user))
end.to change { ActionMailer::Base.deliveries.count }.by(1)
end