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.

Document the seller post-sale endpoints

Damian Legawiec89794184e8cd
diff --git a/docs/api-reference/seller.yaml b/docs/api-reference/seller.yaml
index 50d1d01614..df00f8e9fd 100644
--- a/docs/api-reference/seller.yaml
+++ b/docs/api-reference/seller.yaml
@@ -304,7 +304,7 @@ paths:
avatar_url:
sellers:
- id: sel_UkLWZg9DAJ
- name: Seller 31
+ name: Seller 35
status: approved
schema:
"$ref": "#/components/schemas/AuthResponse"
@@ -420,7 +420,7 @@ paths:
avatar_url:
sellers:
- id: sel_UkLWZg9DAJ
- name: Seller 52
+ name: Seller 56
status: approved
schema:
"$ref": "#/components/schemas/AuthResponse"
@@ -489,8 +489,8 @@ paths:
avatar_url:
sellers:
- id: sel_UkLWZg9DAJ
- name: Seller 40
- slug: seller-40
+ name: Seller 44
+ slug: seller-44
status: approved
permissions:
- allow: true
@@ -12293,20 +12293,21 @@ paths:
required:
- data
- meta
- "/api/v3/seller/delivery_methods":
+ "/api/v3/seller/delivery_profiles":
get:
- summary: List delivery methods
+ summary: List delivery profiles
tags:
- - Delivery Methods
+ - Delivery Profiles
security:
- bearer_auth: []
description: |
- How this seller's goods can ship: the methods they created themselves,
- plus any the marketplace shares with its sellers.
+ The marketplace's delivery profiles — what kind of goods a product is
+ (parcel, digital, pallet), which decides how it can be shipped.
- A shared marketplace method comes back with `editable: false` — it is
- listed so the seller can see what already ships their goods, and every
- write against it is a 404.
+ Read only. A seller assigns one to a product as `delivery_profile_id`;
+ the profiles themselves, and the zones and methods behind them, are the
+ marketplace's. A product created without one lands on the profile
+ marked `default`.
parameters:
- name: X-Spree-Seller-Id
in: header
@@ -12327,55 +12328,17 @@ paths:
type: integer
responses:
'200':
- description: delivery methods listed
+ description: delivery profiles listed
content:
application/json:
example:
data:
- - id: dm_UkLWZg9DAJ
- name: My courier
- code: UPS_GROUND
- estimated_transit_business_days_min:
- estimated_transit_business_days_max:
- digital: false
- pickup: false
- pickup_point: false
- admin_name:
- storefront_visible: true
- tracking_url:
- created_at: '2026-01-15T12:00:00.000Z'
- updated_at: '2026-01-15T12:00:00.000Z'
- rules: []
- editable: true
- delivery_profile_id: fp_UkLWZg9DAJ
- delivery_zone_id:
- calculator_type: Spree::Calculator::Shipping::FlatRate
- calculator_preferences:
- amounts: {}
- amount: '10.0'
- currency: USD
- - id: dm_gbHJdmfrXB
- name: Marketplace post
- code: UPS_GROUND
- estimated_transit_business_days_min:
- estimated_transit_business_days_max:
- digital: false
- pickup: false
- pickup_point: false
- admin_name:
- storefront_visible: true
- tracking_url:
- created_at: '2026-01-15T12:00:00.000Z'
- updated_at: '2026-01-15T12:00:00.000Z'
- rules: []
- editable: false
- delivery_profile_id: fp_UkLWZg9DAJ
- delivery_zone_id:
- calculator_type: Spree::Calculator::Shipping::FlatRate
- calculator_preferences:
- amounts: {}
- amount: '10.0'
- currency: USD
+ - id: fp_UkLWZg9DAJ
+ name: General
+ default: true
+ - id: fp_gbHJdmfrXB
+ name: Oversized
+ default: false
meta:
page: 1
limit: 25
@@ -12392,25 +12355,77 @@ paths:
data:
type: array
items:
- "$ref": "#/components/schemas/DeliveryMethod"
+ "$ref": "#/components/schemas/DeliveryProfile"
meta:
"$ref": "#/components/schemas/PaginationMeta"
required:
- data
- meta
+ "/api/v3/seller/onboarding":
+ get:
+ summary: Get onboarding checklist
+ tags:
+ - Onboarding
+ security:
+ - bearer_auth: []
+ description: |
+ What this marketplace asks of the seller before it will admit them.
+
+ Singular: the checklist is always the acting seller's. Every answer is
+ computed server-side by the same evaluator the operator's own view uses,
+ so the panel and the operator can never show different progress.
+
+ `progress` counts optional requirements too — it is how far along the
+ checklist is, not how close to approval. Read `blocking` on each
+ requirement for that.
+
+ Each requirement's `id` is what a submission is posted against. A
+ marketplace that asks for nothing returns an empty list, which is a
+ complete answer rather than a missing one.
+ parameters:
+ - name: X-Spree-Seller-Id
+ in: header
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: checklist returned
+ content:
+ application/json:
+ example:
+ status: approved
+ progress:
+ done: 0
+ total: 0
+ requirements: []
+ schema:
+ "$ref": "#/components/schemas/SellerOnboardingResponse"
+ '403':
+ description: no seller named, or not a member of it
+ content:
+ application/json:
+ example:
+ error:
+ code: access_denied
+ message: You do not have access to this seller.
+ schema:
+ "$ref": "#/components/schemas/ErrorResponse"
+ "/api/v3/seller/onboarding/submit_for_review":
post:
- summary: Create a delivery method
+ summary: Submit for review
tags:
- - Delivery Methods
+ - Onboarding
security:
- bearer_auth: []
description: |
- Adds a way for this seller to ship. The method is always the seller's
- own, whatever the payload says.
+ Says the seller is ready, moving them from `onboarding` to
+ `ready_for_review`.
- Neither the rate provider nor the fulfillment provider is settable: a
- seller prices their own rates and enters tracking numbers by hand,
- because carrier accounts belong to the marketplace.
+ Refused with `422` when something required is still outstanding — the
+ message names the blocking requirements, and the seller's status is
+ unchanged. Returns the same payload as the checklist so the panel can
+ re-render from one response.
parameters:
- name: X-Spree-Seller-Id
in: header
@@ -12418,251 +12433,127 @@ paths:
schema:
type: string
responses:
- '201':
- description: delivery method created
+ '200':
+ description: submitted for review
content:
application/json:
example:
- id: dm_EfhxLZ9ck8
- name: Next day
- code:
- estimated_transit_business_days_min:
- estimated_transit_business_days_max:
- digital: false
- pickup: false
- pickup_point: false
- admin_name:
- storefront_visible: true
- tracking_url:
- created_at: '2026-01-15T12:00:00.000Z'
- updated_at: '2026-01-15T12:00:00.000Z'
- rules: []
- editable: true
- delivery_profile_id: fp_gbHJdmfrXB
- delivery_zone_id:
- calculator_type: Spree::Calculator::Shipping::FlatRate
- calculator_preferences:
- amounts: {}
- amount: '9.99'
- currency: USD
+ status: ready_for_review
+ progress:
+ done: 0
+ total: 0
+ requirements: []
schema:
- "$ref": "#/components/schemas/DeliveryMethod"
+ "$ref": "#/components/schemas/SellerOnboardingResponse"
'422':
- description: invalid request
+ description: something required is still outstanding
content:
application/json:
example:
error:
- code: validation_error
- message: Name can't be blank
- details:
- name:
- - can't be blank
+ code: processing_error
+ message: Requirements Accept terms is not complete
schema:
"$ref": "#/components/schemas/ErrorResponse"
- requestBody:
- content:
- application/json:
- schema:
- type: object
- properties:
- name:
- type: string
- admin_name:
- type: string
- nullable: true
- code:
- type: string
- nullable: true
- delivery_profile_id:
- type: string
- description: One of the marketplace's delivery profiles
- delivery_zone_id:
- type: string
- nullable: true
- description: Narrows where the method ships
- 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
- calculator_type:
- type: string
- calculator_preferences:
- type: object
- rules:
- type: array
- description: Conditions on the method, from `/delivery_methods/rule_types`
- items:
- type: object
- properties:
- type:
- type: string
- preferences:
- type: object
- required:
- - name
- "/api/v3/seller/delivery_methods/{id}":
+ "/api/v3/seller/requirements/{requirement_id}/submissions":
parameters:
- - name: id
+ - name: requirement_id
in: path
- description: Delivery method ID
- required: true
- schema:
- type: string
- - name: X-Spree-Seller-Id
- in: header
+ description: Requirement ID, as returned by `GET /api/v3/seller/onboarding`
required: true
schema:
type: string
- get:
- summary: Retrieve a delivery method
+ post:
+ summary: Submit against a requirement
tags:
- - Delivery Methods
+ - Onboarding
security:
- bearer_auth: []
+ description: |
+ What the seller says about one requirement: an attestation they tick, a
+ document they upload, a reference they paste.
+
+ Create only. A submission records what was said and when, so a seller who
+ needs to correct something submits again rather than editing, and the
+ latest one counts.
+
+ `file` is **not** a multipart upload — it is the `signed_id` returned by
+ `POST /api/v3/seller/direct_uploads`, so the bytes are already in storage
+ by the time this runs.
+
+ An attestation is accepted on the spot; a requirement the operator
+ reviews comes back `pending`.
+ parameters:
+ - name: X-Spree-Seller-Id
+ in: header
+ required: true
+ schema:
+ type: string
responses:
- '200':
- description: delivery method found
+ '201':
+ description: submission recorded
content:
application/json:
example:
- id: dm_UkLWZg9DAJ
- name: My courier
- code: UPS_GROUND
- estimated_transit_business_days_min:
- estimated_transit_business_days_max:
- digital: false
- pickup: false
- pickup_point: false
- admin_name:
- storefront_visible: true
- tracking_url:
+ id: selsub_UkLWZg9DAJ
+ status: accepted
+ note: Confirmed.
+ review_note:
+ reference:
+ reviewed_at: '2026-01-15T12:00:00.000Z'
created_at: '2026-01-15T12:00:00.000Z'
updated_at: '2026-01-15T12:00:00.000Z'
- rules: []
- editable: true
- delivery_profile_id: fp_UkLWZg9DAJ
- delivery_zone_id:
- calculator_type: Spree::Calculator::Shipping::FlatRate
- calculator_preferences:
- amounts: {}
- amount: '10.0'
- currency: USD
+ file_url:
+ file_name:
schema:
- "$ref": "#/components/schemas/DeliveryMethod"
- patch:
- summary: Update a delivery method
- tags:
- - Delivery Methods
- security:
- - bearer_auth: []
- description: Only the seller's own methods can be changed — a marketplace method
- shared with sellers is read-only.
- parameters: []
- responses:
- '200':
- description: delivery method updated
+ "$ref": "#/components/schemas/RequirementSubmission"
+ '404':
+ description: a requirement belonging to another marketplace
content:
application/json:
example:
- id: dm_UkLWZg9DAJ
- name: My express courier
- code: UPS_GROUND
- estimated_transit_business_days_min:
- estimated_transit_business_days_max:
- digital: false
- pickup: false
- pickup_point: false
- admin_name:
- storefront_visible: true
- tracking_url:
- created_at: '2026-01-15T12:00:00.000Z'
- updated_at: '2026-01-15T12:00:00.000Z'
- rules: []
- editable: true
- delivery_profile_id: fp_UkLWZg9DAJ
- delivery_zone_id:
- calculator_type: Spree::Calculator::Shipping::FlatRate
- calculator_preferences:
- amounts: {}
- amount: '10.0'
- currency: USD
+ error:
+ code: record_not_found
+ message: Seller requirement not found
schema:
- "$ref": "#/components/schemas/DeliveryMethod"
+ "$ref": "#/components/schemas/ErrorResponse"
requestBody:
content:
application/json:
schema:
type: object
properties:
- name:
- type: string
- admin_name:
- type: string
- nullable: true
- code:
- type: string
- nullable: true
- delivery_profile_id:
- type: string
- description: One of the marketplace's delivery profiles
- delivery_zone_id:
+ note:
type: string
- nullable: true
- description: Narrows where the method ships
- storefront_visible:
- type: boolean
- tracking_url:
+ description: Anything the seller wants to say alongside the submission
+ reference:
type: string
- nullable: true
- estimated_transit_business_days_min:
- type: integer
- nullable: true
- estimated_transit_business_days_max:
- type: integer
- nullable: true
- calculator_type:
+ description: A reference number or external identifier, for requirements
+ that ask for one
+ file:
type: string
- calculator_preferences:
- type: object
- rules:
- type: array
- description: Replaces the whole set — a rule dropped here is deleted,
- so re-send surviving rules with their `id`.
- items:
- type: object
- properties:
- id:
- type: string
- type:
- type: string
- preferences:
- type: object
- delete:
- summary: Retire a delivery method
- tags:
- - Delivery Methods
- security:
- - bearer_auth: []
- responses:
- '204':
- description: delivery method retired
- "/api/v3/seller/delivery_methods/rule_types":
+ description: A direct-upload `signed_id`, for requirements that
+ ask for a document
+ "/api/v3/seller/requirement_submissions/{id}/download":
+ parameters:
+ - name: id
+ in: path
+ description: Submission ID
+ required: true
+ schema:
+ type: string
get:
- summary: List the conditions a method can carry
+ summary: Download a submitted document
tags:
- - Delivery Methods
+ - Onboarding
security:
- bearer_auth: []
- description: The eligibility rules a seller may put on their own method, with
- the preference schema each form is rendered from.
+ description: |
+ Streams the file attached to one of this seller's submissions.
+
+ Served through the API rather than from a storage URL on purpose: these
+ are identity and registration documents, so every read is authorized
+ against the acting seller. Another seller's submission answers `404`.
parameters:
- name: X-Spree-Seller-Id
in: header
@@ -12670,179 +12561,31 @@ paths:
schema:
type: string
responses:
- '200':
- description: rule types listed
+ '404':
+ description: another seller's submission
content:
application/json:
example:
- data:
- - type: item_total_rule
- name: Item total
- description: Limits the delivery method to carts within an item
- total range
- preference_schema:
- - key: minimum_amount
- type: decimal
- default:
- - key: maximum_amount
- type: decimal
- default:
- - type: weight_rule
- name: Weight
- description: Limits the delivery method to packages within a weight
- range
- preference_schema:
- - key: minimum_weight
- type: decimal
- default:
- - key: maximum_weight
- type: decimal
- default:
- schema:
- type: object
- properties:
- data:
- type: array
- items:
- type: object
- properties:
- type:
- type: string
- name:
- type: string
- description:
- type: string
- preference_schema:
- type: array
- items:
- type: object
- required:
- - data
- "/api/v3/seller/delivery_methods/calculators":
- get:
- summary: List the ways a method can be priced
- tags:
- - Delivery Methods
- security:
- - bearer_auth: []
- parameters:
- - name: X-Spree-Seller-Id
- in: header
- required: true
- schema:
- type: string
- responses:
- '200':
- description: calculators listed
- content:
- application/json:
- example:
- data:
- - type: Spree::Calculator::Shipping::FlatPercentItemTotal
- name: Flat Percent
- preference_schema:
- - key: flat_percent
- type: decimal
- default: 0
- - type: Spree::Calculator::Shipping::FlatRate
- name: Flat rate
- preference_schema:
- - key: amounts
- type: hash
- default: {}
- - key: amount
- type: decimal
- default: 0
- - key: currency
- type: string
- default: USD
- - type: Spree::Calculator::Shipping::FlexiRate
- name: Flexible Rate per package item
- preference_schema:
- - key: first_item
- type: decimal
- default: 0.0
- - key: additional_item
- type: decimal
- default: 0.0
- - key: max_items
- type: integer
- default: 0
- - key: currency
- type: string
- default: USD
- - type: Spree::Calculator::Shipping::PerItem
- name: Flat rate per package item
- preference_schema:
- - key: amounts
- type: hash
- default: {}
- - key: amount
- type: decimal
- default: 0
- - key: currency
- type: string
- default: USD
- - type: Spree::Calculator::Shipping::PriceSack
- name: Price sack
- preference_schema:
- - key: minimal_amount
- type: decimal
- default: 0
- - key: normal_amount
- type: decimal
- default: 0
- - key: discount_amount
- type: decimal
- default: 0
- - key: currency
- type: string
- default: USD
- - type: Spree::Calculator::Shipping::DigitalDelivery
- name: Digital Delivery
- preference_schema:
- - key: amounts
- type: hash
- default: {}
- - key: amount
- type: decimal
- default: 0
- - key: currency
- type: string
- default: USD
+ error:
+ code: record_not_found
+ message: Seller requirement submission not found
+ application/octet-stream:
schema:
- type: object
- properties:
- data:
- type: array
- items:
- type: object
- properties:
- type:
- type: string
- name:
- type: string
- preference_schema:
- type: array
- items:
- type: object
- required:
- - data
- "/api/v3/seller/delivery_profiles":
+ "$ref": "#/components/schemas/ErrorResponse"
+ "/api/v3/seller/policies":
get:
- summary: List delivery profiles
+ summary: List policies
tags:
- - Delivery Profiles
+ - Policies
security:
- bearer_auth: []
description: |
- The marketplace's delivery profiles — what kind of goods a product is
- (parcel, digital, pallet), which decides how it can be shipped.
+ This seller's own policy documents.
- Read only. A seller assigns one to a product as `delivery_profile_id`;
- the profiles themselves, and the zones and methods behind them, are the
- marketplace's. A product created without one lands on the profile
- marked `default`.
+ Rooted in the acting seller, so the marketplace operator's store
+ policies and every other seller's are invisible here. A seller starts
+ with none: what they are expected to publish is decided by the
+ marketplace's onboarding checklist.
parameters:
- name: X-Spree-Seller-Id
in: header
@@ -12863,27 +12606,26 @@ paths:
type: integer
responses:
'200':
- description: delivery profiles listed
+ description: policies listed
content:
application/json:
example:
data:
- - id: fp_UkLWZg9DAJ
- name: General
- default: true
- digital: false
- - id: fp_gbHJdmfrXB
- name: Oversized
- default: false
- digital: false
+ - id: pol_uw2YK1rnl0
+ name: Returns Policy
+ slug: returns-policy
+ body: Send anything back within 30 days.
+ body_html: "<p>Send anything back within 30 days.</p>"
+ updated_at: '2026-01-15T12:00:00.000Z'
+ created_at: '2026-01-15T12:00:00.000Z'
meta:
page: 1
limit: 25
- count: 2
+ count: 1
pages: 1
from: 1
- to: 2
- in: 2
+ to: 1
+ in: 1
previous:
next:
schema:
@@ -12892,105 +12634,77 @@ paths:
data:
type: array
items:
- "$ref": "#/components/schemas/DeliveryProfile"
+ "$ref": "#/components/schemas/Policy"
meta:
"$ref": "#/components/schemas/PaginationMeta"
required:
- data
- meta
- "/api/v3/seller/delivery_zones":
- get:
- summary: List delivery zones
+ post:
+ summary: Create a policy
tags:
- - Delivery Zones
+ - Policies
security:
- bearer_auth: []
description: |
- The marketplace's delivery zones — where its methods may ship to.
+ Publishes one of this seller's policies. `body` accepts HTML and is
+ sanitized before it is stored.
- Read only: a seller narrows their own method to one of these and never
- draws one. Pass `delivery_profile_id` to list only the zones under the
- profile a method belongs to, which is what the method form's picker
- asks for.
+ When the marketplace requires a named policy, use that exact name —
+ the onboarding check matches on it.
parameters:
- name: X-Spree-Seller-Id
in: header
required: true
schema:
type: string
- - name: delivery_profile_id
- in: query
- required: false
- description: Only zones under this delivery profile
- 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 (max 100)
- schema:
- type: integer
responses:
- '200':
- description: delivery zones listed
+ '201':
+ description: policy created
content:
application/json:
example:
- data:
- - id: dz_UkLWZg9DAJ
- name: Domestic
- description: Maxime illum debitis veritatis porro accusantium laudantium
- omnis.
- delivery_profile_id: fp_gbHJdmfrXB
- meta:
- page: 1
- limit: 25
- count: 1
- pages: 1
- from: 1
- to: 1
- in: 1
- previous:
- next:
+ id: pol_OIJLhNcSbf
+ name: Shipping Policy
+ slug: shipping-policy
+ body: Orders leave the workshop within two working days.
+ body_html: "<p>Orders leave the workshop within two working days.</p>"
+ updated_at: '2026-01-15T12:00:00.000Z'
+ created_at: '2026-01-15T12:00:00.000Z'
schema:
- type: object
- properties:
- data:
- type: array
- items:
- "$ref": "#/components/schemas/DeliveryZone"
- meta:
- "$ref": "#/components/schemas/PaginationMeta"
- required:
- - data
- - meta
- "/api/v3/seller/onboarding":
+ "$ref": "#/components/schemas/Policy"
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ name:
+ type: string
+ example: Shipping Policy
+ slug:
+ type: string
+ example: shipping-policy
+ body:
+ type: string
+ example: "<p>Orders leave the workshop within two working days.</p>"
+ required:
+ - name
+ "/api/v3/seller/policies/{id}":
+ parameters:
+ - name: id
+ in: path
+ required: true
+ description: Policy prefixed ID or slug
+ schema:
+ type: string
get:
- summary: Get onboarding checklist
+ summary: Get a policy
tags:
- - Onboarding
+ - Policies
security:
- bearer_auth: []
- description: |
- What this marketplace asks of the seller before it will admit them.
-
- Singular: the checklist is always the acting seller's. Every answer is
- computed server-side by the same evaluator the operator's own view uses,
- so the panel and the operator can never show different progress.
-
- `progress` counts optional requirements too — it is how far along the
- checklist is, not how close to approval. Read `blocking` on each
- requirement for that.
-
- Each requirement's `id` is what a submission is posted against. A
- marketplace that asks for nothing returns an empty list, which is a
- complete answer rather than a missing one.
+ description: Returns one of this seller's policies, by prefixed ID or slug.
parameters:
- name: X-Spree-Seller-Id
in: header
@@ -12999,42 +12713,36 @@ paths:
type: string
responses:
'200':
- description: checklist returned
+ description: policy found
content:
application/json:
example:
- status: approved
- progress:
- done: 0
- total: 0
- requirements: []
+ id: pol_uw2YK1rnl0
+ name: Returns Policy
+ slug: returns-policy
+ body: Send anything back within 30 days.
+ body_html: "<p>Send anything back within 30 days.</p>"
+ updated_at: '2026-01-15T12:00:00.000Z'
+ created_at: '2026-01-15T12:00:00.000Z'
schema:
- "$ref": "#/components/schemas/SellerOnboardingResponse"
- '403':
- description: no seller named, or not a member of it
+ "$ref": "#/components/schemas/Policy"
+ '404':
+ description: policy not found
content:
application/json:
example:
error:
- code: access_denied
- message: You do not have access to this seller.
+ code: record_not_found
+ message: Policy not found
schema:
"$ref": "#/components/schemas/ErrorResponse"
- "/api/v3/seller/onboarding/submit_for_review":
- post:
- summary: Submit for review
+ patch:
+ summary: Update a policy
tags:
- - Onboarding
+ - Policies
security:
- bearer_auth: []
- description: |
- Says the seller is ready, moving them from `onboarding` to
- `ready_for_review`.
-
- Refused with `422` when something required is still outstanding — the
- message names the blocking requirements, and the seller's status is
- unchanged. Returns the same payload as the checklist so the panel can
- re-render from one response.
+ description: Rewrites one of this seller's policies.
parameters:
- name: X-Spree-Seller-Id
in: header
@@ -13043,126 +12751,38 @@ paths:
type: string
responses:
'200':
- description: submitted for review
- content:
- application/json:
- example:
- status: ready_for_review
- progress:
- done: 0
- total: 0
- requirements: []
- schema:
- "$ref": "#/components/schemas/SellerOnboardingResponse"
- '422':
- description: something required is still outstanding
+ description: policy updated
content:
application/json:
example:
- error:
- code: processing_error
- message: Requirements Accept terms is not complete
+ id: pol_uw2YK1rnl0
+ name: Returns Policy
+ slug: returns-policy
+ body: Send anything back within 60 days.
+ body_html: "<p>Send anything back within 60 days.</p>"
+ updated_at: '2026-01-15T12:00:00.000Z'
+ created_at: '2026-01-15T12:00:00.000Z'
schema:
- "$ref": "#/components/schemas/ErrorResponse"
- "/api/v3/seller/requirements/{requirement_id}/submissions":
- parameters:
- - name: requirement_id
- in: path
- description: Requirement ID, as returned by `GET /api/v3/seller/onboarding`
- required: true
- schema:
- type: string
- post:
- summary: Submit against a requirement
- tags:
- - Onboarding
- security:
- - bearer_auth: []
- description: |
- What the seller says about one requirement: an attestation they tick, a
- document they upload, a reference they paste.
-
- Create only. A submission records what was said and when, so a seller who
- needs to correct something submits again rather than editing, and the
- latest one counts.
-
- `file` is **not** a multipart upload — it is the `signed_id` returned by
- `POST /api/v3/seller/direct_uploads`, so the bytes are already in storage
- by the time this runs.
-
- An attestation is accepted on the spot; a requirement the operator
- reviews comes back `pending`.
- parameters:
- - name: X-Spree-Seller-Id
- in: header
- required: true
- schema:
- type: string
- responses:
- '201':
- description: submission recorded
- content:
- application/json:
- example:
- id: selsub_UkLWZg9DAJ
- status: accepted
- note: Confirmed.
- review_note:
- reference:
- reviewed_at: '2026-01-15T12:00:00.000Z'
- created_at: '2026-01-15T12:00:00.000Z'
- updated_at: '2026-01-15T12:00:00.000Z'
- file_url:
- file_name:
- schema:
- "$ref": "#/components/schemas/RequirementSubmission"
- '404':
- description: a requirement belonging to another marketplace
- content:
- application/json:
- example:
- error:
- code: record_not_found
- message: Seller requirement not found
- schema:
- "$ref": "#/components/schemas/ErrorResponse"
+ "$ref": "#/components/schemas/Policy"
requestBody:
content:
application/json:
schema:
type: object
properties:
- note:
+ name:
type: string
- description: Anything the seller wants to say alongside the submission
- reference:
+ slug:
type: string
- description: A reference number or external identifier, for requirements
- that ask for one
- file:
+ body:
type: string
- description: A direct-upload `signed_id`, for requirements that
- ask for a document
- "/api/v3/seller/requirement_submissions/{id}/download":
- parameters:
- - name: id
- in: path
- description: Submission ID
- required: true
- schema:
- type: string
- get:
- summary: Download a submitted document
+ delete:
+ summary: Delete a policy
tags:
- - Onboarding
+ - Policies
security:
- bearer_auth: []
- description: |
- Streams the file attached to one of this seller's submissions.
-
- Served through the API rather than from a storage URL on purpose: these
- are identity and registration documents, so every read is authorized
- against the acting seller. Another seller's submission answers `404`.
+ description: Withdraws one of this seller's policies.
parameters:
- name: X-Spree-Seller-Id
in: header
@@ -13170,31 +12790,22 @@ paths:
schema:
type: string
responses:
- '404':
- description: another seller's submission
- content:
- application/json:
- example:
- error:
- code: record_not_found
- message: Seller requirement submission not found
- application/octet-stream:
- schema:
- "$ref": "#/components/schemas/ErrorResponse"
- "/api/v3/seller/policies":
+ '204':
+ description: policy deleted
+ "/api/v3/seller/product_types":
get:
- summary: List policies
+ summary: List product types
tags:
- - Policies
+ - Product Types
security:
- bearer_auth: []
description: |
- This seller's own policy documents.
+ The product types a seller may list a product against.
- Rooted in the acting seller, so the marketplace operator's store
- policies and every other seller's are invisible here. A seller starts
- with none: what they are expected to publish is decided by the
- marketplace's onboarding checklist.
+ Read only. A type is the template that hands a product its option types
+ and its delivery profile, so a seller picks one when listing; defining
+ types is the marketplace's. Send the chosen `id` as `product_type_id`
+ on the product.
parameters:
- name: X-Spree-Seller-Id
in: header
@@ -13215,18 +12826,14 @@ paths:
type: integer
responses:
'200':
- description: policies listed
+ description: product types listed
content:
application/json:
example:
data:
- - id: pol_uw2YK1rnl0
- name: Returns Policy
- slug: returns-policy
- body: Send anything back within 30 days.
- body_html: "<p>Send anything back within 30 days.</p>"
- updated_at: '2026-01-15T12:00:00.000Z'
- created_at: '2026-01-15T12:00:00.000Z'
+ - id: pt_UkLWZg9DAJ
+ name: Apparel
+ option_type_labels: []
meta:
page: 1
limit: 25
@@ -13243,305 +12850,89 @@ paths:
data:
type: array
items:
- "$ref": "#/components/schemas/Policy"
+ "$ref": "#/components/schemas/ProductType"
meta:
"$ref": "#/components/schemas/PaginationMeta"
required:
- data
- meta
- post:
- summary: Create a policy
+ "/api/v3/seller/product_types/{id}":
+ get:
+ summary: Get a product type
tags:
- - Policies
+ - Product Types
security:
- bearer_auth: []
- description: |
- Publishes one of this seller's policies. `body` accepts HTML and is
- sanitized before it is stored.
-
- When the marketplace requires a named policy, use that exact name —
- the onboarding check matches on it.
parameters:
- name: X-Spree-Seller-Id
in: header
required: true
schema:
type: string
+ - name: id
+ in: path
+ required: true
+ description: Product type ID
+ schema:
+ type: string
responses:
- '201':
- description: policy created
+ '200':
+ description: product type found
content:
application/json:
example:
- id: pol_OIJLhNcSbf
- name: Shipping Policy
- slug: shipping-policy
- body: Orders leave the workshop within two working days.
- body_html: "<p>Orders leave the workshop within two working days.</p>"
- updated_at: '2026-01-15T12:00:00.000Z'
- created_at: '2026-01-15T12:00:00.000Z'
+ id: pt_UkLWZg9DAJ
+ name: Apparel
+ option_type_labels: []
schema:
- "$ref": "#/components/schemas/Policy"
- requestBody:
- content:
- application/json:
- schema:
- type: object
- properties:
- name:
- type: string
- example: Shipping Policy
- slug:
- type: string
- example: shipping-policy
- body:
- type: string
- example: "<p>Orders leave the workshop within two working days.</p>"
- required:
- - name
- "/api/v3/seller/policies/{id}":
- parameters:
- - name: id
- in: path
- required: true
- description: Policy prefixed ID or slug
- schema:
- type: string
+ "$ref": "#/components/schemas/ProductType"
+ "/api/v3/seller/products":
get:
- summary: Get a policy
+ summary: List products
tags:
- - Policies
+ - Products
security:
- bearer_auth: []
- description: Returns one of this seller's policies, by prefixed ID or slug.
+ description: |
+ The seller's own catalog — the products they own outright.
+
+ Every call is rooted in the acting seller server-side, so this can never
+ return another seller's product or one the marketplace operator sells
+ first-party.
parameters:
- name: X-Spree-Seller-Id
in: header
required: true
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 (max 100)
+ schema:
+ type: integer
+ - name: sort
+ in: query
+ required: false
+ description: Sort field; prefix with `-` for descending
+ schema:
+ type: string
responses:
'200':
- description: policy found
- content:
- application/json:
- example:
- id: pol_uw2YK1rnl0
- name: Returns Policy
- slug: returns-policy
- body: Send anything back within 30 days.
- body_html: "<p>Send anything back within 30 days.</p>"
- updated_at: '2026-01-15T12:00:00.000Z'
- created_at: '2026-01-15T12:00:00.000Z'
- schema:
- "$ref": "#/components/schemas/Policy"
- '404':
- description: policy not found
- content:
- application/json:
- example:
- error:
- code: record_not_found
- message: Policy not found
- schema:
- "$ref": "#/components/schemas/ErrorResponse"
- patch:
- summary: Update a policy
- tags:
- - Policies
- security:
- - bearer_auth: []
- description: Rewrites one of this seller's policies.
- parameters:
- - name: X-Spree-Seller-Id
- in: header
- required: true
- schema:
- type: string
- responses:
- '200':
- description: policy updated
- content:
- application/json:
- example:
- id: pol_uw2YK1rnl0
- name: Returns Policy
- slug: returns-policy
- body: Send anything back within 60 days.
- body_html: "<p>Send anything back within 60 days.</p>"
- updated_at: '2026-01-15T12:00:00.000Z'
- created_at: '2026-01-15T12:00:00.000Z'
- schema:
- "$ref": "#/components/schemas/Policy"
- requestBody:
- content:
- application/json:
- schema:
- type: object
- properties:
- name:
- type: string
- slug:
- type: string
- body:
- type: string
- delete:
- summary: Delete a policy
- tags:
- - Policies
- security:
- - bearer_auth: []
- description: Withdraws one of this seller's policies.
- parameters:
- - name: X-Spree-Seller-Id
- in: header
- required: true
- schema:
- type: string
- responses:
- '204':
- description: policy deleted
- "/api/v3/seller/product_types":
- get:
- summary: List product types
- tags:
- - Product Types
- security:
- - bearer_auth: []
- description: |
- The product types a seller may list a product against.
-
- Read only. A type is the template that hands a product its option types
- and its delivery profile, so a seller picks one when listing; defining
- types is the marketplace's. Send the chosen `id` as `product_type_id`
- on the product.
- parameters:
- - name: X-Spree-Seller-Id
- in: header
- required: true
- 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 (max 100)
- schema:
- type: integer
- responses:
- '200':
- description: product types listed
- content:
- application/json:
- example:
- data:
- - id: pt_UkLWZg9DAJ
- name: Apparel
- option_type_labels: []
- meta:
- page: 1
- limit: 25
- count: 1
- pages: 1
- from: 1
- to: 1
- in: 1
- previous:
- next:
- schema:
- type: object
- properties:
- data:
- type: array
- items:
- "$ref": "#/components/schemas/ProductType"
- meta:
- "$ref": "#/components/schemas/PaginationMeta"
- required:
- - data
- - meta
- "/api/v3/seller/product_types/{id}":
- get:
- summary: Get a product type
- tags:
- - Product Types
- security:
- - bearer_auth: []
- parameters:
- - name: X-Spree-Seller-Id
- in: header
- required: true
- schema:
- type: string
- - name: id
- in: path
- required: true
- description: Product type ID
- schema:
- type: string
- responses:
- '200':
- description: product type found
- content:
- application/json:
- example:
- id: pt_UkLWZg9DAJ
- name: Apparel
- option_type_labels: []
- schema:
- "$ref": "#/components/schemas/ProductType"
- "/api/v3/seller/products":
- get:
- summary: List products
- tags:
- - Products
- security:
- - bearer_auth: []
- description: |
- The seller's own catalog — the products they own outright.
-
- Every call is rooted in the acting seller server-side, so this can never
- return another seller's product or one the marketplace operator sells
- first-party.
- parameters:
- - name: X-Spree-Seller-Id
- in: header
- required: true
- 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 (max 100)
- schema:
- type: integer
- - name: sort
- in: query
- required: false
- description: Sort field; prefix with `-` for descending
- schema:
- type: string
- responses:
- '200':
- description: products listed
+ description: products listed
content:
application/json:
example:
data:
- id: prod_UkLWZg9DAJ
- name: Product 1523250
- slug: product-1523250
+ name: Product 1593250
+ slug: product-1593250
meta_title:
meta_description:
meta_keywords:
@@ -13784,8 +13175,8 @@ paths:
application/json:
example:
id: prod_UkLWZg9DAJ
- name: Product 1556710
- slug: product-1556710
+ name: Product 1626710
+ slug: product-1626710
meta_title:
meta_description:
meta_keywords:
@@ -13864,7 +13255,7 @@ paths:
example:
id: prod_UkLWZg9DAJ
name: Hand-thrown mug, large
- slug: product-1588212
+ slug: product-1658212
meta_title:
meta_description:
meta_keywords:
@@ -13977,8 +13368,8 @@ paths:
application/json:
example:
id: sel_UkLWZg9DAJ
- name: Seller 69
- slug: seller-69
+ name: Seller 73
+ slug: seller-73
about: ''
about_html: ''
logo_url:
@@ -14050,7 +13441,7 @@ paths:
example:
id: sel_UkLWZg9DAJ
name: Acme Supplies
- slug: seller-71
+ slug: seller-75
about: ''
about_html: ''
logo_url:
@@ -14207,7 +13598,6 @@ paths:
active: true
default: false
kind: warehouse
- returns_enabled: true
created_at: '2026-01-15T12:00:00.000Z'
updated_at: '2026-01-15T12:00:00.000Z'
meta:
@@ -14273,7 +13663,6 @@ paths:
active: true
default: false
kind: warehouse
- returns_enabled: true
created_at: '2026-01-15T12:00:00.000Z'
updated_at: '2026-01-15T12:00:00.000Z'
schema:
@@ -14389,7 +13778,6 @@ paths:
active: true
default: false
kind: warehouse
- returns_enabled: true
created_at: '2026-01-15T12:00:00.000Z'
updated_at: '2026-01-15T12:00:00.000Z'
schema:
@@ -14446,7 +13834,6 @@ paths:
active: true
default: false
kind: warehouse
- returns_enabled: true
created_at: '2026-01-15T12:00:00.000Z'
updated_at: '2026-01-15T12:00:00.000Z'
schema:
@@ -14486,17 +13873,507 @@ paths:
get:
summary: List pending invitations
tags:
- - Team
+ - Team
+ security:
+ - bearer_auth: []
+ description: |
+ Offers nobody has accepted yet, newest first.
+
+ Pending only — an accepted invitation is a team member, and shows up on
+ `GET /api/v3/seller/team` instead.
+
+ Sending an invitation lives on `team`, because that is hiring. Chasing or
+ withdrawing one is bookkeeping on the offer itself, so it lives here.
+ parameters:
+ - name: X-Spree-Seller-Id
+ in: header
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: invitations listed
+ content:
+ application/json:
+ example:
+ data:
+ - id: inv_UkLWZg9DAJ
+ created_at: '2026-01-15T12:00:00.000Z'
+ expires_at: '2026-01-29T12:00:00.000Z'
+ accepted_at:
+ status: pending
+ acceptance_url: "/accept-invitation/inv_UkLWZg9DAJ?token=gybGAXxVP79yKWNTZLAC94ui"
+ schema:
+ type: object
+ properties:
+ data:
+ type: array
+ items:
+ "$ref": "#/components/schemas/Invitation"
+ required:
+ - data
+ "/api/v3/seller/invitations/{id}/resend":
+ parameters:
+ - name: id
+ in: path
+ description: Invitation ID
+ required: true
+ schema:
+ type: string
+ patch:
+ summary: Resend an invitation
+ tags:
+ - Team
+ security:
+ - bearer_auth: []
+ description: |
+ Sends the invitation email again, for a colleague who never got the first
+ one. An invitation whose window has closed is refused rather than
+ re-sent.
+ parameters:
+ - name: X-Spree-Seller-Id
+ in: header
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: invitation resent
+ content:
+ application/json:
+ example:
+ id: inv_UkLWZg9DAJ
+ created_at: '2026-01-15T12:00:00.000Z'
+ expires_at: '2026-01-29T12:00:00.000Z'
+ accepted_at:
+ status: pending
+ acceptance_url: "/accept-invitation/inv_UkLWZg9DAJ?token=3uJFfKUSiHtnc9TGAXMJUXsB"
+ schema:
+ "$ref": "#/components/schemas/Invitation"
+ '404':
+ description: another seller's invitation
+ content:
+ application/json:
+ example:
+ error:
+ code: record_not_found
+ message: Invitation not found
+ schema:
+ "$ref": "#/components/schemas/ErrorResponse"
+ "/api/v3/seller/invitations/{id}":
+ parameters:
+ - name: id
+ in: path
+ description: Invitation ID
+ required: true
+ schema:
+ type: string
+ delete:
+ summary: Revoke an invitation
+ tags:
+ - Team
+ security:
+ - bearer_auth: []
+ description: Withdraws an offer that has not been accepted.
+ parameters:
+ - name: X-Spree-Seller-Id
+ in: header
+ required: true
+ schema:
+ type: string
+ responses:
+ '204':
+ description: invitation revoked
+ '404':
+ description: another seller's invitation
+ content:
+ application/json:
+ example:
+ error:
+ code: record_not_found
+ message: Invitation not found
+ schema:
+ "$ref": "#/components/schemas/ErrorResponse"
+ "/api/v3/seller/team":
+ get:
+ summary: List team members
+ tags:
+ - Team
+ security:
+ - bearer_auth: []
+ description: |
+ The people who run this seller.
+
+ Rooted at the acting seller throughout, so a seller only ever sees their
+ own team. Unpaginated — a seller's team is small by nature.
+ parameters:
+ - name: X-Spree-Seller-Id
+ in: header
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: team members listed
+ content:
+ application/json:
+ example:
+ data:
+ - id: adm_UkLWZg9DAJ
+ first_name: Bill
+ last_name: Towne
+ full_name: Bill Towne
+ created_at: '2026-01-15T12:00:00.000Z'
+ avatar_url:
+ schema:
+ type: object
+ properties:
+ data:
+ type: array
+ items:
+ "$ref": "#/components/schemas/TeamMember"
+ required:
+ - data
+ post:
+ summary: Invite a team member
+ tags:
+ - Team
+ security:
+ - bearer_auth: []
+ description: |
+ Invites a colleague onto this seller's team. They join when they accept,
+ on the same invitation rail — and the same email — the marketplace
+ operator's own invitations use.
+
+ Hiring is not a lifecycle transition: a trading seller's status is
+ untouched by taking someone on.
+
+ The role is not a parameter. Every member holds the seller's own seeded
+ role, which already carries the whole seller vocabulary.
+ parameters:
+ - name: X-Spree-Seller-Id
+ in: header
+ required: true
+ schema:
+ type: string
+ responses:
+ '201':
+ description: invitation sent
+ content:
+ application/json:
+ example:
+ id: inv_UkLWZg9DAJ
+ created_at: '2026-01-15T12:00:00.000Z'
+ expires_at: '2026-01-29T12:00:00.000Z'
+ accepted_at:
+ status: pending
+ acceptance_url: "/accept-invitation/inv_UkLWZg9DAJ?token=3K6BfBtHGFeQgToPE45qUDWE"
+ schema:
+ "$ref": "#/components/schemas/Invitation"
+ '422':
+ description: validation failed
+ content:
+ application/json:
+ example:
+ error:
+ code: validation_error
+ message: Email is invalid and Email can't be blank
+ details:
+ email:
+ - is invalid
+ - can't be blank
+ schema:
+ "$ref": "#/components/schemas/ErrorResponse"
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ email:
+ type: string
+ format: email
+ required:
+ - email
+ "/api/v3/seller/team/{id}":
+ parameters:
+ - name: id
+ in: path
+ description: Team member (user) ID
+ required: true
+ schema:
+ type: string
+ delete:
+ summary: Remove a team member
+ tags:
+ - Team
+ security:
+ - bearer_auth: []
+ description: |
+ Revokes a member's access, removing every role they hold on this seller.
+
+ The team can never reach zero: emptying it would leave a seller nobody
+ can sign in to, and only the marketplace operator could put someone back.
+ The last remaining member is refused with `422`.
+ parameters:
+ - name: X-Spree-Seller-Id
+ in: header
+ required: true
+ schema:
+ type: string
+ responses:
+ '204':
+ description: member removed
+ '422':
+ description: cannot remove the last remaining member
+ content:
+ application/json:
+ example:
+ error:
+ code: processing_error
+ message: A seller needs at least one team member. Invite someone
+ else before removing this one.
+ schema:
+ "$ref": "#/components/schemas/ErrorResponse"
+ '404':
+ description: not a member of this seller
+ content:
+ application/json:
+ example:
+ error:
+ code: record_not_found
+ message: Admin user not found
+ schema:
+ "$ref": "#/components/schemas/ErrorResponse"
+ "/api/v3/seller/direct_uploads":
+ post:
+ summary: Create a direct upload
+ tags:
+ - Uploads
+ security:
+ - bearer_auth: []
+ description: |
+ Presigns an upload target for a file the seller is about to send.
+
+ Three steps: post the file's metadata here, `PUT` the bytes to the
+ returned `direct_upload.url` with the headers it names, then send the
+ returned `signed_id` wherever the file belongs — as a requirement
+ submission's `file`, or as `logo`, `square_logo` or `cover_photo` on the
+ profile.
+
+ The blob is attached to nothing at this point. The endpoint that consumes
+ the `signed_id` is the one that checks ownership.
+
+ `checksum` is the file's MD5 digest, base64-encoded — the storage service
+ verifies the upload against it.
+ parameters:
+ - name: X-Spree-Seller-Id
+ in: header
+ required: true
+ schema:
+ type: string
+ responses:
+ '201':
+ description: upload target created
+ content:
+ application/json:
+ example:
+ direct_upload:
+ url: http://www.example.com/rails/active_storage/disk/eyJfcmFpbHMiOnsiZGF0YSI6eyJrZXkiOiJuem5oOGdra3VxendvbDc1ODBxNHNwZmpmMjVxIiwiY29udGVudF90eXBlIjoiYXBwbGljYXRpb24vcGRmIiwiY29udGVudF9sZW5ndGgiOjUxMjM0LCJjaGVja3N1bSI6IlZqaHowNGxRdUVHdXY0bkR2aHNhTlE9PSIsInNlcnZpY2VfbmFtZSI6InRlc3QifSwiZXhwIjoiMjAyNi0wMS0xNVQxMjowNTowMC4wMDBaIiwicHVyIjoiYmxvYl90b2tlbiJ9fQ==--b056044b1ff1b40c20f91b97529aa76b19bb3a28
+ headers:
+ Content-Type: application/pdf
+ signed_id: eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--9cb3e17a08ef383d43853a0decd2b0dc4780fff2
+ schema:
+ "$ref": "#/components/schemas/DirectUploadResponse"
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ blob:
+ type: object
+ properties:
+ filename:
+ type: string
+ example: registration.pdf
+ byte_size:
+ type: integer
+ example: 51234
+ checksum:
+ type: string
+ description: Base64-encoded MD5 digest of the file
+ example: rL0Y20zC+Fzt72VPzMSk2A==
+ content_type:
+ type: string
+ example: application/pdf
+ required:
+ - filename
+ - byte_size
+ - checksum
+ - content_type
+ required:
+ - blob
+ "/api/v3/seller/orders/{order_id}/claims":
+ parameters:
+ - name: order_id
+ in: path
+ description: Prefixed order ID
+ required: true
+ schema:
+ type: string
+ get:
+ summary: List claims
+ tags:
+ - Claims
+ security:
+ - bearer_auth: []
+ description: Problems reported on one of this seller's orders.
+ parameters:
+ - name: X-Spree-Seller-Id
+ in: header
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: claims listed
+ content:
+ application/json:
+ example:
+ data:
+ - id: claim_UkLWZg9DAJ
+ number: CLM1001
+ status: open
+ resolution:
+ order_id: or_UkLWZg9DAJ
+ reason_id:
+ refund_total: '0.0'
+ display_refund_total: "$0.00"
+ approved_at:
+ resolved_at:
+ denied_at:
+ canceled_at:
+ memo:
+ meta:
+ page: 1
+ limit: 25
+ count: 1
+ pages: 1
+ from: 1
+ to: 1
+ in: 1
+ previous:
+ next:
+ schema:
+ type: object
+ properties:
+ data:
+ type: array
+ items:
+ "$ref": "#/components/schemas/Claim"
+ required:
+ - data
+ post:
+ summary: Open a claim
+ tags:
+ - Claims
+ security:
+ - bearer_auth: []
+ description: |
+ Reports that something went wrong with a delivery, to be put right
+ without necessarily asking for the goods back.
+
+ A replacement variant, if one is offered, comes from this seller's own
+ catalogue — a rival's is not theirs to promise.
+ parameters:
+ - name: X-Spree-Seller-Id
+ in: header
+ required: true
+ schema:
+ type: string
+ responses:
+ '201':
+ description: claim opened
+ content:
+ application/json:
+ example:
+ id: claim_UkLWZg9DAJ
+ number: CLM1001
+ status: open
+ resolution:
+ order_id: or_UkLWZg9DAJ
+ reason_id:
+ refund_total: '0.0'
+ display_refund_total: "$0.00"
+ approved_at:
+ resolved_at:
+ denied_at:
+ canceled_at:
+ memo:
+ schema:
+ "$ref": "#/components/schemas/Claim"
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ items:
+ type: array
+ items:
+ type: object
+ properties:
+ line_item_id:
+ type: string
+ quantity:
+ type: integer
+ description:
+ type: string
+ nullable: true
+ send_replacement:
+ type: boolean
+ replacement_variant_id:
+ type: string
+ nullable: true
+ refund_amount:
+ type: string
+ nullable: true
+ required:
+ - line_item_id
+ - quantity
+ reason_id:
+ type: string
+ nullable: true
+ memo:
+ type: string
+ nullable: true
+ required:
+ - items
+ "/api/v3/seller/orders/{order_id}/claims/{id}/approve":
+ parameters:
+ - name: order_id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ patch:
+ summary: Approve a claim
+ tags:
+ - Claims
security:
- bearer_auth: []
- description: |
- Offers nobody has accepted yet, newest first.
-
- Pending only — an accepted invitation is a team member, and shows up on
- `GET /api/v3/seller/team` instead.
-
- Sending an invitation lives on `team`, because that is hiring. Chasing or
- withdrawing one is bookkeeping on the offer itself, so it lives here.
+ description: Accepts that the claim is good.
parameters:
- name: X-Spree-Seller-Id
in: header
@@ -14505,45 +14382,48 @@ paths:
type: string
responses:
'200':
- description: invitations listed
+ description: claim approved
content:
application/json:
example:
- data:
- - id: inv_UkLWZg9DAJ
- created_at: '2026-01-15T12:00:00.000Z'
- expires_at: '2026-01-29T12:00:00.000Z'
- accepted_at:
- status: pending
- acceptance_url: "/accept-invitation/inv_UkLWZg9DAJ?token=gybGAXxVP79yKWNTZLAC94ui"
+ id: claim_UkLWZg9DAJ
+ number: CLM1001
+ status: approved
+ resolution:
+ order_id: or_UkLWZg9DAJ
+ reason_id:
+ refund_total: '0.0'
+ display_refund_total: "$0.00"
+ approved_at: '2026-01-15T12:00:00Z'
+ resolved_at:
+ denied_at:
+ canceled_at:
+ memo:
schema:
- type: object
- properties:
- data:
- type: array
- items:
- "$ref": "#/components/schemas/Invitation"
- required:
- - data
- "/api/v3/seller/invitations/{id}/resend":
+ "$ref": "#/components/schemas/Claim"
+ "/api/v3/seller/orders/{order_id}/claims/{id}/resolve":
parameters:
+ - name: order_id
+ in: path
+ required: true
+ schema:
+ type: string
- name: id
in: path
- description: Invitation ID
required: true
schema:
type: string
patch:
- summary: Resend an invitation
+ summary: Resolve a claim
tags:
- - Team
+ - Claims
security:
- bearer_auth: []
description: |
- Sends the invitation email again, for a colleague who never got the first
- one. An invitation whose window has closed is refused rather than
- re-sent.
+ Puts the claim right: money back, a replacement shipment, or both.
+
+ A refund is bounded by this order's share of the payment, so one
+ seller can never settle out of a sibling's money.
parameters:
- name: X-Spree-Seller-Id
in: header
@@ -14552,44 +14432,70 @@ paths:
type: string
responses:
'200':
- description: invitation resent
- content:
- application/json:
- example:
- id: inv_UkLWZg9DAJ
- created_at: '2026-01-15T12:00:00.000Z'
- expires_at: '2026-01-29T12:00:00.000Z'
- accepted_at:
- status: pending
- acceptance_url: "/accept-invitation/inv_UkLWZg9DAJ?token=3uJFfKUSiHtnc9TGAXMJUXsB"
- schema:
- "$ref": "#/components/schemas/Invitation"
- '404':
- description: another seller's invitation
+ description: claim resolved
content:
application/json:
example:
- error:
- code: record_not_found
- message: Invitation not found
+ id: claim_UkLWZg9DAJ
+ number: CLM1001
+ status: resolved
+ resolution: refund
+ order_id: or_UkLWZg9DAJ
+ reason_id:
+ refund_total: '0.0'
+ display_refund_total: "$0.00"
+ approved_at: '2026-01-15T12:00:00Z'
+ resolved_at: '2026-01-15T12:00:00Z'
+ denied_at:
+ canceled_at:
+ memo:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
- "/api/v3/seller/invitations/{id}":
+ "$ref": "#/components/schemas/Claim"
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ resolution:
+ type: string
+ enum:
+ - refund
+ - replacement
+ - refund_and_replacement
+ refund_method:
+ type: string
+ enum:
+ - original_payment
+ - store_credit
+ amount:
+ type: string
+ nullable: true
+ replacement_line_item_ids:
+ type: array
+ items:
+ type: string
+ required:
+ - resolution
+ "/api/v3/seller/orders/{order_id}/claims/{id}/deny":
parameters:
+ - name: order_id
+ in: path
+ required: true
+ schema:
+ type: string
- name: id
in: path
- description: Invitation ID
required: true
schema:
type: string
- delete:
- summary: Revoke an invitation
+ patch:
+ summary: Deny a claim
tags:
- - Team
+ - Claims
security:
- bearer_auth: []
- description: Withdraws an offer that has not been accepted.
+ description: Turns the claim down.
parameters:
- name: X-Spree-Seller-Id
in: header
@@ -14597,30 +14503,37 @@ paths:
schema:
type: string
responses:
- '204':
- description: invitation revoked
- '404':
- description: another seller's invitation
+ '200':
+ description: claim denied
content:
application/json:
example:
- error:
- code: record_not_found
- message: Invitation not found
+ id: claim_UkLWZg9DAJ
+ number: CLM1001
+ status: denied
+ resolution:
+ order_id: or_UkLWZg9DAJ
+ reason_id:
+ refund_total: '0.0'
+ display_refund_total: "$0.00"
+ approved_at:
+ resolved_at:
+ denied_at: '2026-01-15T12:00:00Z'
+ canceled_at:
+ memo:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
- "/api/v3/seller/team":
+ "$ref": "#/components/schemas/Claim"
+ "/api/v3/seller/claim_reasons":
get:
- summary: List team members
+ summary: List claim reasons
tags:
- - Team
+ - Claims
security:
- bearer_auth: []
description: |
- The people who run this seller.
+ What can go wrong with a delivery, as the marketplace defines it.
- Rooted at the acting seller throughout, so a seller only ever sees their
- own team. Unpaginated — a seller's team is small by nature.
+ Read-only: a seller picks from the operator's vocabulary.
parameters:
- name: X-Spree-Seller-Id
in: header
@@ -14629,43 +14542,48 @@ paths:
type: string
responses:
'200':
- description: team members listed
+ description: reasons listed
content:
application/json:
example:
data:
- - id: adm_UkLWZg9DAJ
- first_name: Bill
- last_name: Towne
- full_name: Bill Towne
- created_at: '2026-01-15T12:00:00.000Z'
- avatar_url:
+ - id: clr_UkLWZg9DAJ
+ name: Arrived damaged
+ active: true
+ meta:
+ page: 1
+ limit: 25
+ count: 1
+ pages: 1
+ from: 1
+ to: 1
+ in: 1
+ previous:
+ next:
schema:
type: object
properties:
data:
type: array
items:
- "$ref": "#/components/schemas/TeamMember"
+ "$ref": "#/components/schemas/Reason"
required:
- data
- post:
- summary: Invite a team member
+ "/api/v3/seller/orders/{order_id}/exchanges":
+ parameters:
+ - name: order_id
+ in: path
+ description: Prefixed order ID
+ required: true
+ schema:
+ type: string
+ get:
+ summary: List exchanges
tags:
- - Team
+ - Exchanges
security:
- bearer_auth: []
- description: |
- Invites a colleague onto this seller's team. They join when they accept,
- on the same invitation rail — and the same email — the marketplace
- operator's own invitations use.
-
- Hiring is not a lifecycle transition: a trading seller's status is
- untouched by taking someone on.
-
- The role is not a parameter. Every member holds the seller's own seeded
- role, which already carries the whole seller vocabulary.
+ description: Goods swapped for different ones on one of this seller's orders.
parameters:
- name: X-Spree-Seller-Id
in: header
@@ -14673,66 +14591,56 @@ paths:
schema:
type: string
responses:
- '201':
- description: invitation sent
- content:
- application/json:
- example:
- id: inv_UkLWZg9DAJ
- created_at: '2026-01-15T12:00:00.000Z'
- expires_at: '2026-01-29T12:00:00.000Z'
- accepted_at:
- status: pending
- acceptance_url: "/accept-invitation/inv_UkLWZg9DAJ?token=3K6BfBtHGFeQgToPE45qUDWE"
- schema:
- "$ref": "#/components/schemas/Invitation"
- '422':
- description: validation failed
+ '200':
+ description: exchanges listed
content:
application/json:
example:
- error:
- code: validation_error
- message: Email is invalid and Email can't be blank
- details:
- email:
- - is invalid
- - can't be blank
+ data:
+ - id: exch_UkLWZg9DAJ
+ number: EX1001
+ status: requested
+ order_id: or_UkLWZg9DAJ
+ reason_id:
+ price_difference: '9.99'
+ display_price_difference: "$9.99"
+ approved_at:
+ received_at:
+ fulfilled_at:
+ canceled_at:
+ memo:
+ stock_location_id: sloc_UkLWZg9DAJ
+ meta:
+ page: 1
+ limit: 25
+ count: 1
+ pages: 1
+ from: 1
+ to: 1
+ in: 1
+ previous:
+ next:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
- requestBody:
- content:
- application/json:
- schema:
- type: object
- properties:
- email:
- type: string
- format: email
- required:
- - email
- "/api/v3/seller/team/{id}":
- parameters:
- - name: id
- in: path
- description: Team member (user) ID
- required: true
- schema:
- type: string
- delete:
- summary: Remove a team member
+ type: object
+ properties:
+ data:
+ type: array
+ items:
+ "$ref": "#/components/schemas/Exchange"
+ required:
+ - data
+ post:
+ summary: Open an exchange
tags:
- - Team
+ - Exchanges
security:
- bearer_auth: []
description: |
- Revokes a member's access, removing every role they hold on this seller.
+ Swaps goods for different ones.
- The team can never reach zero: emptying it would leave a seller nobody
- can sign in to, and only the marketplace operator could put someone back.
- The last remaining member is refused with `422`.
+ The replacement comes from this seller's own catalogue: it is stock
+ they will send, so a variant belonging to another seller is not theirs
+ to promise and reads as missing.
parameters:
- name: X-Spree-Seller-Id
in: header
@@ -14740,50 +14648,79 @@ paths:
schema:
type: string
responses:
- '204':
- description: member removed
- '422':
- description: cannot remove the last remaining member
- content:
- application/json:
- example:
- error:
- code: processing_error
- message: A seller needs at least one team member. Invite someone
- else before removing this one.
- schema:
- "$ref": "#/components/schemas/ErrorResponse"
- '404':
- description: not a member of this seller
+ '201':
+ description: exchange opened
content:
application/json:
example:
- error:
- code: record_not_found
- message: Admin user not found
+ id: exch_UkLWZg9DAJ
+ number: EX1001
+ status: requested
+ order_id: or_UkLWZg9DAJ
+ reason_id:
+ price_difference: '9.99'
+ display_price_difference: "$9.99"
+ approved_at:
+ received_at:
+ fulfilled_at:
+ canceled_at:
+ memo:
+ stock_location_id: sloc_UkLWZg9DAJ
schema:
- "$ref": "#/components/schemas/ErrorResponse"
- "/api/v3/seller/direct_uploads":
- post:
- summary: Create a direct upload
+ "$ref": "#/components/schemas/Exchange"
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ items:
+ type: array
+ items:
+ type: object
+ properties:
+ fulfillment_item_id:
+ type: string
+ new_variant_id:
+ type: string
+ quantity:
+ type: integer
+ required:
+ - fulfillment_item_id
+ - new_variant_id
+ - quantity
+ reason_id:
+ type: string
+ nullable: true
+ stock_location_id:
+ type: string
+ nullable: true
+ memo:
+ type: string
+ nullable: true
+ required:
+ - items
+ "/api/v3/seller/orders/{order_id}/exchanges/{id}/fulfill":
+ parameters:
+ - name: order_id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ patch:
+ summary: Send the replacement
tags:
- - Uploads
+ - Exchanges
security:
- bearer_auth: []
description: |
- Presigns an upload target for a file the seller is about to send.
-
- Three steps: post the file's metadata here, `PUT` the bytes to the
- returned `direct_upload.url` with the headers it names, then send the
- returned `signed_id` wherever the file belongs — as a requirement
- submission's `file`, or as `logo`, `square_logo` or `cover_photo` on the
- profile.
-
- The blob is attached to nothing at this point. The endpoint that consumes
- the `signed_id` is the one that checks ownership.
-
- `checksum` is the file's MD5 digest, base64-encoded — the storage service
- verifies the upload against it.
+ Sends the replacement goods, settling any price difference at the same
+ time — which is why it takes a refund method.
parameters:
- name: X-Spree-Seller-Id
in: header
@@ -14791,47 +14728,37 @@ paths:
schema:
type: string
responses:
- '201':
- description: upload target created
+ '200':
+ description: replacement sent
content:
application/json:
example:
- direct_upload:
- url: http://www.example.com/rails/active_storage/disk/eyJfcmFpbHMiOnsiZGF0YSI6eyJrZXkiOiJuem5oOGdra3VxendvbDc1ODBxNHNwZmpmMjVxIiwiY29udGVudF90eXBlIjoiYXBwbGljYXRpb24vcGRmIiwiY29udGVudF9sZW5ndGgiOjUxMjM0LCJjaGVja3N1bSI6IlZqaHowNGxRdUVHdXY0bkR2aHNhTlE9PSIsInNlcnZpY2VfbmFtZSI6InRlc3QifSwiZXhwIjoiMjAyNi0wMS0xNVQxMjowNTowMC4wMDBaIiwicHVyIjoiYmxvYl90b2tlbiJ9fQ==--b33be3bbd7c68338e1261455d7d9de2a4b5bcc08
- headers:
- Content-Type: application/pdf
- signed_id: eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--37ded779b38909aa9884ca2c10ae2835eb97e766
+ id: exch_UkLWZg9DAJ
+ number: EX1001
+ status: fulfilled
+ order_id: or_UkLWZg9DAJ
+ reason_id:
+ price_difference: '9.99'
+ display_price_difference: "$9.99"
+ approved_at: '2026-01-15T12:00:00Z'
+ received_at: '2026-01-15T12:00:00Z'
+ fulfilled_at: '2026-01-15T12:00:00Z'
+ canceled_at:
+ memo:
+ stock_location_id: sloc_UkLWZg9DAJ
schema:
- "$ref": "#/components/schemas/DirectUploadResponse"
+ "$ref": "#/components/schemas/Exchange"
requestBody:
content:
application/json:
schema:
type: object
properties:
- blob:
- type: object
- properties:
- filename:
- type: string
- example: registration.pdf
- byte_size:
- type: integer
- example: 51234
- checksum:
- type: string
- description: Base64-encoded MD5 digest of the file
- example: rL0Y20zC+Fzt72VPzMSk2A==
- content_type:
- type: string
- example: application/pdf
- required:
- - filename
- - byte_size
- - checksum
- - content_type
- required:
- - blob
+ refund_method:
+ type: string
+ enum:
+ - original_payment
+ - store_credit
"/api/v3/seller/exports":
post:
summary: Create an export
@@ -15052,8 +14979,9 @@ paths:
status: unfulfilled
tracking: U10000
tracking_url:
+ tracking_carrier:
+ tracking_status:
fulfilled_at:
- delivered_at:
created_at: '2026-01-15T12:00:00.000Z'
updated_at: '2026-01-15T12:00:00.000Z'
fulfillment_type: shipping
@@ -15063,23 +14991,10 @@ paths:
- id: fi_UkLWZg9DAJ
quantity: 1
line_item_id: li_UkLWZg9DAJ
- name: Product 1459315
- sku: SKU-184
+ variant_id: variant_UkLWZg9DAJ
+ name: Product 1489315
+ sku: SKU-190
options_text: ''
- deliveries:
- - id: dlv_UkLWZg9DAJ
- tracking_number: U10000
- carrier:
- carrier_name:
- service:
- status: pending
- tracking_url:
- estimated_delivery_at:
- delivered_at:
- created_at: '2026-01-15T12:00:00.000Z'
- updated_at: '2026-01-15T12:00:00.000Z'
- shipping_label_id:
- labels: []
schema:
type: object
properties:
@@ -15135,8 +15050,9 @@ paths:
status: fulfilled
tracking: TRACK-1
tracking_url:
+ tracking_carrier:
+ tracking_status:
fulfilled_at: '2026-01-15T12:00:00.000Z'
- delivered_at:
created_at: '2026-01-15T12:00:00.000Z'
updated_at: '2026-01-15T12:00:00.000Z'
fulfillment_type: shipping
@@ -15146,23 +15062,10 @@ paths:
- id: fi_UkLWZg9DAJ
quantity: 1
line_item_id: li_UkLWZg9DAJ
- name: Product 146961
- sku: SKU-185
+ variant_id: variant_UkLWZg9DAJ
+ name: Product 149961
+ sku: SKU-191
options_text: ''
- deliveries:
- - id: dlv_UkLWZg9DAJ
- tracking_number: TRACK-1
- carrier:
- carrier_name:
- service:
- status: pending
- tracking_url:
- estimated_delivery_at:
- delivered_at:
- created_at: '2026-01-15T12:00:00.000Z'
- updated_at: '2026-01-15T12:00:00.000Z'
- shipping_label_id:
- labels: []
schema:
"$ref": "#/components/schemas/Fulfillment"
requestBody:
@@ -15194,6 +15097,273 @@ paths:
required:
- item_id
- quantity
+ "/api/v3/seller/orders/{order_id}/fulfillments/{id}":
+ parameters:
+ - name: order_id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ patch:
+ summary: Update tracking
+ tags:
+ - Fulfillments
+ security:
+ - bearer_auth: []
+ description: |
+ Adds or corrects the tracking number and its carrier.
+
+ Deliberately narrow: where a parcel ships from and which service
+ carries it are the marketplace's arrangements, so they are not
+ editable here.
+ parameters:
+ - name: X-Spree-Seller-Id
+ in: header
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: tracking recorded
+ content:
+ application/json:
+ example:
+ id: ful_UkLWZg9DAJ
+ number: R1001-F1
+ status: unfulfilled
+ tracking: TRACK-2
+ tracking_url: https://www.ups.com/track?tracknum=TRACK-2
+ tracking_carrier: ups
+ tracking_status:
+ fulfilled_at:
+ created_at: '2026-01-15T12:00:00.000Z'
+ updated_at: '2026-01-15T12:00:00.000Z'
+ fulfillment_type: shipping
+ delivery_method_name: UPS Ground
+ stock_location_name: Eugena Schultz
+ fulfillment_items:
+ - id: fi_UkLWZg9DAJ
+ quantity: 1
+ line_item_id: li_UkLWZg9DAJ
+ variant_id: variant_UkLWZg9DAJ
+ name: Product 1503170
+ sku: SKU-192
+ options_text: ''
+ schema:
+ "$ref": "#/components/schemas/Fulfillment"
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ tracking:
+ type: string
+ nullable: true
+ tracking_carrier:
+ type: string
+ nullable: true
+ "/api/v3/seller/orders/{order_id}/fulfillments/{id}/cancel":
+ parameters:
+ - name: order_id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ patch:
+ summary: Cancel a parcel
+ tags:
+ - Fulfillments
+ security:
+ - bearer_auth: []
+ description: |
+ A parcel this seller is not going to send after all. The goods go back
+ on the shelf and the carrier is stood down.
+ parameters:
+ - name: X-Spree-Seller-Id
+ in: header
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: parcel canceled
+ content:
+ application/json:
+ example:
+ id: ful_UkLWZg9DAJ
+ number: R1001-F1
+ status: canceled
+ tracking: U10000
+ tracking_url:
+ tracking_carrier:
+ tracking_status:
+ fulfilled_at:
+ created_at: '2026-01-15T12:00:00.000Z'
+ updated_at: '2026-01-15T12:00:00.000Z'
+ fulfillment_type: shipping
+ delivery_method_name: UPS Ground
+ stock_location_name: Karyn Moore
+ fulfillment_items:
+ - id: fi_UkLWZg9DAJ
+ quantity: 1
+ line_item_id: li_UkLWZg9DAJ
+ variant_id: variant_UkLWZg9DAJ
+ name: Product 1517276
+ sku: SKU-193
+ options_text: ''
+ schema:
+ "$ref": "#/components/schemas/Fulfillment"
+ "/api/v3/seller/orders/{order_id}/fulfillments/{id}/mark_delivered":
+ parameters:
+ - name: order_id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ patch:
+ summary: Confirm delivery
+ tags:
+ - Fulfillments
+ security:
+ - bearer_auth: []
+ description: |
+ Confirms the customer received the goods — the point the returns
+ window runs from, and recordable by hand for a seller posting parcels
+ without a carrier integration.
+ parameters:
+ - name: X-Spree-Seller-Id
+ in: header
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: delivery confirmed
+ content:
+ application/json:
+ example:
+ id: ful_UkLWZg9DAJ
+ number: R1001-F1
+ status: delivered
+ tracking: U10000
+ tracking_url:
+ tracking_carrier:
+ tracking_status:
+ fulfilled_at: '2026-01-15T12:00:00.000Z'
+ created_at: '2026-01-15T12:00:00.000Z'
+ updated_at: '2026-01-15T12:00:00.000Z'
+ fulfillment_type: shipping
+ delivery_method_name: UPS Ground
+ stock_location_name: Jamila Cremin
+ fulfillment_items:
+ - id: fi_UkLWZg9DAJ
+ quantity: 1
+ line_item_id: li_UkLWZg9DAJ
+ variant_id: variant_UkLWZg9DAJ
+ name: Product 1524588
+ sku: SKU-194
+ options_text: ''
+ schema:
+ "$ref": "#/components/schemas/Fulfillment"
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ delivered_at:
+ type: string
+ nullable: true
+ notify_customer:
+ type: boolean
+ "/api/v3/seller/tracking_carriers":
+ get:
+ summary: List tracking carriers
+ tags:
+ - Fulfillments
+ security:
+ - bearer_auth: []
+ description: |
+ The carriers a tracking number can be pinned to, from the registry —
+ so a carrier an extension adds appears without a client change.
+ parameters:
+ - name: X-Spree-Seller-Id
+ in: header
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: carriers listed
+ content:
+ application/json:
+ example:
+ data:
+ - id: australia_post
+ name: Australia Post
+ - id: canada_post
+ name: Canada Post
+ - id: chronopost
+ name: Chronopost
+ - id: colissimo
+ name: Colissimo
+ - id: dhl
+ name: DHL Express
+ - id: dpd
+ name: DPD
+ - id: deutsche_post
+ name: Deutsche Post DHL
+ - id: evri
+ name: Evri
+ - id: fedex
+ name: FedEx
+ - id: gls
+ name: GLS
+ - id: inpost
+ name: InPost
+ - id: poczta_polska
+ name: Poczta Polska
+ - id: postnl
+ name: PostNL
+ - id: royal_mail
+ name: Royal Mail
+ - id: ups
+ name: UPS
+ - id: usps
+ name: USPS
+ schema:
+ type: object
+ properties:
+ data:
+ type: array
+ items:
+ type: object
+ properties:
+ id:
+ type: string
+ name:
+ type: string
+ required:
+ - id
+ - name
+ required:
+ - data
"/api/v3/seller/orders":
get:
summary: List orders
@@ -15261,7 +15431,7 @@ paths:
display_total: "$110.00"
items:
- id: li_UkLWZg9DAJ
- name: Product 14795
+ name: Product 15495
options_text: ''
quantity: 1
currency: USD
@@ -15270,7 +15440,7 @@ paths:
total: '10.0'
display_total: "$10.00"
variant_id: variant_UkLWZg9DAJ
- sku: SKU-186
+ sku: SKU-196
thumbnail_url:
fulfillments:
- id: ful_UkLWZg9DAJ
@@ -15278,8 +15448,9 @@ paths:
status: unfulfilled
tracking: U10000
tracking_url:
+ tracking_carrier:
+ tracking_status:
fulfilled_at:
- delivered_at:
created_at: '2026-01-15T12:00:00.000Z'
updated_at: '2026-01-15T12:00:00.000Z'
fulfillment_type: shipping
@@ -15289,30 +15460,17 @@ paths:
- id: fi_UkLWZg9DAJ
quantity: 1
line_item_id: li_UkLWZg9DAJ
- name: Product 14795
- sku: SKU-186
+ variant_id: variant_UkLWZg9DAJ
+ name: Product 15495
+ sku: SKU-196
options_text: ''
- deliveries:
- - id: dlv_UkLWZg9DAJ
- tracking_number: U10000
- carrier:
- carrier_name:
- service:
- status: pending
- tracking_url:
- estimated_delivery_at:
- delivered_at:
- created_at: '2026-01-15T12:00:00.000Z'
- updated_at: '2026-01-15T12:00:00.000Z'
- shipping_label_id:
- labels: []
shipping_address:
id: addr_gbHJdmfrXB
label:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 135 Lovely Street
+ address1: 143 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -15334,7 +15492,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 134 Lovely Street
+ address1: 142 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -15423,7 +15581,7 @@ paths:
display_total: "$110.00"
items:
- id: li_UkLWZg9DAJ
- name: Product 1489755
+ name: Product 1559755
options_text: ''
quantity: 1
currency: USD
@@ -15432,7 +15590,7 @@ paths:
total: '10.0'
display_total: "$10.00"
variant_id: variant_UkLWZg9DAJ
- sku: SKU-187
+ sku: SKU-197
thumbnail_url:
fulfillments:
- id: ful_UkLWZg9DAJ
@@ -15440,8 +15598,9 @@ paths:
status: unfulfilled
tracking: U10000
tracking_url:
+ tracking_carrier:
+ tracking_status:
fulfilled_at:
- delivered_at:
created_at: '2026-01-15T12:00:00.000Z'
updated_at: '2026-01-15T12:00:00.000Z'
fulfillment_type: shipping
@@ -15451,30 +15610,17 @@ paths:
- id: fi_UkLWZg9DAJ
quantity: 1
line_item_id: li_UkLWZg9DAJ
- name: Product 1489755
- sku: SKU-187
+ variant_id: variant_UkLWZg9DAJ
+ name: Product 1559755
+ sku: SKU-197
options_text: ''
- deliveries:
- - id: dlv_UkLWZg9DAJ
- tracking_number: U10000
- carrier:
- carrier_name:
- service:
- status: pending
- tracking_url:
- estimated_delivery_at:
- delivered_at:
- created_at: '2026-01-15T12:00:00.000Z'
- updated_at: '2026-01-15T12:00:00.000Z'
- shipping_label_id:
- labels: []
shipping_address:
id: addr_gbHJdmfrXB
label:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 137 Lovely Street
+ address1: 145 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -15496,7 +15642,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 136 Lovely Street
+ address1: 144 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -15574,7 +15720,7 @@ paths:
display_total: "$110.00"
items:
- id: li_UkLWZg9DAJ
- name: Product 1516554
+ name: Product 1586554
options_text: ''
quantity: 1
currency: USD
@@ -15583,7 +15729,7 @@ paths:
total: '10.0'
display_total: "$10.00"
variant_id: variant_UkLWZg9DAJ
- sku: SKU-190
+ sku: SKU-200
thumbnail_url:
fulfillments:
- id: ful_UkLWZg9DAJ
@@ -15591,8 +15737,9 @@ paths:
status: canceled
tracking: U10000
tracking_url:
+ tracking_carrier:
+ tracking_status:
fulfilled_at:
- delivered_at:
created_at: '2026-01-15T12:00:00.000Z'
updated_at: '2026-01-15T12:00:00.000Z'
fulfillment_type: shipping
@@ -15602,30 +15749,17 @@ paths:
- id: fi_UkLWZg9DAJ
quantity: 1
line_item_id: li_UkLWZg9DAJ
- name: Product 1516554
- sku: SKU-190
+ variant_id: variant_UkLWZg9DAJ
+ name: Product 1586554
+ sku: SKU-200
options_text: ''
- deliveries:
- - id: dlv_UkLWZg9DAJ
- tracking_number: U10000
- carrier:
- carrier_name:
- service:
- status: pending
- tracking_url:
- estimated_delivery_at:
- delivered_at:
- created_at: '2026-01-15T12:00:00.000Z'
- updated_at: '2026-01-15T12:00:00.000Z'
- shipping_label_id:
- labels: []
shipping_address:
id: addr_gbHJdmfrXB
label:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 143 Lovely Street
+ address1: 151 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -15647,7 +15781,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 142 Lovely Street
+ address1: 150 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -15664,16 +15798,458 @@ paths:
country_iso: US
state_name: New York
schema:
- "$ref": "#/components/schemas/Order"
- requestBody:
- content:
- application/json:
- schema:
- type: object
- properties:
- notify_customer:
- type: boolean
- description: Email the customer about the cancellation
+ "$ref": "#/components/schemas/Order"
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ notify_customer:
+ type: boolean
+ description: Email the customer about the cancellation
+ "/api/v3/seller/orders/{order_id}/returns":
+ parameters:
+ - name: order_id
+ in: path
+ description: Prefixed order ID
+ required: true
+ schema:
+ type: string
+ get:
+ summary: List returns
+ tags:
+ - Returns
+ security:
+ - bearer_auth: []
+ description: |
+ Goods coming back on one of this seller's orders.
+
+ Reached through the order, which is itself fetched through the acting
+ seller — so a return on somebody else's order is unreachable whatever
+ ids are sent.
+ parameters:
+ - name: X-Spree-Seller-Id
+ in: header
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: returns listed
+ content:
+ application/json:
+ example:
+ data:
+ - id: ret_UkLWZg9DAJ
+ number: RET1001
+ status: requested
+ order_id: or_UkLWZg9DAJ
+ reason_id:
+ refund_total: '10.0'
+ display_refund_total: "$10.00"
+ approved_at:
+ received_at:
+ refunded_at:
+ canceled_at:
+ memo:
+ stock_location_id: sloc_UkLWZg9DAJ
+ refunded_total: '0.0'
+ refundable_total: '10.0'
+ display_refunded_total: "$0.00"
+ meta:
+ page: 1
+ limit: 25
+ count: 1
+ pages: 1
+ from: 1
+ to: 1
+ in: 1
+ previous:
+ next:
+ schema:
+ type: object
+ properties:
+ data:
+ type: array
+ items:
+ "$ref": "#/components/schemas/Return"
+ required:
+ - data
+ post:
+ summary: Open a return
+ tags:
+ - Returns
+ security:
+ - bearer_auth: []
+ description: |
+ Takes goods back on one of this seller's orders.
+
+ The units are addressed by fulfillment item and resolved through the
+ order, so only what this seller actually shipped can come back. An
+ optional stock location says which of the seller's own shelves it
+ returns to.
+ parameters:
+ - name: X-Spree-Seller-Id
+ in: header
+ required: true
+ schema:
+ type: string
+ responses:
+ '201':
+ description: return opened
+ content:
+ application/json:
+ example:
+ id: ret_UkLWZg9DAJ
+ number: RET1001
+ status: requested
+ order_id: or_UkLWZg9DAJ
+ reason_id:
+ refund_total: '10.0'
+ display_refund_total: "$10.00"
+ approved_at:
+ received_at:
+ refunded_at:
+ canceled_at:
+ memo:
+ stock_location_id: sloc_UkLWZg9DAJ
+ refunded_total: '0.0'
+ refundable_total: '10.0'
+ display_refunded_total: "$0.00"
+ schema:
+ "$ref": "#/components/schemas/Return"
+ '422':
+ description: more than was shipped
+ content:
+ application/json:
+ example:
+ error:
+ code: processing_error
+ message: Only 1 of Product 1697120 can be returned
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ items:
+ type: array
+ items:
+ type: object
+ properties:
+ fulfillment_item_id:
+ type: string
+ quantity:
+ type: integer
+ required:
+ - fulfillment_item_id
+ - quantity
+ reason_id:
+ type: string
+ nullable: true
+ stock_location_id:
+ type: string
+ nullable: true
+ memo:
+ type: string
+ nullable: true
+ required:
+ - items
+ "/api/v3/seller/orders/{order_id}/returns/{id}/approve":
+ parameters:
+ - name: order_id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ patch:
+ summary: Approve a return
+ tags:
+ - Returns
+ security:
+ - bearer_auth: []
+ description: Agrees the goods may come back.
+ parameters:
+ - name: X-Spree-Seller-Id
+ in: header
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: return approved
+ content:
+ application/json:
+ example:
+ id: ret_UkLWZg9DAJ
+ number: RET1001
+ status: approved
+ order_id: or_UkLWZg9DAJ
+ reason_id:
+ refund_total: '10.0'
+ display_refund_total: "$10.00"
+ approved_at: '2026-01-15T12:00:00Z'
+ received_at:
+ refunded_at:
+ canceled_at:
+ memo:
+ stock_location_id: sloc_UkLWZg9DAJ
+ refunded_total: '0.0'
+ refundable_total: '10.0'
+ display_refunded_total: "$0.00"
+ schema:
+ "$ref": "#/components/schemas/Return"
+ "/api/v3/seller/orders/{order_id}/returns/{id}/receive":
+ parameters:
+ - name: order_id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ patch:
+ summary: Receive a return
+ tags:
+ - Returns
+ security:
+ - bearer_auth: []
+ description: |
+ Records what actually arrived, and whether it can be sold again.
+
+ Omitting `items` receives everything as requested and resellable.
+ parameters:
+ - name: X-Spree-Seller-Id
+ in: header
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: return received
+ content:
+ application/json:
+ example:
+ id: ret_UkLWZg9DAJ
+ number: RET1001
+ status: received
+ order_id: or_UkLWZg9DAJ
+ reason_id:
+ refund_total: '10.0'
+ display_refund_total: "$10.00"
+ approved_at: '2026-01-15T12:00:00Z'
+ received_at: '2026-01-15T12:00:00Z'
+ refunded_at:
+ canceled_at:
+ memo:
+ stock_location_id: sloc_UkLWZg9DAJ
+ refunded_total: '0.0'
+ refundable_total: '10.0'
+ display_refunded_total: "$0.00"
+ schema:
+ "$ref": "#/components/schemas/Return"
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ items:
+ type: array
+ items:
+ type: object
+ properties:
+ return_line_item_id:
+ type: string
+ quantity:
+ type: integer
+ resellable:
+ type: boolean
+ required:
+ - return_line_item_id
+ - quantity
+ "/api/v3/seller/orders/{order_id}/returns/{id}/refund":
+ parameters:
+ - name: order_id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ patch:
+ summary: Refund a return
+ tags:
+ - Returns
+ security:
+ - bearer_auth: []
+ description: |
+ Gives the customer their money back.
+
+ The seller is merchant of record for their own child order, so this is
+ theirs to do. The amount is bounded by what the return is owed and, on
+ a basket split between sellers, by this order's share of the payment —
+ never a sibling's.
+ parameters:
+ - name: X-Spree-Seller-Id
+ in: header
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: return refunded
+ content:
+ application/json:
+ example:
+ id: ret_UkLWZg9DAJ
+ number: RET1001
+ status: refunded
+ order_id: or_UkLWZg9DAJ
+ reason_id:
+ refund_total: '10.0'
+ display_refund_total: "$10.00"
+ approved_at: '2026-01-15T12:00:00Z'
+ received_at: '2026-01-15T12:00:00Z'
+ refunded_at: '2026-01-15T12:00:00Z'
+ canceled_at:
+ memo:
+ stock_location_id: sloc_UkLWZg9DAJ
+ refunded_total: '10.0'
+ refundable_total: '0.0'
+ display_refunded_total: "$10.00"
+ schema:
+ "$ref": "#/components/schemas/Return"
+ '422':
+ description: more than the return is owed
+ content:
+ application/json:
+ example:
+ error:
+ code: processing_error
+ message: refund_exceeds_balance
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ amount:
+ type: string
+ nullable: true
+ refund_method:
+ type: string
+ enum:
+ - original_payment
+ - store_credit
+ "/api/v3/seller/orders/{order_id}/returns/{id}/cancel":
+ parameters:
+ - name: order_id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ patch:
+ summary: Cancel a return
+ tags:
+ - Returns
+ security:
+ - bearer_auth: []
+ description: Calls the return off.
+ parameters:
+ - name: X-Spree-Seller-Id
+ in: header
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: return canceled
+ content:
+ application/json:
+ example:
+ id: ret_UkLWZg9DAJ
+ number: RET1001
+ status: canceled
+ order_id: or_UkLWZg9DAJ
+ reason_id:
+ refund_total: '10.0'
+ display_refund_total: "$10.00"
+ approved_at:
+ received_at:
+ refunded_at:
+ canceled_at: '2026-01-15T12:00:00Z'
+ memo:
+ stock_location_id: sloc_UkLWZg9DAJ
+ refunded_total: '0.0'
+ refundable_total: '10.0'
+ display_refunded_total: "$0.00"
+ schema:
+ "$ref": "#/components/schemas/Return"
+ "/api/v3/seller/return_reasons":
+ get:
+ summary: List return reasons
+ tags:
+ - Returns
+ security:
+ - bearer_auth: []
+ description: |
+ Why goods come back, as the marketplace defines it.
+
+ Read-only: the vocabulary is the operator's, and a seller picks from
+ it. Retired reasons are left out.
+ parameters:
+ - name: X-Spree-Seller-Id
+ in: header
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: reasons listed
+ content:
+ application/json:
+ example:
+ data:
+ - id: rar_UkLWZg9DAJ
+ name: Damaged in transit
+ active: true
+ meta:
+ page: 1
+ limit: 25
+ count: 1
+ pages: 1
+ from: 1
+ to: 1
+ in: 1
+ previous:
+ next:
+ schema:
+ type: object
+ properties:
+ data:
+ type: array
+ items:
+ "$ref": "#/components/schemas/Reason"
+ required:
+ - data
"/api/v3/seller/tax_identifiers":
get:
summary: List tax registrations
@@ -15882,15 +16458,9 @@ tags:
do
- name: Countries
description: Country and state reference data for the panel's address forms
-- name: Delivery Methods
- description: The seller's own ways to ship, and the marketplace methods shared with
- them
- name: Delivery Profiles
description: The marketplace's delivery vocabulary — what kind of goods a product
is, which decides how it ships
-- name: Delivery Zones
- description: The marketplace's destinations, for narrowing where a seller's own
- method ships
- name: Onboarding
description: The marketplace checklist a seller completes before admission, and
what they submit against it
@@ -16717,104 +17287,104 @@ components:
- display_compare_at_amount
- price_list_id
x-typelizer: true
- DeliveryMethodRule:
+ ClaimLineItem:
type: object
properties:
id:
type: string
- active:
+ quantity:
+ type: number
+ send_replacement:
type: boolean
- type:
+ description:
type: string
- name:
+ nullable: true
+ refund_amount:
type: string
- description:
+ paid_amount:
type: string
- preferences:
- type: object
- preference_schema:
- type: object
+ 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"
required:
- id
- - active
- - type
- - name
+ - quantity
+ - send_replacement
- description
- - preferences
- - preference_schema
+ - refund_amount
+ - paid_amount
+ - display_refund_amount
+ - variant_id
+ - replacement_variant_id
+ - line_item_id
x-typelizer: true
- DeliveryMethod:
+ Claim:
type: object
properties:
id:
type: string
- name:
+ number:
type: string
- code:
+ status:
+ type: string
+ resolution:
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:
+ order_id:
type: string
nullable: true
- storefront_visible:
- type: boolean
- tracking_url:
+ reason_id:
type: string
nullable: true
- created_at:
+ refund_total:
type: string
- updated_at:
+ display_refund_total:
type: string
- rules:
- type: array
- items:
- "$ref": "#/components/schemas/DeliveryMethodRule"
- editable:
- type: boolean
- delivery_profile_id:
+ approved_at:
type: string
nullable: true
- delivery_zone_id:
+ resolved_at:
type: string
nullable: true
- calculator_type:
+ denied_at:
type: string
nullable: true
- calculator_preferences:
- type: object
+ canceled_at:
+ type: string
+ nullable: true
+ reason:
+ "$ref": "#/components/schemas/Reason"
+ claim_line_items:
+ type: array
+ items:
+ "$ref": "#/components/schemas/ClaimLineItem"
+ memo:
+ type: string
nullable: true
required:
- id
- - name
- - code
- - estimated_transit_business_days_min
- - estimated_transit_business_days_max
- - digital
- - pickup
- - pickup_point
- - admin_name
- - storefront_visible
- - tracking_url
- - created_at
- - updated_at
- - rules
- - editable
- - delivery_profile_id
- - delivery_zone_id
- - calculator_type
- - calculator_preferences
+ - number
+ - status
+ - resolution
+ - order_id
+ - reason_id
+ - refund_total
+ - display_refund_total
+ - approved_at
+ - resolved_at
+ - denied_at
+ - canceled_at
+ - memo
x-typelizer: true
DeliveryProfile:
type: object
@@ -16825,79 +17395,114 @@ components:
type: string
default:
type: boolean
- digital:
- type: boolean
required:
- id
- name
- default
- - digital
x-typelizer: true
- Delivery:
+ ExchangeLineItem:
type: object
properties:
id:
type: string
- tracking_number:
+ 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
- carrier:
+ nullable: true
+ new_variant_id:
type: string
nullable: true
- carrier_name:
+ line_item_id:
type: string
nullable: true
- service:
+ fulfillment_item_id:
type: string
nullable: true
+ original_variant:
+ "$ref": "#/components/schemas/Variant"
+ new_variant:
+ "$ref": "#/components/schemas/Variant"
+ 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
+ x-typelizer: true
+ Exchange:
+ type: object
+ properties:
+ id:
+ type: string
+ number:
+ type: string
status:
type: string
- tracking_url:
+ order_id:
type: string
nullable: true
- estimated_delivery_at:
+ reason_id:
type: string
nullable: true
- delivered_at:
+ price_difference:
type: string
- nullable: true
- created_at:
+ display_price_difference:
type: string
- updated_at:
+ approved_at:
type: string
- shipping_label_id:
+ nullable: true
+ received_at:
type: string
nullable: true
- required:
- - id
- - tracking_number
- - carrier
- - carrier_name
- - service
- - status
- - tracking_url
- - estimated_delivery_at
- - delivered_at
- - created_at
- - updated_at
- - shipping_label_id
- x-typelizer: true
- DeliveryZone:
- type: object
- properties:
- id:
+ fulfilled_at:
type: string
- name:
+ nullable: true
+ canceled_at:
type: string
- description:
+ nullable: true
+ reason:
+ "$ref": "#/components/schemas/Reason"
+ exchange_line_items:
+ type: array
+ items:
+ "$ref": "#/components/schemas/ExchangeLineItem"
+ memo:
type: string
nullable: true
- delivery_profile_id:
+ stock_location_id:
type: string
+ nullable: true
required:
- id
- - name
- - description
- - delivery_profile_id
+ - number
+ - status
+ - order_id
+ - reason_id
+ - price_difference
+ - display_price_difference
+ - approved_at
+ - received_at
+ - fulfilled_at
+ - canceled_at
+ - memo
+ - stock_location_id
x-typelizer: true
Export:
type: object
@@ -16953,6 +17558,9 @@ components:
line_item_id:
type: string
nullable: true
+ variant_id:
+ type: string
+ nullable: true
name:
type: string
nullable: true
@@ -16966,6 +17574,7 @@ components:
- id
- quantity
- line_item_id
+ - variant_id
- name
- sku
- options_text
@@ -16985,10 +17594,13 @@ components:
tracking_url:
type: string
nullable: true
- fulfilled_at:
+ tracking_carrier:
+ type: string
+ nullable: true
+ tracking_status:
type: string
nullable: true
- delivered_at:
+ fulfilled_at:
type: string
nullable: true
created_at:
@@ -17008,30 +17620,21 @@ components:
type: array
items:
"$ref": "#/components/schemas/FulfillmentItem"
- deliveries:
- type: array
- items:
- "$ref": "#/components/schemas/Delivery"
- labels:
- type: array
- items:
- "$ref": "#/components/schemas/ShippingLabel"
required:
- id
- number
- status
- tracking
- tracking_url
+ - tracking_carrier
+ - tracking_status
- fulfilled_at
- - delivered_at
- created_at
- updated_at
- fulfillment_type
- delivery_method_name
- stock_location_name
- fulfillment_items
- - deliveries
- - labels
x-typelizer: true
ImportMapping:
type: object
@@ -17740,6 +18343,20 @@ components:
- supported_currencies
- products_count
x-typelizer: true
+ Reason:
+ type: object
+ properties:
+ id:
+ type: string
+ name:
+ type: string
+ active:
+ type: boolean
+ required:
+ - id
+ - name
+ - active
+ x-typelizer: true
RequirementCustomField:
type: object
properties:
@@ -17867,83 +18484,109 @@ components:
- file_url
- file_name
x-typelizer: true
- ShippingLabel:
+ ReturnLineItem:
type: object
properties:
id:
type: string
- source:
+ quantity:
+ type: number
+ received_quantity:
+ type: number
+ resellable:
+ type: boolean
+ pre_tax_amount:
type: string
- status:
+ display_pre_tax_amount:
type: string
- carrier:
+ variant_id:
type: string
nullable: true
- carrier_name:
+ line_item_id:
type: string
nullable: true
- service:
+ fulfillment_item_id:
type: string
nullable: true
- tracking_number:
+ variant:
+ "$ref": "#/components/schemas/Variant"
+ required:
+ - id
+ - quantity
+ - received_quantity
+ - resellable
+ - pre_tax_amount
+ - display_pre_tax_amount
+ - variant_id
+ - line_item_id
+ - fulfillment_item_id
+ x-typelizer: true
+ Return:
+ type: object
+ properties:
+ id:
type: string
- nullable: true
- currency:
+ number:
type: string
- nullable: true
- format:
+ status:
type: string
- nullable: true
- external_id:
+ order_id:
type: string
nullable: true
- metadata:
- type: object
- refunded_at:
+ reason_id:
type: string
nullable: true
- created_at:
+ refund_total:
type: string
- updated_at:
+ display_refund_total:
type: string
- owner_id:
+ approved_at:
type: string
- owner_type:
+ nullable: true
+ received_at:
type: string
- cost:
+ nullable: true
+ refunded_at:
type: string
- display_cost:
+ nullable: true
+ canceled_at:
type: string
- integration_id:
+ nullable: true
+ reason:
+ "$ref": "#/components/schemas/Reason"
+ return_line_items:
+ type: array
+ items:
+ "$ref": "#/components/schemas/ReturnLineItem"
+ memo:
type: string
nullable: true
- file_pending:
- type: boolean
- download_url:
+ stock_location_id:
type: string
nullable: true
+ refunded_total:
+ type: string
+ refundable_total:
+ type: string
+ display_refunded_total:
+ type: string
required:
- id
- - source
+ - number
- status
- - carrier
- - carrier_name
- - service
- - tracking_number
- - currency
- - format
- - external_id
- - metadata
+ - order_id
+ - reason_id
+ - refund_total
+ - display_refund_total
+ - approved_at
+ - received_at
- refunded_at
- - created_at
- - updated_at
- - owner_id
- - owner_type
- - cost
- - display_cost
- - integration_id
- - file_pending
- - download_url
+ - canceled_at
+ - memo
+ - stock_location_id
+ - refunded_total
+ - refundable_total
+ - display_refunded_total
x-typelizer: true
StockLevel:
type: object
@@ -18033,8 +18676,6 @@ components:
type: boolean
kind:
type: string
- returns_enabled:
- type: boolean
created_at:
type: string
updated_at:
@@ -18058,7 +18699,6 @@ components:
- active
- default
- kind
- - returns_enabled
- created_at
- updated_at
x-typelizer: true
diff --git a/spree/api/app/controllers/spree/api/v3/seller/orders/exchanges_controller.rb b/spree/api/app/controllers/spree/api/v3/seller/orders/exchanges_controller.rb
index fbf4236aa6..e322c85416 100644
--- a/spree/api/app/controllers/spree/api/v3/seller/orders/exchanges_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/seller/orders/exchanges_controller.rb
@@ -88,7 +88,7 @@ module Spree
end
def collection_includes
- [:reason, :stock_location, { exchange_line_items: [:variant, :new_variant, :line_item] }]
+ [:reason, :stock_location, { exchange_line_items: [:original_variant, :new_variant, :line_item] }]
end
private
diff --git a/spree/api/spec/integration/spree/api/v3/seller/claims_spec.rb b/spree/api/spec/integration/spree/api/v3/seller/claims_spec.rb
new file mode 100644
index 0000000000..bb4c51d0f5
--- /dev/null
+++ b/spree/api/spec/integration/spree/api/v3/seller/claims_spec.rb
@@ -0,0 +1,227 @@
+# frozen_string_literal: true
+
+require 'swagger_helper'
+
+RSpec.describe 'Seller Claims API', type: :request, swagger_doc: 'api-reference/seller.yaml' do
+ include_context 'API v3 Seller'
+
+ let(:seller_user) do
+ create(:admin_user, :without_admin_role).tap { |user| seller.add_user(user) }
+ end
+
+ let!(:order) { create(:shipped_order, store: store, seller: seller, line_items_count: 1) }
+ let(:line_item) { order.line_items.first }
+
+ let(:claim) do
+ Spree::Claims::Create.call(order: order, items: [{ line_item: line_item, quantity: 1 }]).value
+ end
+
+ path '/api/v3/seller/orders/{order_id}/claims' do
+ parameter name: :order_id, in: :path, type: :string, description: 'Prefixed order ID'
+
+ get 'List claims' do
+ tags 'Claims'
+ produces 'application/json'
+ security [bearer_auth: []]
+ description "Problems reported on one of this seller's orders."
+
+ parameter name: 'X-Spree-Seller-Id', in: :header, type: :string, required: true
+
+ response '200', 'claims listed' do
+ let(:Authorization) { "Bearer #{seller_jwt_token}" }
+ let(:'X-Spree-Seller-Id') { seller.prefixed_id }
+ let(:order_id) { order.prefixed_id }
+
+ before { claim }
+
+ schema type: :object,
+ properties: {
+ data: { type: :array, items: { '$ref' => '#/components/schemas/Claim' } }
+ },
+ required: %w[data]
+
+ run_test!
+ end
+ end
+
+ post 'Open a claim' do
+ tags 'Claims'
+ consumes 'application/json'
+ produces 'application/json'
+ security [bearer_auth: []]
+ description <<~DESC
+ Reports that something went wrong with a delivery, to be put right
+ without necessarily asking for the goods back.
+
+ A replacement variant, if one is offered, comes from this seller's own
+ catalogue — a rival's is not theirs to promise.
+ DESC
+
+ parameter name: 'X-Spree-Seller-Id', in: :header, type: :string, required: true
+ parameter name: :body, in: :body, schema: {
+ type: :object,
+ properties: {
+ items: {
+ type: :array,
+ items: {
+ type: :object,
+ properties: {
+ line_item_id: { type: :string },
+ quantity: { type: :integer },
+ description: { type: :string, nullable: true },
+ send_replacement: { type: :boolean },
+ replacement_variant_id: { type: :string, nullable: true },
+ refund_amount: { type: :string, nullable: true }
+ },
+ required: %w[line_item_id quantity]
+ }
+ },
+ reason_id: { type: :string, nullable: true },
+ memo: { type: :string, nullable: true }
+ },
+ required: %w[items]
+ }
+
+ response '201', 'claim opened' do
+ let(:Authorization) { "Bearer #{seller_jwt_token}" }
+ let(:'X-Spree-Seller-Id') { seller.prefixed_id }
+ let(:order_id) { order.prefixed_id }
+ let(:body) do
+ {
+ items: [
+ { line_item_id: line_item.prefixed_id, quantity: 1, description: 'Arrived broken' }
+ ]
+ }
+ end
+
+ schema '$ref' => '#/components/schemas/Claim'
+
+ run_test!
+ end
+ end
+ end
+
+ path '/api/v3/seller/orders/{order_id}/claims/{id}/approve' do
+ parameter name: :order_id, in: :path, type: :string
+ parameter name: :id, in: :path, type: :string
+
+ patch 'Approve a claim' do
+ tags 'Claims'
+ produces 'application/json'
+ security [bearer_auth: []]
+ description 'Accepts that the claim is good.'
+
+ parameter name: 'X-Spree-Seller-Id', in: :header, type: :string, required: true
+
+ response '200', 'claim approved' do
+ let(:Authorization) { "Bearer #{seller_jwt_token}" }
+ let(:'X-Spree-Seller-Id') { seller.prefixed_id }
+ let(:order_id) { order.prefixed_id }
+ let(:id) { claim.prefixed_id }
+
+ schema '$ref' => '#/components/schemas/Claim'
+
+ run_test!
+ end
+ end
+ end
+
+ path '/api/v3/seller/orders/{order_id}/claims/{id}/resolve' do
+ parameter name: :order_id, in: :path, type: :string
+ parameter name: :id, in: :path, type: :string
+
+ patch 'Resolve a claim' do
+ tags 'Claims'
+ consumes 'application/json'
+ produces 'application/json'
+ security [bearer_auth: []]
+ description <<~DESC
+ Puts the claim right: money back, a replacement shipment, or both.
+
+ A refund is bounded by this order's share of the payment, so one
+ seller can never settle out of a sibling's money.
+ DESC
+
+ parameter name: 'X-Spree-Seller-Id', in: :header, type: :string, required: true
+ parameter name: :body, in: :body, schema: {
+ type: :object,
+ properties: {
+ resolution: { type: :string, enum: %w[refund replacement refund_and_replacement] },
+ refund_method: { type: :string, enum: %w[original_payment store_credit] },
+ amount: { type: :string, nullable: true },
+ replacement_line_item_ids: { type: :array, items: { type: :string } }
+ },
+ required: %w[resolution]
+ }
+
+ response '200', 'claim resolved' do
+ let(:Authorization) { "Bearer #{seller_jwt_token}" }
+ let(:'X-Spree-Seller-Id') { seller.prefixed_id }
+ let(:order_id) { order.prefixed_id }
+ let(:id) { claim.prefixed_id }
+ let(:body) { { resolution: 'refund', refund_method: 'store_credit', amount: '5.0' } }
+
+ before { Spree::Claims::Approve.call(claim: claim) }
+
+ schema '$ref' => '#/components/schemas/Claim'
+
+ run_test!
+ end
+ end
+ end
+
+ path '/api/v3/seller/orders/{order_id}/claims/{id}/deny' do
+ parameter name: :order_id, in: :path, type: :string
+ parameter name: :id, in: :path, type: :string
+
+ patch 'Deny a claim' do
+ tags 'Claims'
+ produces 'application/json'
+ security [bearer_auth: []]
+ description 'Turns the claim down.'
+
+ parameter name: 'X-Spree-Seller-Id', in: :header, type: :string, required: true
+
+ response '200', 'claim denied' do
+ let(:Authorization) { "Bearer #{seller_jwt_token}" }
+ let(:'X-Spree-Seller-Id') { seller.prefixed_id }
+ let(:order_id) { order.prefixed_id }
+ let(:id) { claim.prefixed_id }
+
+ schema '$ref' => '#/components/schemas/Claim'
+
+ run_test!
+ end
+ end
+ end
+
+ path '/api/v3/seller/claim_reasons' do
+ get 'List claim reasons' do
+ tags 'Claims'
+ produces 'application/json'
+ security [bearer_auth: []]
+ description <<~DESC
+ What can go wrong with a delivery, as the marketplace defines it.
+
+ Read-only: a seller picks from the operator's vocabulary.
+ DESC
+
+ parameter name: 'X-Spree-Seller-Id', in: :header, type: :string, required: true
+
+ response '200', 'reasons listed' do
+ let(:Authorization) { "Bearer #{seller_jwt_token}" }
+ let(:'X-Spree-Seller-Id') { seller.prefixed_id }
+
+ before { create(:claim_reason, store: store, name: 'Arrived damaged') }
+
+ schema type: :object,
+ properties: {
+ data: { type: :array, items: { '$ref' => '#/components/schemas/Reason' } }
+ },
+ required: %w[data]
+
+ run_test!
+ end
+ end
+ end
+end
diff --git a/spree/api/spec/integration/spree/api/v3/seller/exchanges_spec.rb b/spree/api/spec/integration/spree/api/v3/seller/exchanges_spec.rb
new file mode 100644
index 0000000000..396a2189c2
--- /dev/null
+++ b/spree/api/spec/integration/spree/api/v3/seller/exchanges_spec.rb
@@ -0,0 +1,148 @@
+# frozen_string_literal: true
+
+require 'swagger_helper'
+
+RSpec.describe 'Seller Exchanges API', type: :request, swagger_doc: 'api-reference/seller.yaml' do
+ include_context 'API v3 Seller'
+
+ let(:seller_user) do
+ create(:admin_user, :without_admin_role).tap { |user| seller.add_user(user) }
+ end
+
+ let!(:order) { create(:shipped_order, store: store, seller: seller, line_items_count: 1) }
+ let(:fulfillment_item) { order.fulfillment_items.first }
+ let(:replacement) { create(:variant, seller: seller) }
+
+ let(:exchange) do
+ Spree::Exchanges::Create.call(
+ order: order,
+ items: [{ fulfillment_item: fulfillment_item, new_variant: replacement, quantity: 1 }]
+ ).value
+ end
+
+ path '/api/v3/seller/orders/{order_id}/exchanges' do
+ parameter name: :order_id, in: :path, type: :string, description: 'Prefixed order ID'
+
+ get 'List exchanges' do
+ tags 'Exchanges'
+ produces 'application/json'
+ security [bearer_auth: []]
+ description "Goods swapped for different ones on one of this seller's orders."
+
+ parameter name: 'X-Spree-Seller-Id', in: :header, type: :string, required: true
+
+ response '200', 'exchanges listed' do
+ let(:Authorization) { "Bearer #{seller_jwt_token}" }
+ let(:'X-Spree-Seller-Id') { seller.prefixed_id }
+ let(:order_id) { order.prefixed_id }
+
+ before { exchange }
+
+ schema type: :object,
+ properties: {
+ data: { type: :array, items: { '$ref' => '#/components/schemas/Exchange' } }
+ },
+ required: %w[data]
+
+ run_test!
+ end
+ end
+
+ post 'Open an exchange' do
+ tags 'Exchanges'
+ consumes 'application/json'
+ produces 'application/json'
+ security [bearer_auth: []]
+ description <<~DESC
+ Swaps goods for different ones.
+
+ The replacement comes from this seller's own catalogue: it is stock
+ they will send, so a variant belonging to another seller is not theirs
+ to promise and reads as missing.
+ DESC
+
+ parameter name: 'X-Spree-Seller-Id', in: :header, type: :string, required: true
+ parameter name: :body, in: :body, schema: {
+ type: :object,
+ properties: {
+ items: {
+ type: :array,
+ items: {
+ type: :object,
+ properties: {
+ fulfillment_item_id: { type: :string },
+ new_variant_id: { type: :string },
+ quantity: { type: :integer }
+ },
+ required: %w[fulfillment_item_id new_variant_id quantity]
+ }
+ },
+ reason_id: { type: :string, nullable: true },
+ stock_location_id: { type: :string, nullable: true },
+ memo: { type: :string, nullable: true }
+ },
+ required: %w[items]
+ }
+
+ response '201', 'exchange opened' do
+ let(:Authorization) { "Bearer #{seller_jwt_token}" }
+ let(:'X-Spree-Seller-Id') { seller.prefixed_id }
+ let(:order_id) { order.prefixed_id }
+ let(:body) do
+ {
+ items: [{
+ fulfillment_item_id: fulfillment_item.prefixed_id,
+ new_variant_id: replacement.prefixed_id,
+ quantity: 1
+ }]
+ }
+ end
+
+ schema '$ref' => '#/components/schemas/Exchange'
+
+ run_test!
+ end
+ end
+ end
+
+ path '/api/v3/seller/orders/{order_id}/exchanges/{id}/fulfill' do
+ parameter name: :order_id, in: :path, type: :string
+ parameter name: :id, in: :path, type: :string
+
+ patch 'Send the replacement' do
+ tags 'Exchanges'
+ consumes 'application/json'
+ produces 'application/json'
+ security [bearer_auth: []]
+ description <<~DESC
+ Sends the replacement goods, settling any price difference at the same
+ time — which is why it takes a refund method.
+ DESC
+
+ parameter name: 'X-Spree-Seller-Id', in: :header, type: :string, required: true
+ parameter name: :body, in: :body, required: false, schema: {
+ type: :object,
+ properties: {
+ refund_method: { type: :string, enum: %w[original_payment store_credit] }
+ }
+ }
+
+ response '200', 'replacement sent' do
+ let(:Authorization) { "Bearer #{seller_jwt_token}" }
+ let(:'X-Spree-Seller-Id') { seller.prefixed_id }
+ let(:order_id) { order.prefixed_id }
+ let(:id) { exchange.prefixed_id }
+ let(:body) { {} }
+
+ before do
+ Spree::Exchanges::Approve.call(exchange: exchange)
+ Spree::Exchanges::Receive.call(exchange: exchange)
+ end
+
+ schema '$ref' => '#/components/schemas/Exchange'
+
+ run_test!
+ end
+ end
+ end
+end
diff --git a/spree/api/spec/integration/spree/api/v3/seller/fulfillments_spec.rb b/spree/api/spec/integration/spree/api/v3/seller/fulfillments_spec.rb
index 64dd45d701..f5c4a79202 100644
--- a/spree/api/spec/integration/spree/api/v3/seller/fulfillments_spec.rb
+++ b/spree/api/spec/integration/spree/api/v3/seller/fulfillments_spec.rb
@@ -108,4 +108,152 @@ RSpec.describe 'Seller Fulfillments API', type: :request, swagger_doc: 'api-refe
end
end
end
+
+ path '/api/v3/seller/orders/{order_id}/fulfillments/{id}' do
+ parameter name: :order_id, in: :path, type: :string
+ parameter name: :id, in: :path, type: :string
+
+ patch 'Update tracking' do
+ tags 'Fulfillments'
+ consumes 'application/json'
+ produces 'application/json'
+ security [bearer_auth: []]
+ description <<~DESC
+ Adds or corrects the tracking number and its carrier.
+
+ Deliberately narrow: where a parcel ships from and which service
+ carries it are the marketplace's arrangements, so they are not
+ editable here.
+ DESC
+
+ parameter name: 'X-Spree-Seller-Id', in: :header, type: :string, required: true
+ parameter name: :body, in: :body, schema: {
+ type: :object,
+ properties: {
+ tracking: { type: :string, nullable: true },
+ tracking_carrier: { type: :string, nullable: true }
+ }
+ }
+
+ response '200', 'tracking recorded' do
+ let(:Authorization) { "Bearer #{seller_jwt_token}" }
+ let(:'X-Spree-Seller-Id') { seller.prefixed_id }
+ let(:order_id) { order.prefixed_id }
+ let(:id) { fulfillment.prefixed_id }
+ let(:body) { { tracking: 'TRACK-2', tracking_carrier: 'ups' } }
+
+ schema '$ref' => '#/components/schemas/Fulfillment'
+
+ run_test! do
+ expect(fulfillment.reload.tracking).to eq('TRACK-2')
+ end
+ end
+ end
+ end
+
+ path '/api/v3/seller/orders/{order_id}/fulfillments/{id}/cancel' do
+ parameter name: :order_id, in: :path, type: :string
+ parameter name: :id, in: :path, type: :string
+
+ patch 'Cancel a parcel' do
+ tags 'Fulfillments'
+ produces 'application/json'
+ security [bearer_auth: []]
+ description <<~DESC
+ A parcel this seller is not going to send after all. The goods go back
+ on the shelf and the carrier is stood down.
+ DESC
+
+ parameter name: 'X-Spree-Seller-Id', in: :header, type: :string, required: true
+
+ response '200', 'parcel canceled' do
+ let(:Authorization) { "Bearer #{seller_jwt_token}" }
+ let(:'X-Spree-Seller-Id') { seller.prefixed_id }
+ let(:order_id) { order.prefixed_id }
+ let(:id) { fulfillment.prefixed_id }
+
+ schema '$ref' => '#/components/schemas/Fulfillment'
+
+ run_test! do
+ expect(fulfillment.reload).to be_canceled
+ end
+ end
+ end
+ end
+
+ path '/api/v3/seller/orders/{order_id}/fulfillments/{id}/mark_delivered' do
+ parameter name: :order_id, in: :path, type: :string
+ parameter name: :id, in: :path, type: :string
+
+ patch 'Confirm delivery' do
+ tags 'Fulfillments'
+ consumes 'application/json'
+ produces 'application/json'
+ security [bearer_auth: []]
+ description <<~DESC
+ Confirms the customer received the goods — the point the returns
+ window runs from, and recordable by hand for a seller posting parcels
+ without a carrier integration.
+ DESC
+
+ parameter name: 'X-Spree-Seller-Id', in: :header, type: :string, required: true
+ parameter name: :body, in: :body, required: false, schema: {
+ type: :object,
+ properties: {
+ delivered_at: { type: :string, nullable: true },
+ notify_customer: { type: :boolean }
+ }
+ }
+
+ response '200', 'delivery confirmed' do
+ let(:Authorization) { "Bearer #{seller_jwt_token}" }
+ let(:'X-Spree-Seller-Id') { seller.prefixed_id }
+ let(:order_id) { order.prefixed_id }
+ let(:id) { fulfillment.prefixed_id }
+ let(:body) { {} }
+
+ before { Spree.fulfillment_fulfill_workflow.call(fulfillment: fulfillment) }
+
+ schema '$ref' => '#/components/schemas/Fulfillment'
+
+ run_test! do
+ expect(fulfillment.reload).to be_delivered
+ end
+ end
+ end
+ end
+
+ path '/api/v3/seller/tracking_carriers' do
+ get 'List tracking carriers' do
+ tags 'Fulfillments'
+ produces 'application/json'
+ security [bearer_auth: []]
+ description <<~DESC
+ The carriers a tracking number can be pinned to, from the registry —
+ so a carrier an extension adds appears without a client change.
+ DESC
+
+ parameter name: 'X-Spree-Seller-Id', in: :header, type: :string, required: true
+
+ response '200', 'carriers listed' do
+ let(:Authorization) { "Bearer #{seller_jwt_token}" }
+ let(:'X-Spree-Seller-Id') { seller.prefixed_id }
+
+ schema type: :object,
+ properties: {
+ data: {
+ type: :array,
+ items: {
+ type: :object,
+ properties: { id: { type: :string }, name: { type: :string } },
+ required: %w[id name]
+ }
+ }
+ },
+ required: %w[data]
+
+ run_test!
+ end
+ end
+ end
end
diff --git a/spree/api/spec/integration/spree/api/v3/seller/returns_spec.rb b/spree/api/spec/integration/spree/api/v3/seller/returns_spec.rb
new file mode 100644
index 0000000000..c1de3b4eaa
--- /dev/null
+++ b/spree/api/spec/integration/spree/api/v3/seller/returns_spec.rb
@@ -0,0 +1,311 @@
+# frozen_string_literal: true
+
+require 'swagger_helper'
+
+RSpec.describe 'Seller Returns API', type: :request, swagger_doc: 'api-reference/seller.yaml' do
+ include_context 'API v3 Seller'
+
+ # Returns are a subject of the `orders` permission, so the seeded role
+ # rather than the shared context's products-only one.
+ let(:seller_user) do
+ create(:admin_user, :without_admin_role).tap { |user| seller.add_user(user) }
+ end
+
+ let!(:order) { create(:shipped_order, store: store, seller: seller, line_items_count: 1) }
+ let(:fulfillment_item) { order.fulfillment_items.first }
+
+ let(:return_record) do
+ Spree::Returns::Create.call(
+ order: order,
+ items: [{ fulfillment_item: order.fulfillment_items.first, quantity: 1 }]
+ ).value
+ end
+
+ path '/api/v3/seller/orders/{order_id}/returns' do
+ parameter name: :order_id, in: :path, type: :string, description: 'Prefixed order ID'
+
+ get 'List returns' do
+ tags 'Returns'
+ produces 'application/json'
+ security [bearer_auth: []]
+ description <<~DESC
+ Goods coming back on one of this seller's orders.
+
+ Reached through the order, which is itself fetched through the acting
+ seller — so a return on somebody else's order is unreachable whatever
+ ids are sent.
+ DESC
+
+ parameter name: 'X-Spree-Seller-Id', in: :header, type: :string, required: true
+
+ response '200', 'returns listed' do
+ let(:Authorization) { "Bearer #{seller_jwt_token}" }
+ let(:'X-Spree-Seller-Id') { seller.prefixed_id }
+ let(:order_id) { order.prefixed_id }
+
+ before { return_record }
+
+ schema type: :object,
+ properties: {
+ data: { type: :array, items: { '$ref' => '#/components/schemas/Return' } }
+ },
+ required: %w[data]
+
+ run_test!
+ end
+ end
+
+ post 'Open a return' do
+ tags 'Returns'
+ consumes 'application/json'
+ produces 'application/json'
+ security [bearer_auth: []]
+ description <<~DESC
+ Takes goods back on one of this seller's orders.
+
+ The units are addressed by fulfillment item and resolved through the
+ order, so only what this seller actually shipped can come back. An
+ optional stock location says which of the seller's own shelves it
+ returns to.
+ DESC
+
+ parameter name: 'X-Spree-Seller-Id', in: :header, type: :string, required: true
+ parameter name: :body, in: :body, schema: {
+ type: :object,
+ properties: {
+ items: {
+ type: :array,
+ items: {
+ type: :object,
+ properties: {
+ fulfillment_item_id: { type: :string },
+ quantity: { type: :integer }
+ },
+ required: %w[fulfillment_item_id quantity]
+ }
+ },
+ reason_id: { type: :string, nullable: true },
+ stock_location_id: { type: :string, nullable: true },
+ memo: { type: :string, nullable: true }
+ },
+ required: %w[items]
+ }
+
+ response '201', 'return opened' do
+ let(:Authorization) { "Bearer #{seller_jwt_token}" }
+ let(:'X-Spree-Seller-Id') { seller.prefixed_id }
+ let(:order_id) { order.prefixed_id }
+ let(:body) do
+ { items: [{ fulfillment_item_id: fulfillment_item.prefixed_id, quantity: 1 }] }
+ end
+
+ schema '$ref' => '#/components/schemas/Return'
+
+ run_test!
+ end
+
+ response '422', 'more than was shipped' do
+ let(:Authorization) { "Bearer #{seller_jwt_token}" }
+ let(:'X-Spree-Seller-Id') { seller.prefixed_id }
+ let(:order_id) { order.prefixed_id }
+ let(:body) do
+ { items: [{ fulfillment_item_id: fulfillment_item.prefixed_id, quantity: 99 }] }
+ end
+
+ run_test!
+ end
+ end
+ end
+
+ path '/api/v3/seller/orders/{order_id}/returns/{id}/approve' do
+ parameter name: :order_id, in: :path, type: :string
+ parameter name: :id, in: :path, type: :string
+
+ patch 'Approve a return' do
+ tags 'Returns'
+ produces 'application/json'
+ security [bearer_auth: []]
+ description 'Agrees the goods may come back.'
+
+ parameter name: 'X-Spree-Seller-Id', in: :header, type: :string, required: true
+
+ response '200', 'return approved' do
+ let(:Authorization) { "Bearer #{seller_jwt_token}" }
+ let(:'X-Spree-Seller-Id') { seller.prefixed_id }
+ let(:order_id) { order.prefixed_id }
+ let(:id) { return_record.prefixed_id }
+
+ schema '$ref' => '#/components/schemas/Return'
+
+ run_test!
+ end
+ end
+ end
+
+ path '/api/v3/seller/orders/{order_id}/returns/{id}/receive' do
+ parameter name: :order_id, in: :path, type: :string
+ parameter name: :id, in: :path, type: :string
+
+ patch 'Receive a return' do
+ tags 'Returns'
+ consumes 'application/json'
+ produces 'application/json'
+ security [bearer_auth: []]
+ description <<~DESC
+ Records what actually arrived, and whether it can be sold again.
+
+ Omitting `items` receives everything as requested and resellable.
+ DESC
+
+ parameter name: 'X-Spree-Seller-Id', in: :header, type: :string, required: true
+ parameter name: :body, in: :body, required: false, schema: {
+ type: :object,
+ properties: {
+ items: {
+ type: :array,
+ items: {
+ type: :object,
+ properties: {
+ return_line_item_id: { type: :string },
+ quantity: { type: :integer },
+ resellable: { type: :boolean }
+ },
+ required: %w[return_line_item_id quantity]
+ }
+ }
+ }
+ }
+
+ response '200', 'return received' do
+ let(:Authorization) { "Bearer #{seller_jwt_token}" }
+ let(:'X-Spree-Seller-Id') { seller.prefixed_id }
+ let(:order_id) { order.prefixed_id }
+ let(:id) { return_record.prefixed_id }
+ let(:body) { {} }
+
+ before { Spree::Returns::Approve.call(return_record: return_record) }
+
+ schema '$ref' => '#/components/schemas/Return'
+
+ run_test!
+ end
+ end
+ end
+
+ path '/api/v3/seller/orders/{order_id}/returns/{id}/refund' do
+ parameter name: :order_id, in: :path, type: :string
+ parameter name: :id, in: :path, type: :string
+
+ patch 'Refund a return' do
+ tags 'Returns'
+ consumes 'application/json'
+ produces 'application/json'
+ security [bearer_auth: []]
+ description <<~DESC
+ Gives the customer their money back.
+
+ The seller is merchant of record for their own child order, so this is
+ theirs to do. The amount is bounded by what the return is owed and, on
+ a basket split between sellers, by this order's share of the payment —
+ never a sibling's.
+ DESC
+
+ parameter name: 'X-Spree-Seller-Id', in: :header, type: :string, required: true
+ parameter name: :body, in: :body, required: false, schema: {
+ type: :object,
+ properties: {
+ amount: { type: :string, nullable: true },
+ refund_method: { type: :string, enum: %w[original_payment store_credit] }
+ }
+ }
+
+ response '200', 'return refunded' do
+ let(:Authorization) { "Bearer #{seller_jwt_token}" }
+ let(:'X-Spree-Seller-Id') { seller.prefixed_id }
+ let(:order_id) { order.prefixed_id }
+ let(:id) { return_record.prefixed_id }
+ let(:body) { { refund_method: 'store_credit' } }
+
+ before do
+ Spree::Returns::Approve.call(return_record: return_record)
+ Spree::Returns::Receive.call(return_record: return_record)
+ end
+
+ schema '$ref' => '#/components/schemas/Return'
+
+ run_test!
+ end
+
+ response '422', 'more than the return is owed' do
+ let(:Authorization) { "Bearer #{seller_jwt_token}" }
+ let(:'X-Spree-Seller-Id') { seller.prefixed_id }
+ let(:order_id) { order.prefixed_id }
+ let(:id) { return_record.prefixed_id }
+ let(:body) { { refund_method: 'store_credit', amount: '10000.0' } }
+
+ before do
+ Spree::Returns::Approve.call(return_record: return_record)
+ Spree::Returns::Receive.call(return_record: return_record)
+ end
+
+ run_test!
+ end
+ end
+ end
+
+ path '/api/v3/seller/orders/{order_id}/returns/{id}/cancel' do
+ parameter name: :order_id, in: :path, type: :string
+ parameter name: :id, in: :path, type: :string
+
+ patch 'Cancel a return' do
+ tags 'Returns'
+ produces 'application/json'
+ security [bearer_auth: []]
+ description 'Calls the return off.'
+
+ parameter name: 'X-Spree-Seller-Id', in: :header, type: :string, required: true
+
+ response '200', 'return canceled' do
+ let(:Authorization) { "Bearer #{seller_jwt_token}" }
+ let(:'X-Spree-Seller-Id') { seller.prefixed_id }
+ let(:order_id) { order.prefixed_id }
+ let(:id) { return_record.prefixed_id }
+
+ schema '$ref' => '#/components/schemas/Return'
+
+ run_test!
+ end
+ end
+ end
+
+ path '/api/v3/seller/return_reasons' do
+ get 'List return reasons' do
+ tags 'Returns'
+ produces 'application/json'
+ security [bearer_auth: []]
+ description <<~DESC
+ Why goods come back, as the marketplace defines it.
+
+ Read-only: the vocabulary is the operator's, and a seller picks from
+ it. Retired reasons are left out.
+ DESC
+
+ parameter name: 'X-Spree-Seller-Id', in: :header, type: :string, required: true
+
+ response '200', 'reasons listed' do
+ let(:Authorization) { "Bearer #{seller_jwt_token}" }
+ let(:'X-Spree-Seller-Id') { seller.prefixed_id }
+
+ before { create(:return_reason, store: store, name: 'Damaged in transit') }
+
+ schema type: :object,
+ properties: {
+ data: { type: :array, items: { '$ref' => '#/components/schemas/Reason' } }
+ },
+ required: %w[data]
+
+ run_test!
+ end
+ end
+ end
+end