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.

Add Admin Customers API

Damian Legawiecd96861994a19
diff --git a/docs/api-reference/admin.yaml b/docs/api-reference/admin.yaml
index a32e90366e..ec524c5270 100644
--- a/docs/api-reference/admin.yaml
+++ b/docs/api-reference/admin.yaml
@@ -74,15 +74,15 @@ paths:
content:
application/json:
example:
- token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJhZG1pbiIsImp0aSI6IjlmYjNmOTJhLTA1MjEtNGZlOC05MjIwLTQ4OTdkY2ZhNGFlOSIsImlzcyI6InNwcmVlIiwiYXVkIjoiYWRtaW5fYXBpIiwiZXhwIjoxNzc3NDYzMzgxfQ.8DfwCNdShTyfViR0MMrpgdSPL7OT_D3Mu3cR0TAEveU
- refresh_token: cYt1pekRHesbvYrjq2wUzhfV
+ token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJhZG1pbiIsImp0aSI6ImM5NzViYWMyLWQ2ZDAtNGUzYi05ZjIzLWYzOGQ1ZThkYjI2YiIsImlzcyI6InNwcmVlIiwiYXVkIjoiYWRtaW5fYXBpIiwiZXhwIjoxNzc3NDgxOTU3fQ.Elr15JDX9WdP642o93ARGZHULvGT1U3kvyM4ILdsvIQ
+ refresh_token: WVPfTx9y6NKzbcbexoiCndna
user:
id: admin_UkLWZg9DAJ
- first_name: Meggan
- last_name: Murazik
- created_at: '2026-04-29T10:49:40.718Z'
- updated_at: '2026-04-29T10:49:40.718Z'
+ first_name: Zulema
+ last_name: Mertz
+ created_at: '2026-04-29T15:59:16.744Z'
+ updated_at: '2026-04-29T15:59:16.744Z'
schema:
"$ref": "#/components/schemas/AuthResponse"
'401':
@@ -149,15 +149,15 @@ paths:
content:
application/json:
example:
- token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJhZG1pbiIsImp0aSI6IjcwNDAyYjk3LWY5MmUtNDJlNi05ZTIyLTdlZjgxYzM3ZjI3ZiIsImlzcyI6InNwcmVlIiwiYXVkIjoiYWRtaW5fYXBpIiwiZXhwIjoxNzc3NDYzMzgyfQ.PzqQLrMG9iIF8UMRE3E1tifuvNWbNNQengFjqjJfdas
- refresh_token: HPw1VLyHB3SmHiCmvmXSKtCQ
+ token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJhZG1pbiIsImp0aSI6ImZkZjY0ZThmLTNlODctNDUwMS1hYjcwLTBhMTZmMDkxY2ViZSIsImlzcyI6InNwcmVlIiwiYXVkIjoiYWRtaW5fYXBpIiwiZXhwIjoxNzc3NDgxOTU4fQ.DNJOApfWkt2la3eF6CjAaNh2YMfa8BF7lNdUoI4vBWU
+ refresh_token: Xiak23mXy1AEHeVkrcxYGH43
user:
id: admin_UkLWZg9DAJ
- first_name: Del
- last_name: Hilll
- created_at: '2026-04-29T10:49:42.182Z'
- updated_at: '2026-04-29T10:49:42.182Z'
+ first_name: Lucille
+ last_name: Gottlieb
+ created_at: '2026-04-29T15:59:18.242Z'
+ updated_at: '2026-04-29T15:59:18.242Z'
schema:
"$ref": "#/components/schemas/AuthResponse"
'401':
@@ -181,6 +181,944 @@ paths:
description: Refresh token obtained from login
required:
- refresh_token
+ "/api/v3/admin/customers/{customer_id}/addresses":
+ get:
+ summary: List customer addresses
+ tags:
+ - Customer Addresses
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: Returns the customer's saved addresses.
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: customer_id
+ in: path
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: addresses found
+ content:
+ application/json:
+ example:
+ data:
+ - id: addr_UkLWZg9DAJ
+ first_name: John
+ last_name: Doe
+ full_name: John Doe
+ address1: 1 Lovely Street
+ address2: Northwest
+ postal_code: '10118'
+ city: New York
+ phone: 555-555-0199
+ company: Company
+ country_name: United States of America
+ country_iso: US
+ state_text: NY
+ state_abbr: NY
+ quick_checkout: false
+ is_default_billing: false
+ is_default_shipping: false
+ state_name: New York
+ label:
+ created_at: '2026-04-29T15:59:18.556Z'
+ updated_at: '2026-04-29T15:59:18.556Z'
+ customer_id: cus_UkLWZg9DAJ
+ metadata:
+ meta:
+ page: 1
+ limit: 25
+ count: 1
+ pages: 1
+ from: 1
+ to: 1
+ in: 1
+ previous:
+ next:
+ post:
+ summary: Create a customer address
+ tags:
+ - Customer Addresses
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: 'Adds a new address to the customer''s address book. Pass `is_default_billing:
+ true` or `is_default_shipping: true` to set as the default — the previous
+ default loses its flag in the same transaction.'
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: customer_id
+ in: path
+ required: true
+ schema:
+ type: string
+ responses:
+ '201':
+ description: address created
+ content:
+ application/json:
+ example:
+ id: addr_gbHJdmfrXB
+ first_name: Jane
+ last_name: Doe
+ full_name: Jane Doe
+ address1: 350 Fifth Avenue
+ address2:
+ postal_code: '10118'
+ city: New York
+ phone: "+12125551234"
+ company:
+ country_name: United States of America
+ country_iso: US
+ state_text: NY
+ state_abbr: NY
+ quick_checkout: false
+ is_default_billing: false
+ is_default_shipping: false
+ state_name: New York
+ label: Office
+ created_at: '2026-04-29T15:59:19.950Z'
+ updated_at: '2026-04-29T15:59:19.950Z'
+ customer_id: cus_UkLWZg9DAJ
+ metadata:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ first_name:
+ type: string
+ last_name:
+ type: string
+ address1:
+ type: string
+ address2:
+ type: string
+ city:
+ type: string
+ postal_code:
+ type: string
+ country_iso:
+ type: string
+ description: ISO-2 country code (e.g. US)
+ state_abbr:
+ type: string
+ description: State/province abbreviation (e.g. NY)
+ phone:
+ type: string
+ company:
+ type: string
+ label:
+ type: string
+ is_default_billing:
+ type: boolean
+ is_default_shipping:
+ type: boolean
+ "/api/v3/admin/customers/{customer_id}/addresses/{id}":
+ patch:
+ summary: Update a customer address
+ tags:
+ - Customer Addresses
+ security:
+ - api_key: []
+ bearer_auth: []
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: customer_id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: address updated
+ content:
+ application/json:
+ example:
+ id: addr_UkLWZg9DAJ
+ first_name: John
+ last_name: Doe
+ full_name: John Doe
+ address1: 3 Lovely Street
+ address2: Northwest
+ postal_code: '10118'
+ city: Manhattan
+ phone: 555-555-0199
+ company: Company
+ country_name: United States of America
+ country_iso: US
+ state_text: NY
+ state_abbr: NY
+ quick_checkout: false
+ is_default_billing: false
+ is_default_shipping: false
+ state_name: New York
+ label:
+ created_at: '2026-04-29T15:59:20.237Z'
+ updated_at: '2026-04-29T15:59:20.824Z'
+ customer_id: cus_UkLWZg9DAJ
+ metadata:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ city:
+ type: string
+ is_default_billing:
+ type: boolean
+ is_default_shipping:
+ type: boolean
+ delete:
+ summary: Delete a customer address
+ tags:
+ - Customer Addresses
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: Deletes the address. If it was a default, the customer loses that
+ default (no auto-promotion).
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: customer_id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ responses:
+ '204':
+ description: address deleted
+ "/api/v3/admin/customers/{customer_id}/credit_cards":
+ get:
+ summary: List customer credit cards
+ tags:
+ - Customer Credit Cards
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: Returns the customer's saved credit cards. Useful for off-session
+ admin charges via `POST /admin/orders/:id/payments { source_id }`.
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: customer_id
+ in: path
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: credit cards found
+ content:
+ application/json:
+ example:
+ data:
+ - id: card_UkLWZg9DAJ
+ brand: visa
+ last4: '1111'
+ month: 12
+ year: 2027
+ name: Spree Commerce
+ default: false
+ gateway_payment_profile_id:
+ customer_id: cus_UkLWZg9DAJ
+ payment_method_id: pm_UkLWZg9DAJ
+ created_at: '2026-04-29T15:59:21.988Z'
+ updated_at: '2026-04-29T15:59:21.988Z'
+ meta:
+ page: 1
+ limit: 25
+ count: 1
+ pages: 1
+ from: 1
+ to: 1
+ in: 1
+ previous:
+ next:
+ "/api/v3/admin/customers/{customer_id}/credit_cards/{id}":
+ get:
+ summary: Show a customer credit card
+ tags:
+ - Customer Credit Cards
+ security:
+ - api_key: []
+ bearer_auth: []
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: customer_id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: credit card found
+ content:
+ application/json:
+ example:
+ id: card_UkLWZg9DAJ
+ brand: visa
+ last4: '1111'
+ month: 12
+ year: 2027
+ name: Spree Commerce
+ default: false
+ gateway_payment_profile_id:
+ customer_id: cus_UkLWZg9DAJ
+ payment_method_id: pm_UkLWZg9DAJ
+ created_at: '2026-04-29T15:59:22.565Z'
+ updated_at: '2026-04-29T15:59:22.565Z'
+ delete:
+ summary: Delete a customer credit card
+ tags:
+ - Customer Credit Cards
+ security:
+ - api_key: []
+ bearer_auth: []
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: customer_id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ responses:
+ '204':
+ description: credit card deleted
+ "/api/v3/admin/customers/{customer_id}/store_credits":
+ get:
+ summary: List customer store credits
+ tags:
+ - Customer Store Credits
+ security:
+ - api_key: []
+ bearer_auth: []
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: customer_id
+ in: path
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: store credits found
+ content:
+ application/json:
+ example:
+ data:
+ - id: credit_UkLWZg9DAJ
+ amount: '50.0'
+ amount_used: '0.0'
+ amount_remaining: '50.0'
+ display_amount: "$50.00"
+ display_amount_used: "$0.00"
+ display_amount_remaining: "$50.00"
+ currency: USD
+ created_at: '2026-04-29T15:59:23.961Z'
+ updated_at: '2026-04-29T15:59:23.961Z'
+ customer_id: cus_UkLWZg9DAJ
+ created_by_id: admin_UkLWZg9DAJ
+ metadata:
+ meta:
+ page: 1
+ limit: 25
+ count: 1
+ pages: 1
+ from: 1
+ to: 1
+ in: 1
+ previous:
+ next:
+ post:
+ summary: Issue a store credit to a customer
+ tags:
+ - Customer Store Credits
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: "`created_by` is set automatically from the authenticated admin."
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: customer_id
+ in: path
+ required: true
+ schema:
+ type: string
+ responses:
+ '201':
+ description: store credit created
+ content:
+ application/json:
+ example:
+ id: credit_gbHJdmfrXB
+ amount: '25.0'
+ amount_used: '0.0'
+ amount_remaining: '25.0'
+ display_amount: "$25.00"
+ display_amount_used: "$0.00"
+ display_amount_remaining: "$25.00"
+ currency: USD
+ created_at: '2026-04-29T15:59:25.093Z'
+ updated_at: '2026-04-29T15:59:25.093Z'
+ customer_id: cus_UkLWZg9DAJ
+ created_by_id: admin_gbHJdmfrXB
+ metadata:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ required:
+ - amount
+ - currency
+ - category_id
+ properties:
+ amount:
+ type: number
+ example: 50.0
+ currency:
+ type: string
+ example: USD
+ category_id:
+ type: string
+ description: StoreCreditCategory ID
+ memo:
+ type: string
+ "/api/v3/admin/customers/{customer_id}/store_credits/{id}":
+ patch:
+ summary: Update a store credit
+ tags:
+ - Customer Store Credits
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: Update memo / category / amount. The amount can only be changed
+ if `amount_used == 0`.
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: customer_id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: store credit updated
+ content:
+ application/json:
+ example:
+ id: credit_UkLWZg9DAJ
+ amount: '50.0'
+ amount_used: '0.0'
+ amount_remaining: '50.0'
+ display_amount: "$50.00"
+ display_amount_used: "$0.00"
+ display_amount_remaining: "$50.00"
+ currency: USD
+ created_at: '2026-04-29T15:59:25.639Z'
+ updated_at: '2026-04-29T15:59:25.927Z'
+ customer_id: cus_UkLWZg9DAJ
+ created_by_id: admin_UkLWZg9DAJ
+ metadata:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ amount:
+ type: number
+ category_id:
+ type: string
+ memo:
+ type: string
+ delete:
+ summary: Delete a store credit
+ tags:
+ - Customer Store Credits
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: Deletes an unused store credit (amount_used == 0). Returns 422
+ otherwise.
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: customer_id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ responses:
+ '204':
+ description: store credit deleted
+ "/api/v3/admin/customers":
+ get:
+ summary: List customers
+ tags:
+ - Customers
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: Returns a paginated list of customers. Supports Ransack search/filters.
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ description: Bearer token for admin authentication
+ schema:
+ type: string
+ - name: page
+ in: query
+ required: false
+ schema:
+ type: integer
+ - name: limit
+ in: query
+ required: false
+ schema:
+ type: integer
+ - name: q[search]
+ in: query
+ required: false
+ description: Email + name full-text-ish search
+ schema:
+ type: string
+ responses:
+ '200':
+ description: customers found
+ content:
+ application/json:
+ example:
+ data:
+ - id: cus_UkLWZg9DAJ
+ first_name: Jane
+ last_name: Doe
+ phone:
+ accepts_email_marketing: false
+ full_name: Jane Doe
+ available_store_credit_total: '0'
+ display_available_store_credit_total: "$0.00"
+ last_sign_in_at:
+ current_sign_in_at:
+ created_at: '2026-04-29T15:59:27.045Z'
+ updated_at: '2026-04-29T15:59:27.045Z'
+ sign_in_count: 0
+ failed_attempts: 0
+ last_sign_in_ip:
+ current_sign_in_ip:
+ tags: []
+ internal_note_html:
+ metadata:
+ default_billing_address_id:
+ default_shipping_address_id:
+ orders_count: 0
+ total_spent: '0'
+ display_total_spent: "$0.00"
+ last_order_completed_at:
+ meta:
+ page: 1
+ limit: 25
+ count: 1
+ pages: 1
+ from: 1
+ to: 1
+ in: 1
+ previous:
+ next:
+ post:
+ summary: Create a customer
+ tags:
+ - Customers
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: Creates a customer. No welcome email is sent automatically.
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ responses:
+ '201':
+ description: customer created
+ content:
+ application/json:
+ example:
+ id: cus_gbHJdmfrXB
+ first_name: New
+ last_name: Customer
+ phone:
+ accepts_email_marketing: false
+ full_name: New Customer
+ available_store_credit_total: '0'
+ display_available_store_credit_total: "$0.00"
+ login:
+ last_sign_in_at:
+ current_sign_in_at:
+ created_at: '2026-04-29T15:59:27.893Z'
+ updated_at: '2026-04-29T15:59:27.893Z'
+ sign_in_count: 0
+ failed_attempts: 0
+ last_sign_in_ip:
+ current_sign_in_ip:
+ tags: []
+ internal_note_html:
+ metadata:
+ default_billing_address_id:
+ default_shipping_address_id:
+ orders_count: 0
+ total_spent: '0.0'
+ display_total_spent: "$0.00"
+ last_order_completed_at:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ required:
+ - email
+ properties:
+ email:
+ type: string
+ first_name:
+ type: string
+ last_name:
+ type: string
+ phone:
+ type: string
+ accepts_email_marketing:
+ type: boolean
+ internal_note:
+ type: string
+ tags:
+ type: array
+ items:
+ type: string
+ metadata:
+ type: object
+ "/api/v3/admin/customers/{id}":
+ get:
+ summary: Show a customer
+ tags:
+ - Customers
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: Returns full customer details including computed order stats (orders_count,
+ total_spent, last_order_completed_at).
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: id
+ in: path
+ required: true
+ description: Customer prefixed ID
+ schema:
+ type: string
+ - name: expand
+ in: query
+ required: false
+ description: 'Comma-separated associations: addresses, orders, store_credits,
+ default_billing_address, default_shipping_address'
+ schema:
+ type: string
+ responses:
+ '200':
+ description: customer found
+ content:
+ application/json:
+ example:
+ id: cus_UkLWZg9DAJ
+ first_name: Jane
+ last_name: Doe
+ phone:
+ accepts_email_marketing: false
+ full_name: Jane Doe
+ available_store_credit_total: '0'
+ display_available_store_credit_total: "$0.00"
+ last_sign_in_at:
+ current_sign_in_at:
+ created_at: '2026-04-29T15:59:28.162Z'
+ updated_at: '2026-04-29T15:59:28.162Z'
+ sign_in_count: 0
+ failed_attempts: 0
+ last_sign_in_ip:
+ current_sign_in_ip:
+ tags: []
+ internal_note_html:
+ metadata:
+ default_billing_address_id:
+ default_shipping_address_id:
+ orders_count: 0
+ total_spent: '0'
+ display_total_spent: "$0.00"
+ last_order_completed_at:
+ patch:
+ summary: Update a customer
+ tags:
+ - Customers
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: Updates customer attributes. `tags` replaces the full set.
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: customer updated
+ content:
+ application/json:
+ example:
+ id: cus_UkLWZg9DAJ
+ first_name: Updated
+ last_name: Doe
+ phone:
+ accepts_email_marketing: false
+ full_name: Updated Doe
+ available_store_credit_total: '0'
+ display_available_store_credit_total: "$0.00"
+ last_sign_in_at:
+ current_sign_in_at:
+ created_at: '2026-04-29T15:59:28.714Z'
+ updated_at: '2026-04-29T15:59:28.998Z'
+ sign_in_count: 0
+ failed_attempts: 0
+ last_sign_in_ip:
+ current_sign_in_ip:
+ tags: []
+ internal_note_html:
+ metadata:
+ default_billing_address_id:
+ default_shipping_address_id:
+ orders_count: 0
+ total_spent: '0.0'
+ display_total_spent: "$0.00"
+ last_order_completed_at:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ email:
+ type: string
+ first_name:
+ type: string
+ last_name:
+ type: string
+ phone:
+ type: string
+ accepts_email_marketing:
+ type: boolean
+ internal_note:
+ type: string
+ tags:
+ type: array
+ items:
+ type: string
+ metadata:
+ type: object
+ delete:
+ summary: Delete a customer
+ tags:
+ - Customers
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: Deletes a customer. Returns 422 if the customer has any orders.
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ responses:
+ '204':
+ description: customer deleted
"/api/v3/admin/me":
get:
summary: Get current admin user and permissions
@@ -226,11 +1164,11 @@ paths:
example:
user:
id: admin_UkLWZg9DAJ
- first_name: Nathaniel
- last_name: Lueilwitz
- created_at: '2026-04-29T10:49:42.478Z'
- updated_at: '2026-04-29T10:49:42.478Z'
+ first_name: Tanna
+ last_name: Langosh
+ created_at: '2026-04-29T15:59:29.836Z'
+ updated_at: '2026-04-29T15:59:29.836Z'
permissions:
- allow: true
actions:
@@ -346,8 +1284,8 @@ paths:
label: Size
position: 1
kind: dropdown
- created_at: '2026-04-29T10:49:42.519Z'
- updated_at: '2026-04-29T10:49:42.519Z'
+ created_at: '2026-04-29T15:59:29.893Z'
+ updated_at: '2026-04-29T15:59:29.893Z'
option_values: []
meta:
page: 1
@@ -415,8 +1353,8 @@ paths:
label: Material
position: 2
kind: dropdown
- created_at: '2026-04-29T10:49:43.150Z'
- updated_at: '2026-04-29T10:49:43.150Z'
+ created_at: '2026-04-29T15:59:30.475Z'
+ updated_at: '2026-04-29T15:59:30.475Z'
option_values: []
schema:
"$ref": "#/components/schemas/OptionType"
@@ -508,8 +1446,8 @@ paths:
label: Size
position: 1
kind: dropdown
- created_at: '2026-04-29T10:49:43.454Z'
- updated_at: '2026-04-29T10:49:43.454Z'
+ created_at: '2026-04-29T15:59:30.761Z'
+ updated_at: '2026-04-29T15:59:30.761Z'
option_values: []
schema:
"$ref": "#/components/schemas/OptionType"
@@ -560,8 +1498,8 @@ paths:
label: Updated Presentation
position: 1
kind: dropdown
- created_at: '2026-04-29T10:49:44.018Z'
- updated_at: '2026-04-29T10:49:44.296Z'
+ created_at: '2026-04-29T15:59:31.333Z'
+ updated_at: '2026-04-29T15:59:31.616Z'
option_values: []
schema:
"$ref": "#/components/schemas/OptionType"
@@ -676,7 +1614,7 @@ paths:
example:
data:
- id: ful_UkLWZg9DAJ
- number: H18511115464
+ number: H14880110860
tracking: U10000
tracking_url:
cost: '10.0'
@@ -700,8 +1638,8 @@ paths:
quantity: 1
adjustment_total: '0.0'
pre_tax_amount: '0.0'
- created_at: '2026-04-29T10:49:46.408Z'
- updated_at: '2026-04-29T10:49:46.529Z'
+ created_at: '2026-04-29T15:59:33.758Z'
+ updated_at: '2026-04-29T15:59:33.861Z'
metadata:
order_id: or_UkLWZg9DAJ
stock_location_id: sloc_UkLWZg9DAJ
@@ -755,7 +1693,7 @@ paths:
application/json:
example:
id: ful_UkLWZg9DAJ
- number: H67463310487
+ number: H46462677784
tracking: U10000
tracking_url:
cost: '10.0'
@@ -779,8 +1717,8 @@ paths:
quantity: 1
adjustment_total: '0.0'
pre_tax_amount: '0.0'
- created_at: '2026-04-29T10:49:47.143Z'
- updated_at: '2026-04-29T10:49:47.205Z'
+ created_at: '2026-04-29T15:59:34.478Z'
+ updated_at: '2026-04-29T15:59:34.550Z'
metadata:
order_id: or_UkLWZg9DAJ
stock_location_id: sloc_UkLWZg9DAJ
@@ -823,7 +1761,7 @@ paths:
application/json:
example:
id: ful_UkLWZg9DAJ
- number: H98036370897
+ number: H29909540755
tracking: 1Z999AA10123456784
tracking_url: https://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=1Z999AA10123456784
cost: '10.0'
@@ -847,8 +1785,8 @@ paths:
quantity: 1
adjustment_total: '0.0'
pre_tax_amount: '0.0'
- created_at: '2026-04-29T10:49:47.797Z'
- updated_at: '2026-04-29T10:49:48.140Z'
+ created_at: '2026-04-29T15:59:35.211Z'
+ updated_at: '2026-04-29T15:59:35.647Z'
metadata:
order_id: or_UkLWZg9DAJ
stock_location_id: sloc_UkLWZg9DAJ
@@ -903,7 +1841,7 @@ paths:
application/json:
example:
id: ful_UkLWZg9DAJ
- number: H43948061420
+ number: H49727928395
tracking: U10000
tracking_url:
cost: '10.0'
@@ -920,15 +1858,15 @@ paths:
display_tax_total: "$0.00"
status: shipped
fulfillment_type: shipping
- fulfilled_at: '2026-04-29T10:49:48Z'
+ fulfilled_at: '2026-04-29T15:59:36Z'
items:
- item_id: li_UkLWZg9DAJ
variant_id: variant_UkLWZg9DAJ
quantity: 1
adjustment_total: '0.0'
pre_tax_amount: '0.0'
- created_at: '2026-04-29T10:49:48.449Z'
- updated_at: '2026-04-29T10:49:48.801Z'
+ created_at: '2026-04-29T15:59:35.985Z'
+ updated_at: '2026-04-29T15:59:36.352Z'
metadata:
order_id: or_UkLWZg9DAJ
stock_location_id: sloc_UkLWZg9DAJ
@@ -972,7 +1910,7 @@ paths:
application/json:
example:
id: ful_UkLWZg9DAJ
- number: H45564658891
+ number: H74143874830
tracking: U10000
tracking_url:
cost: '10.0'
@@ -996,8 +1934,8 @@ paths:
quantity: 1
adjustment_total: '0.0'
pre_tax_amount: '0.0'
- created_at: '2026-04-29T10:49:49.123Z'
- updated_at: '2026-04-29T10:49:49.459Z'
+ created_at: '2026-04-29T15:59:36.678Z'
+ updated_at: '2026-04-29T15:59:37.029Z'
metadata:
order_id: or_UkLWZg9DAJ
stock_location_id: sloc_UkLWZg9DAJ
@@ -1041,7 +1979,7 @@ paths:
application/json:
example:
id: ful_UkLWZg9DAJ
- number: H14531557641
+ number: H62532514472
tracking: U10000
tracking_url:
cost: '10.0'
@@ -1065,8 +2003,8 @@ paths:
quantity: 1
adjustment_total: '0.0'
pre_tax_amount: '0.0'
- created_at: '2026-04-29T10:49:49.778Z'
- updated_at: '2026-04-29T10:49:50.119Z'
+ created_at: '2026-04-29T15:59:37.367Z'
+ updated_at: '2026-04-29T15:59:37.764Z'
metadata:
order_id: or_UkLWZg9DAJ
stock_location_id: sloc_UkLWZg9DAJ
@@ -1112,7 +2050,7 @@ paths:
example:
data:
- id: ful_gbHJdmfrXB
- number: H01841103861
+ number: H36302623231
tracking:
tracking_url:
cost: '10.0'
@@ -1136,8 +2074,8 @@ paths:
quantity: 1
adjustment_total: '0.0'
pre_tax_amount: '0.0'
- created_at: '2026-04-29T10:49:50.863Z'
- updated_at: '2026-04-29T10:49:50.907Z'
+ created_at: '2026-04-29T15:59:38.473Z'
+ updated_at: '2026-04-29T15:59:38.527Z'
metadata:
order_id: or_UkLWZg9DAJ
stock_location_id: sloc_gbHJdmfrXB
@@ -1193,7 +2131,7 @@ paths:
application/json:
example:
id: gc_UkLWZg9DAJ
- code: 69CD7C4799D15386
+ code: A95638B047300283
status: active
currency: USD
amount: '10.0'
@@ -1207,8 +2145,8 @@ paths:
redeemed_at:
expired: false
active: true
- created_at: '2026-04-29T10:49:51.247Z'
- updated_at: '2026-04-29T10:49:51.544Z'
+ created_at: '2026-04-29T15:59:38.888Z'
+ updated_at: '2026-04-29T15:59:39.196Z'
requestBody:
content:
application/json:
@@ -1295,8 +2233,8 @@ paths:
variant_id: variant_gbHJdmfrXB
quantity: 2
currency: USD
- name: Product 102972
- slug: product-102972
+ name: Product 108448
+ slug: product-108448
options_text: 'Size: S'
price: '10.0'
display_price: "$10.00"
@@ -1327,15 +2265,14 @@ paths:
option_type_name: foo-size-10
option_type_label: Size
image_url:
- created_at: '2026-04-29T10:49:52.211Z'
- updated_at: '2026-04-29T10:49:52.211Z'
+ created_at: '2026-04-29T15:59:39.910Z'
+ updated_at: '2026-04-29T15:59:39.910Z'
digital_links: []
- created_at: '2026-04-29T10:49:52.493Z'
- updated_at: '2026-04-29T10:49:52.493Z'
+ created_at: '2026-04-29T15:59:40.201Z'
+ updated_at: '2026-04-29T15:59:40.201Z'
metadata:
cost_price: '17.0'
tax_category_id: taxcat_UkLWZg9DAJ
- order_id: or_UkLWZg9DAJ
meta:
page: 1
limit: 25
@@ -1382,8 +2319,8 @@ paths:
variant_id: variant_VqXmZF31wY
quantity: 3
currency: USD
- name: Product 127539
- slug: product-127539
+ name: Product 125274
+ slug: product-125274
options_text: 'Size: S'
price: '19.99'
display_price: "$19.99"
@@ -1414,15 +2351,14 @@ paths:
option_type_name: foo-size-12
option_type_label: Size
image_url:
- created_at: '2026-04-29T10:49:53.417Z'
- updated_at: '2026-04-29T10:49:53.417Z'
+ created_at: '2026-04-29T15:59:41.140Z'
+ updated_at: '2026-04-29T15:59:41.140Z'
digital_links: []
- created_at: '2026-04-29T10:49:53.450Z'
- updated_at: '2026-04-29T10:49:53.450Z'
+ created_at: '2026-04-29T15:59:41.167Z'
+ updated_at: '2026-04-29T15:59:41.167Z'
metadata:
cost_price: '17.0'
tax_category_id: taxcat_UkLWZg9DAJ
- order_id: or_UkLWZg9DAJ
requestBody:
content:
application/json:
@@ -1480,8 +2416,8 @@ paths:
variant_id: variant_gbHJdmfrXB
quantity: 2
currency: USD
- name: Product 133573
- slug: product-133573
+ name: Product 131748
+ slug: product-131748
options_text: 'Size: S'
price: '10.0'
display_price: "$10.00"
@@ -1512,15 +2448,14 @@ paths:
option_type_name: foo-size-13
option_type_label: Size
image_url:
- created_at: '2026-04-29T10:49:53.515Z'
- updated_at: '2026-04-29T10:49:53.515Z'
+ created_at: '2026-04-29T15:59:41.249Z'
+ updated_at: '2026-04-29T15:59:41.249Z'
digital_links: []
- created_at: '2026-04-29T10:49:53.796Z'
- updated_at: '2026-04-29T10:49:53.796Z'
+ created_at: '2026-04-29T15:59:41.542Z'
+ updated_at: '2026-04-29T15:59:41.542Z'
metadata:
cost_price: '17.0'
tax_category_id: taxcat_UkLWZg9DAJ
- order_id: or_UkLWZg9DAJ
patch:
summary: Update an item
tags:
@@ -1563,8 +2498,8 @@ paths:
variant_id: variant_gbHJdmfrXB
quantity: 5
currency: USD
- name: Product 144758
- slug: product-144758
+ name: Product 149920
+ slug: product-149920
options_text: 'Size: S'
price: '19.99'
display_price: "$19.99"
@@ -1595,15 +2530,14 @@ paths:
option_type_name: foo-size-14
option_type_label: Size
image_url:
- created_at: '2026-04-29T10:49:54.111Z'
- updated_at: '2026-04-29T10:49:54.111Z'
+ created_at: '2026-04-29T15:59:41.881Z'
+ updated_at: '2026-04-29T15:59:41.881Z'
digital_links: []
- created_at: '2026-04-29T10:49:54.392Z'
- updated_at: '2026-04-29T10:49:54.686Z'
+ created_at: '2026-04-29T15:59:42.171Z'
+ updated_at: '2026-04-29T15:59:42.475Z'
metadata:
cost_price: '17.0'
tax_category_id: taxcat_UkLWZg9DAJ
- order_id: or_UkLWZg9DAJ
requestBody:
content:
application/json:
@@ -1683,8 +2617,8 @@ paths:
data:
- id: py_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
- response_code: BGS-9440161e4b41
- number: PHRDBQIF
+ response_code: BGS-54a70c52b21d
+ number: PLAV8NZY
amount: '110.0'
display_amount: "$110.00"
status: completed
@@ -1701,13 +2635,13 @@ paths:
gateway_payment_profile_id:
customer_id:
payment_method_id: pm_gbHJdmfrXB
- created_at: '2026-04-29T10:49:55.643Z'
- updated_at: '2026-04-29T10:49:55.645Z'
+ created_at: '2026-04-29T15:59:43.586Z'
+ updated_at: '2026-04-29T15:59:43.589Z'
avs_response:
cvv_response_code:
cvv_response_message:
- created_at: '2026-04-29T10:49:55.644Z'
- updated_at: '2026-04-29T10:49:55.644Z'
+ created_at: '2026-04-29T15:59:43.588Z'
+ updated_at: '2026-04-29T15:59:43.588Z'
metadata:
captured_amount: '0.0'
order_id: or_UkLWZg9DAJ
@@ -1756,7 +2690,7 @@ paths:
id: py_gbHJdmfrXB
payment_method_id: pm_EfhxLZ9ck8
response_code:
- number: PFO94SE9
+ number: PTVQ79F2
amount: '110.0'
display_amount: "$110.00"
status: checkout
@@ -1766,8 +2700,8 @@ paths:
avs_response:
cvv_response_code:
cvv_response_message:
- created_at: '2026-04-29T10:49:56.908Z'
- updated_at: '2026-04-29T10:49:56.908Z'
+ created_at: '2026-04-29T15:59:45.006Z'
+ updated_at: '2026-04-29T15:59:45.006Z'
metadata:
captured_amount: '0.0'
order_id: or_gbHJdmfrXB
@@ -1829,8 +2763,8 @@ paths:
example:
id: py_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
- response_code: BGS-87c2d28a0471
- number: P0WYM8LA
+ response_code: BGS-836f5fa9863f
+ number: P86A9S9N
amount: '110.0'
display_amount: "$110.00"
status: completed
@@ -1847,13 +2781,13 @@ paths:
gateway_payment_profile_id:
customer_id:
payment_method_id: pm_gbHJdmfrXB
- created_at: '2026-04-29T10:49:57.265Z'
- updated_at: '2026-04-29T10:49:57.267Z'
+ created_at: '2026-04-29T15:59:45.398Z'
+ updated_at: '2026-04-29T15:59:45.401Z'
avs_response:
cvv_response_code:
cvv_response_message:
- created_at: '2026-04-29T10:49:57.266Z'
- updated_at: '2026-04-29T10:49:57.266Z'
+ created_at: '2026-04-29T15:59:45.400Z'
+ updated_at: '2026-04-29T15:59:45.400Z'
metadata:
captured_amount: '0.0'
order_id: or_UkLWZg9DAJ
@@ -1898,8 +2832,8 @@ paths:
example:
id: py_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
- response_code: BGS-8b5c306e4573
- number: PSH2AT8B
+ response_code: BGS-43f1ba4bb781
+ number: PZSM7VMD
amount: '110.0'
display_amount: "$110.00"
status: completed
@@ -1916,13 +2850,13 @@ paths:
gateway_payment_profile_id:
customer_id:
payment_method_id: pm_gbHJdmfrXB
- created_at: '2026-04-29T10:49:57.912Z'
- updated_at: '2026-04-29T10:49:57.915Z'
+ created_at: '2026-04-29T15:59:46.099Z'
+ updated_at: '2026-04-29T15:59:46.103Z'
avs_response:
cvv_response_code:
cvv_response_message:
- created_at: '2026-04-29T10:49:57.914Z'
- updated_at: '2026-04-29T10:49:58.238Z'
+ created_at: '2026-04-29T15:59:46.101Z'
+ updated_at: '2026-04-29T15:59:46.450Z'
metadata:
captured_amount: '110.0'
order_id: or_UkLWZg9DAJ
@@ -1967,8 +2901,8 @@ paths:
example:
id: py_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
- response_code: void-BGS-9c6ee8fbbfa7
- number: PPUQK015
+ response_code: void-BGS-c568f8768169
+ number: PMY7I4KL
amount: '110.0'
display_amount: "$110.00"
status: void
@@ -1985,13 +2919,13 @@ paths:
gateway_payment_profile_id:
customer_id:
payment_method_id: pm_gbHJdmfrXB
- created_at: '2026-04-29T10:49:58.598Z'
- updated_at: '2026-04-29T10:49:58.601Z'
+ created_at: '2026-04-29T15:59:46.860Z'
+ updated_at: '2026-04-29T15:59:46.863Z'
avs_response:
cvv_response_code:
cvv_response_message:
- created_at: '2026-04-29T10:49:58.600Z'
- updated_at: '2026-04-29T10:49:58.896Z'
+ created_at: '2026-04-29T15:59:46.862Z'
+ updated_at: '2026-04-29T15:59:47.173Z'
metadata:
captured_amount: '0.0'
order_id: or_UkLWZg9DAJ
@@ -2073,13 +3007,13 @@ paths:
application/json:
example:
id: re_UkLWZg9DAJ
- transaction_id: BGS-4ce7094aab21
+ transaction_id: BGS-b4d7d858bbe3
amount: '5.0'
payment_id: py_UkLWZg9DAJ
refund_reason_id: rr_UkLWZg9DAJ
reimbursement_id:
- created_at: '2026-04-29T10:50:00.206Z'
- updated_at: '2026-04-29T10:50:00.206Z'
+ created_at: '2026-04-29T15:59:48.631Z'
+ updated_at: '2026-04-29T15:59:48.631Z'
requestBody:
content:
application/json:
@@ -2134,8 +3068,8 @@ paths:
example:
id: or_UkLWZg9DAJ
market_id:
- number: R932540585
+ number: R313817073
customer_note:
currency: USD
locale: en
@@ -2177,8 +3111,9 @@ paths:
display_payment_total: "$0.00"
canceled_at:
approved_at:
- created_at: '2026-04-29T10:50:00.499Z'
- updated_at: '2026-04-29T10:50:00.543Z'
+ created_at: '2026-04-29T15:59:48.938Z'
+ updated_at: '2026-04-29T15:59:49.003Z'
+ tags: []
internal_note:
metadata:
approver_id:
@@ -2297,8 +3232,8 @@ paths:
data:
- id: or_UkLWZg9DAJ
market_id:
- number: R030728080
+ number: R488598395
customer_note:
currency: USD
locale: en
@@ -2340,8 +3275,9 @@ paths:
display_payment_total: "$0.00"
canceled_at:
approved_at:
- created_at: '2026-04-29T10:50:02.264Z'
- updated_at: '2026-04-29T10:50:02.264Z'
+ created_at: '2026-04-29T15:59:50.803Z'
+ updated_at: '2026-04-29T15:59:50.803Z'
+ tags: []
internal_note:
metadata:
approver_id:
@@ -2401,7 +3337,7 @@ paths:
example:
id: or_gbHJdmfrXB
market_id:
- number: R195052535
+ number: R032689850
customer_note:
currency: USD
@@ -2444,8 +3380,9 @@ paths:
display_payment_total: "$0.00"
canceled_at:
approved_at:
- created_at: '2026-04-29T10:50:03.379Z'
- updated_at: '2026-04-29T10:50:03.379Z'
+ created_at: '2026-04-29T15:59:51.934Z'
+ updated_at: '2026-04-29T15:59:51.934Z'
+ tags: []
internal_note:
metadata:
approver_id:
@@ -2591,8 +3528,8 @@ paths:
example:
id: or_UkLWZg9DAJ
market_id:
- number: R674454839
+ number: R785858912
customer_note:
currency: USD
locale: en
@@ -2634,8 +3571,9 @@ paths:
display_payment_total: "$0.00"
canceled_at:
approved_at:
- created_at: '2026-04-29T10:50:03.664Z'
- updated_at: '2026-04-29T10:50:03.664Z'
+ created_at: '2026-04-29T15:59:52.213Z'
+ updated_at: '2026-04-29T15:59:52.213Z'
+ tags: []
internal_note:
metadata:
approver_id:
@@ -2687,7 +3625,7 @@ paths:
example:
id: or_UkLWZg9DAJ
market_id:
- number: R711176664
+ number: R277507018
customer_note:
currency: USD
@@ -2730,8 +3668,9 @@ paths:
display_payment_total: "$0.00"
canceled_at:
approved_at:
- created_at: '2026-04-29T10:50:04.785Z'
- updated_at: '2026-04-29T10:50:05.065Z'
+ created_at: '2026-04-29T15:59:53.337Z'
+ updated_at: '2026-04-29T15:59:53.623Z'
+ tags: []
internal_note:
metadata:
approver_id:
@@ -2788,15 +3727,21 @@ paths:
type: string
phone:
type: string
- line_items:
+ items:
type: array
items:
type: object
+ required:
+ - variant_id
properties:
variant_id:
type: string
+ description: Variant prefixed ID
quantity:
type: integer
+ example: 1
+ metadata:
+ type: object
delete:
summary: Delete a draft order
tags:
@@ -2861,8 +3806,8 @@ paths:
example:
id: or_UkLWZg9DAJ
market_id:
- number: R330207027
+ number: R094301972
customer_note:
currency: USD
locale: en
@@ -2889,7 +3834,7 @@ paths:
display_delivery_total: "$10.00"
fulfillment_status: canceled
payment_status: void
- completed_at: '2026-04-29T10:50:05.943Z'
+ completed_at: '2026-04-29T15:59:54.558Z'
store_credit_total: '0.0'
display_store_credit_total: "$0.00"
covered_by_store_credit: false
@@ -2902,10 +3847,11 @@ paths:
store_owner_notification_delivered:
payment_total: '0.0'
display_payment_total: "$0.00"
- canceled_at: '2026-04-29T10:50:06.232Z'
+ canceled_at: '2026-04-29T15:59:54.857Z'
approved_at:
- created_at: '2026-04-29T10:50:05.897Z'
- updated_at: '2026-04-29T10:50:06.270Z'
+ created_at: '2026-04-29T15:59:54.492Z'
+ updated_at: '2026-04-29T15:59:54.904Z'
+ tags: []
internal_note:
metadata:
approver_id:
@@ -2947,8 +3893,8 @@ paths:
example:
id: or_UkLWZg9DAJ
market_id:
- number: R406004585
+ number: R143148128
customer_note:
currency: USD
locale: en
@@ -2975,7 +3921,7 @@ paths:
display_delivery_total: "$100.00"
fulfillment_status:
payment_status:
- completed_at: '2026-04-29T10:50:06.589Z'
+ completed_at: '2026-04-29T15:59:55.252Z'
store_credit_total: '0.0'
display_store_credit_total: "$0.00"
covered_by_store_credit: false
@@ -2989,9 +3935,10 @@ paths:
payment_total: '0.0'
display_payment_total: "$0.00"
canceled_at:
- approved_at: '2026-04-29T10:50:06.873Z'
- created_at: '2026-04-29T10:50:06.546Z'
- updated_at: '2026-04-29T10:50:06.589Z'
+ approved_at: '2026-04-29T15:59:55.541Z'
+ created_at: '2026-04-29T15:59:55.202Z'
+ updated_at: '2026-04-29T15:59:55.251Z'
+ tags: []
internal_note:
metadata:
approver_id: admin_UkLWZg9DAJ
@@ -3033,8 +3980,8 @@ paths:
example:
id: or_UkLWZg9DAJ
market_id:
- number: R618787001
+ number: R889473296
customer_note:
currency: USD
locale: en
@@ -3061,7 +4008,7 @@ paths:
display_delivery_total: "$10.00"
fulfillment_status: canceled
payment_status: void
- completed_at: '2026-04-29T10:50:07.206Z'
+ completed_at: '2026-04-29T15:59:55.893Z'
store_credit_total: '0.0'
display_store_credit_total: "$0.00"
covered_by_store_credit: false
@@ -3074,10 +4021,11 @@ paths:
store_owner_notification_delivered:
payment_total: '0.0'
display_payment_total: "$0.00"
- canceled_at: '2026-04-29T10:50:07.484Z'
+ canceled_at: '2026-04-29T15:59:56.173Z'
approved_at:
- created_at: '2026-04-29T10:50:07.150Z'
- updated_at: '2026-04-29T10:50:07.546Z'
+ created_at: '2026-04-29T15:59:55.837Z'
+ updated_at: '2026-04-29T15:59:56.280Z'
+ tags: []
internal_note:
metadata:
approver_id:
@@ -3120,8 +4068,8 @@ paths:
example:
id: or_UkLWZg9DAJ
market_id:
- number: R228062904
+ number: R880168377
customer_note:
currency: USD
locale: en
@@ -3148,7 +4096,7 @@ paths:
display_delivery_total: "$100.00"
fulfillment_status:
payment_status:
- completed_at: '2026-04-29T10:50:07.872Z'
+ completed_at: '2026-04-29T15:59:56.626Z'
store_credit_total: '0.0'
display_store_credit_total: "$0.00"
covered_by_store_credit: false
@@ -3163,14 +4111,103 @@ paths:
display_payment_total: "$0.00"
canceled_at:
approved_at:
- created_at: '2026-04-29T10:50:07.823Z'
- updated_at: '2026-04-29T10:50:07.871Z'
+ created_at: '2026-04-29T15:59:56.568Z'
+ updated_at: '2026-04-29T15:59:56.626Z'
+ tags: []
internal_note:
metadata:
approver_id:
canceler_id:
created_by_id:
customer_id: cus_UkLWZg9DAJ
+ "/api/v3/admin/payment_methods":
+ get:
+ summary: List payment methods
+ tags:
+ - Payment Methods
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: 'Returns the store''s configured payment methods. Use `source_required:
+ true` to know which methods need a saved source.'
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: payment methods found
+ content:
+ application/json:
+ example:
+ data:
+ - id: pm_UkLWZg9DAJ
+ name: Check
+ description:
+ type: Spree::PaymentMethod::Check
+ session_required: false
+ source_required: false
+ active: true
+ auto_capture:
+ created_at: '2026-04-29T15:59:56.924Z'
+ updated_at: '2026-04-29T15:59:56.925Z'
+ meta:
+ page: 1
+ limit: 25
+ count: 1
+ pages: 1
+ from: 1
+ to: 1
+ in: 1
+ previous:
+ next:
+ "/api/v3/admin/payment_methods/{id}":
+ get:
+ summary: Show a payment method
+ tags:
+ - Payment Methods
+ security:
+ - api_key: []
+ bearer_auth: []
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: payment method found
+ content:
+ application/json:
+ example:
+ id: pm_UkLWZg9DAJ
+ name: Check
+ description:
+ type: Spree::PaymentMethod::Check
+ session_required: false
+ source_required: false
+ active: true
+ auto_capture:
+ created_at: '2026-04-29T15:59:57.207Z'
+ updated_at: '2026-04-29T15:59:57.208Z'
"/api/v3/admin/products":
get:
summary: List products
@@ -3236,33 +4273,35 @@ paths:
example:
data:
- id: prod_UkLWZg9DAJ
- name: Product 353214
- slug: product-353214
+ name: Product 351940
+ slug: product-351940
meta_description:
meta_keywords:
variant_count: 0
- available_on: '2025-04-29T10:50:09.803Z'
+ available_on: '2025-04-29T15:59:59.242Z'
purchasable: true
in_stock: false
backorderable: true
available: true
- description: Nam quis placeat temporibus libero nisi in. Possimus
- maiores maxime quam vel asperiores dolorem. Beatae occaecati animi
- eius incidunt at. Omnis magnam non nesciunt aliquid. Odio soluta
- id odit omnis excepturi. Dolore optio possimus sunt explicabo
- eaque voluptatem recusandae. Minus impedit nobis distinctio accusamus.
- Odit asperiores optio itaque laboriosam veniam. Ab et ex fuga
- illo ducimus. Laboriosam voluptates modi magnam eligendi assumenda
- quo quis. Quidem provident perferendis architecto vero. Illo eveniet
- omnis reiciendis voluptatem explicabo. Unde corrupti consequuntur
- facere quia. Pariatur eius aliquid voluptatem ut praesentium quisquam.
- Ea delectus placeat fugiat sed voluptate perferendis consequuntur.
- Beatae recusandae repellat quibusdam laborum velit.
+ description: A ipsum vitae iusto laborum corrupti tenetur ex quaerat.
+ Repellendus architecto tempora cupiditate quisquam dignissimos
+ maiores. Debitis repellendus libero incidunt iste fugit maxime
+ beatae atque. Voluptas optio consectetur modi quas debitis suscipit
+ eos cupiditate. Ea quis autem recusandae sit quae. Aut possimus
+ alias doloremque eveniet velit harum nisi. Officia fuga cum dolores
+ quaerat dolorem expedita laboriosam. Amet consequuntur vel voluptates
+ maiores nihil voluptatem. Rerum voluptatem rem officiis ullam.
+ Nam ipsum libero necessitatibus modi. Labore officia ipsam iste
+ illo ad sed ullam qui. Eos sed corrupti voluptatum alias voluptate
+ ipsa. Iure nulla fugit tempore pariatur praesentium veritatis.
+ Consequatur esse cumque dolores veritatis. Ut dicta in ipsum vero
+ provident illo corrupti. Earum nihil rerum quisquam provident
+ nisi vero quod.
description_html: |-
- Nam quis placeat temporibus libero nisi in. Possimus maiores maxime quam vel asperiores dolorem. Beatae occaecati animi eius incidunt at. Omnis magnam non nesciunt aliquid.
- Odio soluta id odit omnis excepturi. Dolore optio possimus sunt explicabo eaque voluptatem recusandae. Minus impedit nobis distinctio accusamus.
- Odit asperiores optio itaque laboriosam veniam. Ab et ex fuga illo ducimus. Laboriosam voluptates modi magnam eligendi assumenda quo quis. Quidem provident perferendis architecto vero. Illo eveniet omnis reiciendis voluptatem explicabo.
- Unde corrupti consequuntur facere quia. Pariatur eius aliquid voluptatem ut praesentium quisquam. Ea delectus placeat fugiat sed voluptate perferendis consequuntur. Beatae recusandae repellat quibusdam laborum velit.
+ A ipsum vitae iusto laborum corrupti tenetur ex quaerat. Repellendus architecto tempora cupiditate quisquam dignissimos maiores. Debitis repellendus libero incidunt iste fugit maxime beatae atque. Voluptas optio consectetur modi quas debitis suscipit eos cupiditate.
+ Ea quis autem recusandae sit quae. Aut possimus alias doloremque eveniet velit harum nisi. Officia fuga cum dolores quaerat dolorem expedita laboriosam. Amet consequuntur vel voluptates maiores nihil voluptatem.
+ Rerum voluptatem rem officiis ullam. Nam ipsum libero necessitatibus modi. Labore officia ipsam iste illo ad sed ullam qui. Eos sed corrupti voluptatum alias voluptate ipsa.
+ Iure nulla fugit tempore pariatur praesentium veritatis. Consequatur esse cumque dolores veritatis. Ut dicta in ipsum vero provident illo corrupti. Earum nihil rerum quisquam provident nisi vero quod.
default_variant_id: variant_UkLWZg9DAJ
thumbnail_url:
tags: []
@@ -3277,15 +4316,15 @@ paths:
display_compare_at_amount:
price_list_id:
variant_id: variant_UkLWZg9DAJ
- created_at: '2026-04-29T10:50:09.850Z'
- updated_at: '2026-04-29T10:50:09.850Z'
+ created_at: '2026-04-29T15:59:59.275Z'
+ updated_at: '2026-04-29T15:59:59.275Z'
original_price:
status: active
- make_active_at: '2025-04-29T10:50:09.803Z'
+ make_active_at: '2025-04-29T15:59:59.242Z'
discontinue_on:
deleted_at:
- created_at: '2026-04-29T10:50:09.839Z'
- updated_at: '2026-04-29T10:50:09.851Z'
+ created_at: '2026-04-29T15:59:59.254Z'
+ updated_at: '2026-04-29T15:59:59.276Z'
cost_price: '17.0'
cost_currency: USD
meta:
@@ -3377,15 +4416,15 @@ paths:
display_compare_at_amount:
price_list_id:
variant_id: variant_gbHJdmfrXB
- created_at: '2026-04-29T10:50:10.495Z'
- updated_at: '2026-04-29T10:50:10.495Z'
+ created_at: '2026-04-29T15:59:59.954Z'
+ updated_at: '2026-04-29T15:59:59.954Z'
original_price:
status: draft
make_active_at:
discontinue_on:
deleted_at:
- created_at: '2026-04-29T10:50:10.493Z'
- updated_at: '2026-04-29T10:50:10.499Z'
+ created_at: '2026-04-29T15:59:59.953Z'
+ updated_at: '2026-04-29T15:59:59.959Z'
cost_price:
cost_currency: USD
schema:
@@ -3523,24 +4562,35 @@ paths:
application/json:
example:
id: prod_UkLWZg9DAJ
- name: Product 392371
- slug: product-392371
+ name: Product 39711
+ slug: product-39711
meta_description:
meta_keywords:
variant_count: 0
- available_on: '2025-04-29T10:50:10.835Z'
+ available_on: '2025-04-29T16:00:00.337Z'
purchasable: true
in_stock: false
backorderable: true
available: true
- description: Doloremque ratione unde inventore cumque at nostrum.
- Consequatur repudiandae aspernatur pariatur cum. Suscipit unde fugiat
- sint itaque quibusdam dolorum. Maiores cupiditate alias sint quaerat
- minus harum. Pariatur saepe veniam odio voluptas ducimus vero itaque.
- description_html: Doloremque ratione unde inventore cumque at nostrum.
- Consequatur repudiandae aspernatur pariatur cum. Suscipit unde fugiat
- sint itaque quibusdam dolorum. Maiores cupiditate alias sint quaerat
- minus harum. Pariatur saepe veniam odio voluptas ducimus vero itaque.
+ description: Fugit a hic molestiae veritatis illum voluptate veniam
+ praesentium. Animi aspernatur aperiam ullam voluptatibus voluptates.
+ Cumque laborum illum quos nulla. Natus aperiam maiores pariatur
+ enim. Impedit nisi molestiae dolores sint. Dolor cupiditate tenetur
+ dignissimos a porro harum. Provident ratione totam sunt pariatur.
+ Distinctio facilis nam quam at beatae impedit atque. Saepe perspiciatis
+ libero laudantium magni. Est sunt vel dignissimos fuga. Necessitatibus
+ fugit assumenda doloremque quae quibusdam. Dolores ducimus ut quos
+ consectetur. Asperiores similique saepe minima rem. Dignissimos
+ laborum fuga odit modi. Maxime inventore nesciunt beatae saepe.
+ Ipsa blanditiis rerum quas magni. Laborum nemo officia itaque ad
+ delectus. Alias accusamus animi maiores expedita autem asperiores
+ perferendis dolores. Debitis maiores nemo enim dolorum veritatis
+ ducimus nisi.
+ description_html: |-
+ Fugit a hic molestiae veritatis illum voluptate veniam praesentium. Animi aspernatur aperiam ullam voluptatibus voluptates. Cumque laborum illum quos nulla. Natus aperiam maiores pariatur enim. Impedit nisi molestiae dolores sint.
+ Dolor cupiditate tenetur dignissimos a porro harum. Provident ratione totam sunt pariatur. Distinctio facilis nam quam at beatae impedit atque. Saepe perspiciatis libero laudantium magni.
+ Est sunt vel dignissimos fuga. Necessitatibus fugit assumenda doloremque quae quibusdam. Dolores ducimus ut quos consectetur. Asperiores similique saepe minima rem. Dignissimos laborum fuga odit modi.
+ Maxime inventore nesciunt beatae saepe. Ipsa blanditiis rerum quas magni. Laborum nemo officia itaque ad delectus. Alias accusamus animi maiores expedita autem asperiores perferendis dolores. Debitis maiores nemo enim dolorum veritatis ducimus nisi.
default_variant_id: variant_UkLWZg9DAJ
thumbnail_url:
tags: []
@@ -3555,15 +4605,15 @@ paths:
display_compare_at_amount:
price_list_id:
variant_id: variant_UkLWZg9DAJ
- created_at: '2026-04-29T10:50:10.862Z'
- updated_at: '2026-04-29T10:50:10.862Z'
+ created_at: '2026-04-29T16:00:00.363Z'
+ updated_at: '2026-04-29T16:00:00.363Z'
original_price:
status: active
- make_active_at: '2025-04-29T10:50:10.835Z'
+ make_active_at: '2025-04-29T16:00:00.338Z'
discontinue_on:
deleted_at:
- created_at: '2026-04-29T10:50:10.849Z'
- updated_at: '2026-04-29T10:50:10.863Z'
+ created_at: '2026-04-29T16:00:00.350Z'
+ updated_at: '2026-04-29T16:00:00.364Z'
cost_price: '17.0'
cost_currency: USD
schema:
@@ -3612,24 +4662,35 @@ paths:
example:
id: prod_UkLWZg9DAJ
name: Updated Name
- slug: product-419167
+ slug: product-416925
meta_description:
meta_keywords:
variant_count: 0
- available_on: '2025-04-29T10:50:11.469Z'
+ available_on: '2025-04-29T16:00:00.997Z'
purchasable: true
in_stock: false
backorderable: true
available: true
- description: Illo accusamus odit est doloremque eum iusto nemo amet.
- Eos sunt voluptas iure ipsam. Quibusdam recusandae cupiditate consectetur
- repellendus est animi neque beatae. Veritatis neque at sint hic
- fuga occaecati officiis. Dicta sit quam exercitationem rem facilis.
- Cupiditate consectetur est quibusdam minima consequatur sit eos
- totam.
+ description: Facere animi deserunt nisi architecto esse. Laborum perferendis
+ neque nisi ea veniam accusantium ullam minima. Saepe odit ducimus
+ nostrum laudantium possimus quia vitae. Reiciendis voluptatem nisi
+ aut dignissimos ratione. Nam et accusantium aut quidem minima rerum.
+ Eaque ipsum accusamus magni facilis sed delectus. Cumque atque corrupti
+ recusandae debitis reprehenderit optio quo esse. Occaecati assumenda
+ delectus saepe nam quibusdam tempore itaque. Voluptatem delectus
+ vitae eius cupiditate. Quasi expedita dignissimos eaque velit. Consequatur
+ sequi quae nisi a explicabo. Excepturi at a quibusdam iste doloremque
+ dignissimos tenetur inventore. Quam quos aliquid aliquam nihil.
+ Voluptatum aspernatur porro occaecati officia. Earum veritatis minus
+ eaque molestias. Animi dolorum harum velit officia id accusantium.
+ Aperiam officiis eos excepturi quia autem nisi. Deleniti voluptatem
+ ratione soluta optio. Possimus cum dolore at magni voluptatem veniam
+ excepturi cumque.
description_html: |-
- Illo accusamus odit est doloremque eum iusto nemo amet. Eos sunt voluptas iure ipsam. Quibusdam recusandae cupiditate consectetur repellendus est animi neque beatae.
- Veritatis neque at sint hic fuga occaecati officiis. Dicta sit quam exercitationem rem facilis. Cupiditate consectetur est quibusdam minima consequatur sit eos totam.
+ Facere animi deserunt nisi architecto esse. Laborum perferendis neque nisi ea veniam accusantium ullam minima. Saepe odit ducimus nostrum laudantium possimus quia vitae. Reiciendis voluptatem nisi aut dignissimos ratione. Nam et accusantium aut quidem minima rerum.
+ Eaque ipsum accusamus magni facilis sed delectus. Cumque atque corrupti recusandae debitis reprehenderit optio quo esse. Occaecati assumenda delectus saepe nam quibusdam tempore itaque. Voluptatem delectus vitae eius cupiditate.
+ Quasi expedita dignissimos eaque velit. Consequatur sequi quae nisi a explicabo. Excepturi at a quibusdam iste doloremque dignissimos tenetur inventore. Quam quos aliquid aliquam nihil. Voluptatum aspernatur porro occaecati officia.
+ Earum veritatis minus eaque molestias. Animi dolorum harum velit officia id accusantium. Aperiam officiis eos excepturi quia autem nisi. Deleniti voluptatem ratione soluta optio. Possimus cum dolore at magni voluptatem veniam excepturi cumque.
default_variant_id: variant_UkLWZg9DAJ
thumbnail_url:
tags: []
@@ -3644,15 +4705,15 @@ paths:
display_compare_at_amount:
price_list_id:
variant_id: variant_UkLWZg9DAJ
- created_at: '2026-04-29T10:50:11.490Z'
- updated_at: '2026-04-29T10:50:11.490Z'
+ created_at: '2026-04-29T16:00:01.028Z'
+ updated_at: '2026-04-29T16:00:01.028Z'
original_price:
status: active
- make_active_at: '2025-04-29T10:50:11.469Z'
+ make_active_at: '2025-04-29T16:00:00.998Z'
discontinue_on:
deleted_at:
- created_at: '2026-04-29T10:50:11.479Z'
- updated_at: '2026-04-29T10:50:11.773Z'
+ created_at: '2026-04-29T16:00:01.013Z'
+ updated_at: '2026-04-29T16:00:01.322Z'
cost_price: '17.0'
cost_currency: USD
schema:
@@ -3775,6 +4836,57 @@ paths:
responses:
'204':
description: product deleted
+ "/api/v3/admin/tags":
+ get:
+ summary: List tags
+ tags:
+ - Tags
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: Returns tag names for a given taggable type. Used for autocomplete
+ in tag inputs on products, orders, and customers.
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: taggable_type
+ in: query
+ required: true
+ description: Taggable type (`Spree::Product`, `Spree::Order`, or `Spree::User`)
+ schema:
+ type: string
+ - name: q
+ in: query
+ required: false
+ description: Optional case-insensitive substring filter
+ schema:
+ type: string
+ responses:
+ '200':
+ description: tags found
+ content:
+ application/json:
+ example:
+ data:
+ - name: vip
+ - name: wholesale
+ '422':
+ description: invalid taggable type
+ content:
+ application/json:
+ example:
+ error:
+ code: invalid_taggable_type
+ message: taggable_type must be one of Spree::Product, Spree::Order,
+ Spree::LegacyUser
"/api/v3/admin/products/{product_id}/variants":
get:
summary: List product variants
@@ -3861,9 +4973,9 @@ paths:
cost_price: '17.0'
cost_currency: USD
deleted_at:
- created_at: '2026-04-29T10:50:14.155Z'
- updated_at: '2026-04-29T10:50:14.167Z'
- product_name: Product 495198
+ created_at: '2026-04-29T16:00:04.990Z'
+ updated_at: '2026-04-29T16:00:05.005Z'
+ product_name: Product 496230
display_price: "$0.00"
- id: variant_gbHJdmfrXB
product_id: prod_UkLWZg9DAJ
@@ -3875,10 +4987,10 @@ paths:
purchasable: true
in_stock: false
backorderable: true
- weight: 170.24
- height: 136.9
- width: 180.2
- depth: 130.7
+ weight: 36.72
+ height: 157.38
+ width: 112.26
+ depth: 120.53
price:
id: price_gbHJdmfrXB
amount: '19.99'
@@ -3900,17 +5012,17 @@ paths:
option_type_name: foo-size-21
option_type_label: Size
image_url:
- created_at: '2026-04-29T10:50:14.175Z'
- updated_at: '2026-04-29T10:50:14.175Z'
+ created_at: '2026-04-29T16:00:05.016Z'
+ updated_at: '2026-04-29T16:00:05.016Z'
position: 2
total_on_hand: 0
tax_category_id: 1
cost_price: '17.0'
cost_currency: USD
deleted_at:
- created_at: '2026-04-29T10:50:14.173Z'
- updated_at: '2026-04-29T10:50:14.185Z'
- product_name: Product 495198
+ created_at: '2026-04-29T16:00:05.014Z'
+ updated_at: '2026-04-29T16:00:05.029Z'
+ product_name: Product 496230
display_price: "$19.99"
meta:
page: 1
@@ -3993,17 +5105,17 @@ paths:
option_type_name: size
option_type_label: Size
image_url:
- created_at: '2026-04-29T10:50:14.818Z'
- updated_at: '2026-04-29T10:50:14.818Z'
+ created_at: '2026-04-29T16:00:05.682Z'
+ updated_at: '2026-04-29T16:00:05.682Z'
position: 3
total_on_hand: 0
tax_category_id: 1
cost_price:
cost_currency: USD
deleted_at:
- created_at: '2026-04-29T10:50:14.822Z'
- updated_at: '2026-04-29T10:50:14.823Z'
- product_name: Product 501525
+ created_at: '2026-04-29T16:00:05.686Z'
+ updated_at: '2026-04-29T16:00:05.688Z'
+ product_name: Product 501527
display_price: "$24.99"
'422':
description: validation error
@@ -4161,10 +5273,10 @@ paths:
purchasable: true
in_stock: false
backorderable: true
- weight: 150.52
- height: 82.94
- width: 93.3
- depth: 16.86
+ weight: 112.88
+ height: 74.83
+ width: 191.92
+ depth: 80.98
price:
id: price_gbHJdmfrXB
amount: '19.99'
@@ -4186,17 +5298,17 @@ paths:
option_type_name: foo-size-24
option_type_label: Size
image_url:
- created_at: '2026-04-29T10:50:15.207Z'
- updated_at: '2026-04-29T10:50:15.207Z'
+ created_at: '2026-04-29T16:00:06.186Z'
+ updated_at: '2026-04-29T16:00:06.186Z'
position: 2
total_on_hand: 0
tax_category_id: 1
cost_price: '17.0'
cost_currency: USD
deleted_at:
- created_at: '2026-04-29T10:50:15.205Z'
- updated_at: '2026-04-29T10:50:15.216Z'
- product_name: Product 527565
+ created_at: '2026-04-29T16:00:06.184Z'
+ updated_at: '2026-04-29T16:00:06.199Z'
+ product_name: Product 524166
display_price: "$19.99"
'404':
description: variant not found
@@ -4256,10 +5368,10 @@ paths:
purchasable: true
in_stock: false
backorderable: true
- weight: 39.23
- height: 1.27
- width: 7.62
- depth: 169.62
+ weight: 130.34
+ height: 106.5
+ width: 7.87
+ depth: 181.87
price:
id: price_gbHJdmfrXB
amount: '19.99'
@@ -4281,17 +5393,17 @@ paths:
option_type_name: foo-size-26
option_type_label: Size
image_url:
- created_at: '2026-04-29T10:50:15.903Z'
- updated_at: '2026-04-29T10:50:15.903Z'
+ created_at: '2026-04-29T16:00:06.891Z'
+ updated_at: '2026-04-29T16:00:06.891Z'
position: 2
total_on_hand: 0
tax_category_id: 1
cost_price: '17.0'
cost_currency: USD
deleted_at:
- created_at: '2026-04-29T10:50:15.900Z'
- updated_at: '2026-04-29T10:50:16.194Z'
- product_name: Product 545252
+ created_at: '2026-04-29T16:00:06.889Z'
+ updated_at: '2026-04-29T16:00:07.186Z'
+ product_name: Product 548526
display_price: "$19.99"
requestBody:
content:
@@ -4439,6 +5551,18 @@ tags:
description: Apply / remove gift cards on an order
- name: Order Store Credits
description: Apply / remove customer store credit on an order
+- name: Customers
+ description: Customer management — profile, tags, marketing consent, notes
+- name: Customer Addresses
+ description: Saved address book per customer with default billing/shipping flags
+- name: Customer Store Credits
+ description: Per-customer store credit balances issued by admin
+- name: Customer Credit Cards
+ description: Customer's saved credit cards (read-only)
+- name: Payment Methods
+ description: Store-configured payment methods (read-only)
+- name: Tags
+ description: Tag autocomplete for product/order/customer tag inputs
x-tagGroups:
- name: Authentication
tags:
@@ -4459,6 +5583,16 @@ x-tagGroups:
- Fulfillments
- Order Gift Cards
- Order Store Credits
+- name: Customers
+ tags:
+ - Customers
+ - Customer Addresses
+ - Customer Store Credits
+ - Customer Credit Cards
+- name: Configuration
+ tags:
+ - Payment Methods
+ - Tags
components:
securitySchemes:
api_key:
@@ -5087,6 +6221,8 @@ components:
nullable: true
accepts_email_marketing:
type: boolean
+ full_name:
+ type: string
available_store_credit_total:
type: string
display_available_store_credit_total:
@@ -5126,10 +6262,39 @@ components:
current_sign_in_ip:
type: string
nullable: true
+ tags:
+ type: array
+ items:
+ type: string
+ internal_note_html:
+ type: string
+ nullable: true
+ metadata:
+ type: object
+ nullable: true
+ default_billing_address_id:
+ type: string
+ nullable: true
+ default_shipping_address_id:
+ type: string
+ nullable: true
+ orders_count:
+ type: number
+ total_spent:
+ type: string
+ display_total_spent:
+ type: string
+ last_order_completed_at:
+ type: string
+ nullable: true
orders:
type: array
items:
"$ref": "#/components/schemas/Order"
+ store_credits:
+ type: array
+ items:
+ "$ref": "#/components/schemas/StoreCredit"
required:
- id
- email
@@ -5137,6 +6302,7 @@ components:
- last_name
- phone
- accepts_email_marketing
+ - full_name
- available_store_credit_total
- display_available_store_credit_total
- login
@@ -5148,6 +6314,15 @@ components:
- failed_attempts
- last_sign_in_ip
- current_sign_in_ip
+ - tags
+ - internal_note_html
+ - metadata
+ - default_billing_address_id
+ - default_shipping_address_id
+ - orders_count
+ - total_spent
+ - display_total_spent
+ - last_order_completed_at
x-typelizer: true
DeliveryMethod:
type: object
@@ -5539,11 +6714,6 @@ components:
tax_category_id:
type: string
nullable: true
- order_id:
- type: string
- nullable: true
- order:
- "$ref": "#/components/schemas/Order"
variant:
"$ref": "#/components/schemas/Variant"
tax_category:
@@ -5586,7 +6756,6 @@ components:
- metadata
- cost_price
- tax_category_id
- - order_id
x-typelizer: true
Market:
type: object
@@ -5912,6 +7081,10 @@ components:
type: string
updated_at:
type: string
+ tags:
+ type: array
+ items:
+ type: string
internal_note:
type: string
nullable: true
@@ -6002,6 +7175,7 @@ components:
- approved_at
- created_at
- updated_at
+ - tags
- internal_note
- metadata
- approver_id
@@ -6023,6 +7197,8 @@ components:
type: string
session_required:
type: boolean
+ source_required:
+ type: boolean
active:
type: boolean
auto_capture:
@@ -6038,6 +7214,7 @@ components:
- description
- type
- session_required
+ - source_required
- active
- auto_capture
- created_at
diff --git a/docs/api-reference/store.yaml b/docs/api-reference/store.yaml
index 9e40f17c99..d347eaf18d 100644
--- a/docs/api-reference/store.yaml
+++ b/docs/api-reference/store.yaml
@@ -79,8 +79,8 @@ paths:
label: Admin discount
display_amount: "$0.00"
included: false
- created_at: '2026-04-29T10:49:45.205Z'
- updated_at: '2026-04-29T10:49:45.212Z'
+ created_at: '2026-04-29T15:59:32.503Z'
+ updated_at: '2026-04-29T15:59:32.510Z'
amount: '0.0'
order_id: or_UkLWZg9DAJ
meta:
@@ -136,8 +136,8 @@ paths:
label: Admin discount
display_amount: "$0.00"
included: false
- created_at: '2026-04-29T10:49:45.775Z'
- updated_at: '2026-04-29T10:49:45.779Z'
+ created_at: '2026-04-29T15:59:33.096Z'
+ updated_at: '2026-04-29T15:59:33.098Z'
amount: '0.0'
order_id: or_UkLWZg9DAJ
"/api/v3/admin/products/{product_id}/media":
@@ -203,8 +203,8 @@ paths:
large_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--3b629ef2aa813d248c6f5821ac29239af940250f/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOls3MjAsNzIwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--2a20e958723b87ff75d0681199260faa9b1fdcd1/thinking-cat.jpg
xlarge_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--3b629ef2aa813d248c6f5821ac29239af940250f/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsyMDAwLDIwMDBdLCJzYXZlciI6eyJzdHJpcCI6dHJ1ZSwicXVhbGl0eSI6NzUsImxvc3NsZXNzIjpmYWxzZSwiYWxwaGFfcSI6ODUsInJlZHVjdGlvbl9lZmZvcnQiOjYsInNtYXJ0X3N1YnNhbXBsZSI6dHJ1ZX19LCJwdXIiOiJ2YXJpYXRpb24ifX0=--ddd095e8f694911905f100ba0f63bd3131a293ce/thinking-cat.jpg
og_image_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--3b629ef2aa813d248c6f5821ac29239af940250f/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsxMjAwLDYzMF0sInNhdmVyIjp7InN0cmlwIjp0cnVlLCJxdWFsaXR5Ijo3NSwibG9zc2xlc3MiOmZhbHNlLCJhbHBoYV9xIjo4NSwicmVkdWN0aW9uX2VmZm9ydCI6Niwic21hcnRfc3Vic2FtcGxlIjp0cnVlfX0sInB1ciI6InZhcmlhdGlvbiJ9fQ==--132b3a0a2b76bb0a03fa5fe8d337136a7ec3a980/thinking-cat.jpg
- created_at: '2026-04-29T10:50:08.202Z'
- updated_at: '2026-04-29T10:50:08.204Z'
+ created_at: '2026-04-29T15:59:57.579Z'
+ updated_at: '2026-04-29T15:59:57.584Z'
viewable_id: variant_UkLWZg9DAJ
viewable_type: Spree::Variant
meta:
@@ -336,8 +336,8 @@ paths:
large_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--3b629ef2aa813d248c6f5821ac29239af940250f/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOls3MjAsNzIwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--2a20e958723b87ff75d0681199260faa9b1fdcd1/thinking-cat.jpg
xlarge_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--3b629ef2aa813d248c6f5821ac29239af940250f/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsyMDAwLDIwMDBdLCJzYXZlciI6eyJzdHJpcCI6dHJ1ZSwicXVhbGl0eSI6NzUsImxvc3NsZXNzIjpmYWxzZSwiYWxwaGFfcSI6ODUsInJlZHVjdGlvbl9lZmZvcnQiOjYsInNtYXJ0X3N1YnNhbXBsZSI6dHJ1ZX19LCJwdXIiOiJ2YXJpYXRpb24ifX0=--ddd095e8f694911905f100ba0f63bd3131a293ce/thinking-cat.jpg
og_image_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--3b629ef2aa813d248c6f5821ac29239af940250f/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsxMjAwLDYzMF0sInNhdmVyIjp7InN0cmlwIjp0cnVlLCJxdWFsaXR5Ijo3NSwibG9zc2xlc3MiOmZhbHNlLCJhbHBoYV9xIjo4NSwicmVkdWN0aW9uX2VmZm9ydCI6Niwic21hcnRfc3Vic2FtcGxlIjp0cnVlfX0sInB1ciI6InZhcmlhdGlvbiJ9fQ==--132b3a0a2b76bb0a03fa5fe8d337136a7ec3a980/thinking-cat.jpg
- created_at: '2026-04-29T10:50:09.172Z'
- updated_at: '2026-04-29T10:50:09.464Z'
+ created_at: '2026-04-29T15:59:58.609Z'
+ updated_at: '2026-04-29T15:59:58.899Z'
viewable_id: variant_UkLWZg9DAJ
viewable_type: Spree::Variant
requestBody:
@@ -456,8 +456,8 @@ paths:
large_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--3b629ef2aa813d248c6f5821ac29239af940250f/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOls3MjAsNzIwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--2a20e958723b87ff75d0681199260faa9b1fdcd1/thinking-cat.jpg
xlarge_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--3b629ef2aa813d248c6f5821ac29239af940250f/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsyMDAwLDIwMDBdLCJzYXZlciI6eyJzdHJpcCI6dHJ1ZSwicXVhbGl0eSI6NzUsImxvc3NsZXNzIjpmYWxzZSwiYWxwaGFfcSI6ODUsInJlZHVjdGlvbl9lZmZvcnQiOjYsInNtYXJ0X3N1YnNhbXBsZSI6dHJ1ZX19LCJwdXIiOiJ2YXJpYXRpb24ifX0=--ddd095e8f694911905f100ba0f63bd3131a293ce/thinking-cat.jpg
og_image_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--3b629ef2aa813d248c6f5821ac29239af940250f/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsxMjAwLDYzMF0sInNhdmVyIjp7InN0cmlwIjp0cnVlLCJxdWFsaXR5Ijo3NSwibG9zc2xlc3MiOmZhbHNlLCJhbHBoYV9xIjo4NSwicmVkdWN0aW9uX2VmZm9ydCI6Niwic21hcnRfc3Vic2FtcGxlIjp0cnVlfX0sInB1ciI6InZhcmlhdGlvbiJ9fQ==--132b3a0a2b76bb0a03fa5fe8d337136a7ec3a980/thinking-cat.jpg
- created_at: '2026-04-29T10:50:12.463Z'
- updated_at: '2026-04-29T10:50:12.465Z'
+ created_at: '2026-04-29T16:00:03.230Z'
+ updated_at: '2026-04-29T16:00:03.232Z'
viewable_id: variant_gbHJdmfrXB
viewable_type: Spree::Variant
meta:
@@ -601,8 +601,8 @@ paths:
large_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--3b629ef2aa813d248c6f5821ac29239af940250f/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOls3MjAsNzIwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--2a20e958723b87ff75d0681199260faa9b1fdcd1/thinking-cat.jpg
xlarge_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--3b629ef2aa813d248c6f5821ac29239af940250f/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsyMDAwLDIwMDBdLCJzYXZlciI6eyJzdHJpcCI6dHJ1ZSwicXVhbGl0eSI6NzUsImxvc3NsZXNzIjpmYWxzZSwiYWxwaGFfcSI6ODUsInJlZHVjdGlvbl9lZmZvcnQiOjYsInNtYXJ0X3N1YnNhbXBsZSI6dHJ1ZX19LCJwdXIiOiJ2YXJpYXRpb24ifX0=--ddd095e8f694911905f100ba0f63bd3131a293ce/thinking-cat.jpg
og_image_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--3b629ef2aa813d248c6f5821ac29239af940250f/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsxMjAwLDYzMF0sInNhdmVyIjp7InN0cmlwIjp0cnVlLCJxdWFsaXR5Ijo3NSwibG9zc2xlc3MiOmZhbHNlLCJhbHBoYV9xIjo4NSwicmVkdWN0aW9uX2VmZm9ydCI6Niwic21hcnRfc3Vic2FtcGxlIjp0cnVlfX0sInB1ciI6InZhcmlhdGlvbiJ9fQ==--132b3a0a2b76bb0a03fa5fe8d337136a7ec3a980/thinking-cat.jpg
- created_at: '2026-04-29T10:50:13.491Z'
- updated_at: '2026-04-29T10:50:13.774Z'
+ created_at: '2026-04-29T16:00:04.299Z'
+ updated_at: '2026-04-29T16:00:04.592Z'
viewable_id: variant_gbHJdmfrXB
viewable_type: Spree::Variant
requestBody:
@@ -720,56 +720,56 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 63 Lovely Street
+ address1: 67 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
- country_name: NAME_23
- country_iso: I23
- state_text: STATE_ABBR_92
- state_abbr: STATE_ABBR_92
+ country_name: United States of America
+ country_iso: US
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_92
+ state_name: New York
- id: addr_gbHJdmfrXB
first_name: John
last_name: Doe
full_name: John Doe
- address1: 62 Lovely Street
+ address1: 66 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_94
- state_abbr: STATE_ABBR_94
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: true
is_default_shipping: false
- state_name: STATE_NAME_94
+ state_name: New York
- id: addr_UkLWZg9DAJ
first_name: John
last_name: Doe
full_name: John Doe
- address1: 61 Lovely Street
+ address1: 65 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_93
- state_abbr: STATE_ABBR_93
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: true
- state_name: STATE_NAME_93
+ state_name: New York
meta:
page: 1
limit: 25
@@ -857,14 +857,14 @@ paths:
city: New York
phone: "+1 555 123 4567"
company:
- country_name: NAME_25
- country_iso: I25
- state_text: STATE_ABBR_98
- state_abbr: STATE_ABBR_98
+ country_name: United States of America
+ country_iso: US
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_98
+ state_name: New York
schema:
"$ref": "#/components/schemas/Address"
'422':
@@ -1005,20 +1005,20 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 75 Lovely Street
+ address1: 79 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
- country_name: NAME_27
- country_iso: I27
- state_text: STATE_ABBR_104
- state_abbr: STATE_ABBR_104
+ country_name: United States of America
+ country_iso: US
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_104
+ state_name: New York
schema:
"$ref": "#/components/schemas/Address"
'404':
@@ -1080,20 +1080,20 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 81 Lovely Street
+ address1: 85 Lovely Street
address2: Northwest
- postal_code: '35005'
+ postal_code: '10118'
city: Los Angeles
phone: 555-555-0199
company: Company
- country_name: NAME_29
- country_iso: I29
- state_text: STATE_ABBR_110
- state_abbr: STATE_ABBR_110
+ country_name: United States of America
+ country_iso: US
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_110
+ state_name: New York
schema:
"$ref": "#/components/schemas/Address"
requestBody:
@@ -1208,15 +1208,16 @@ paths:
content:
application/json:
example:
- token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6ImIzMjVlY2M0LWQxMDYtNDNlNi05MDc4LWM5ZGI0MDc5YzAyYSIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzc3NDYzNDIyfQ.D8X3NHrqCn3i5fgFgdpwa2Sjfc8UG5_yUk3HuiDI-7w
- refresh_token: JSYM5Q3NLy497JKBnAWDRSey
+ token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6IjBkN2ZkNGY4LWM3MjAtNDZlNS05OWM4LTk5ODQ1NThlN2Y0ZiIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzc3NDgyMDEzfQ.rSgbM_4Burg-CxDBtJdl-zhm-dmwW2i8i3BH5VE8m78
+ refresh_token: wCxXpbHe4qCGW8kCmGwF1TBZ
user:
id: cus_UkLWZg9DAJ
- first_name: Keesha
- last_name: Robel
+ first_name: Brent
+ last_name: Howell
phone:
accepts_email_marketing: false
+ full_name: Brent Howell
available_store_credit_total: '0'
display_available_store_credit_total: "$0.00"
addresses: []
@@ -1289,15 +1290,16 @@ paths:
content:
application/json:
example:
- token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6ImIwZTYxNDAxLTMyMGMtNDNmOC1hMTg0LThjNzE0NDFlM2Q4MiIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzc3NDYzNDIzfQ.RuLvcqp7kj2E28wmG3soWhE4deoWKew0eCPCvriyREc
- refresh_token: tDvpvuuhRZYPLHCTj9KuE1PT
+ token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6IjkxMjkxN2U4LTkzY2QtNDk4Yi05YzlkLTkwMmNlNTY4ZDMxOSIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzc3NDgyMDE0fQ.iNMfHrigR-mVxbt7gnYGxM5Qziq9rq5K9Q_sSEaJq8U
+ refresh_token: ig5mKBAuVE5MemW2UaubSick
user:
id: cus_UkLWZg9DAJ
- first_name: Coralie
- last_name: Botsford
+ first_name: Bernadine
+ last_name: Doyle
phone:
accepts_email_marketing: false
+ full_name: Bernadine Doyle
available_store_credit_total: '0'
display_available_store_credit_total: "$0.00"
addresses: []
@@ -1461,9 +1463,9 @@ paths:
data:
- id: cart_gbHJdmfrXB
market_id:
- number: R471470566
- token: HafFjQfHw7jCvEUWDaqPy8kvQm9QbvDZpcG
+ number: R496917299
+ token: 14v8s9wyYvneSSMd6DD5r2LtMDguAnDm9u6
customer_note:
currency: USD
locale: en
@@ -1505,8 +1507,8 @@ paths:
variant_id: variant_gbHJdmfrXB
quantity: 1
currency: USD
- name: Product 579559
- slug: product-579559
+ name: Product 579733
+ slug: product-579733
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -1531,7 +1533,7 @@ paths:
digital_links: []
fulfillments:
- id: ful_gbHJdmfrXB
- number: H74595238338
+ number: H64308445398
tracking: U10000
tracking_url:
cost: '100.0'
@@ -1559,14 +1561,14 @@ paths:
code: UPS_GROUND
stock_location:
id: sloc_UkLWZg9DAJ
- state_abbr: STATE_ABBR_123
- name: Joelle Padberg
+ state_abbr: NY
+ name: Shanel Schaefer
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
country_iso: US
country_name: United States of America
- state_text: STATE_ABBR_123
+ state_text: NY
delivery_rates:
- id: dr_gbHJdmfrXB
delivery_method_id: dm_gbHJdmfrXB
@@ -1592,47 +1594,47 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 96 Lovely Street
+ address1: 100 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_127
- state_abbr: STATE_ABBR_127
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_127
+ state_name: New York
shipping_address:
id: addr_OIJLhNcSbf
first_name: John
last_name: Doe
full_name: John Doe
- address1: 97 Lovely Street
+ address1: 101 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_128
- state_abbr: STATE_ABBR_128
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_128
+ state_name: New York
payment_methods: []
gift_card:
market:
- id: cart_UkLWZg9DAJ
market_id:
- number: R719129789
- token: hrbr967gvjnhuuDGo1inkjD3tZtz6tqboAN
+ number: R384180305
+ token: QBU9FrPXCFJzmaRRAjyZBy9Kz4fd2FdpYt5
customer_note:
currency: USD
locale: en
@@ -1674,8 +1676,8 @@ paths:
variant_id: variant_UkLWZg9DAJ
quantity: 1
currency: USD
- name: Product 567610
- slug: product-567610
+ name: Product 566791
+ slug: product-566791
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -1700,7 +1702,7 @@ paths:
digital_links: []
fulfillments:
- id: ful_UkLWZg9DAJ
- number: H09180957231
+ number: H91469194561
tracking: U10000
tracking_url:
cost: '100.0'
@@ -1728,14 +1730,14 @@ paths:
code: UPS_GROUND
stock_location:
id: sloc_UkLWZg9DAJ
- state_abbr: STATE_ABBR_123
- name: Joelle Padberg
+ state_abbr: NY
+ name: Shanel Schaefer
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
country_iso: US
country_name: United States of America
- state_text: STATE_ABBR_123
+ state_text: NY
delivery_rates:
- id: dr_UkLWZg9DAJ
delivery_method_id: dm_UkLWZg9DAJ
@@ -1761,39 +1763,39 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 94 Lovely Street
+ address1: 98 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_125
- state_abbr: STATE_ABBR_125
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_125
+ state_name: New York
shipping_address:
id: addr_VqXmZF31wY
first_name: John
last_name: Doe
full_name: John Doe
- address1: 95 Lovely Street
+ address1: 99 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_126
- state_abbr: STATE_ABBR_126
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_126
+ state_name: New York
payment_methods: []
gift_card:
market:
@@ -1872,8 +1874,8 @@ paths:
example:
id: cart_UkLWZg9DAJ
market_id:
- number: R726052394
- token: bjgtGTAwFNzmdMghbyNvSSY5Bhmphe3Yypw
+ number: R691642289
+ token: W1AjJm3NKZSMmctV9Tda2rfwcLhQZcmem8Y
email:
customer_note:
currency: USD
@@ -2028,9 +2030,9 @@ paths:
example:
id: cart_UkLWZg9DAJ
market_id:
- number: R422904303
- token: Zj1VTueTADRkkBECLKgUWgjoyY4Bjjf3rp2
+ number: R511540545
+ token: NMTe7trEmwcBD9EW6mWjsFPYsLZKUD3NKhk
customer_note:
currency: USD
locale: en
@@ -2057,7 +2059,7 @@ paths:
display_delivery_total: "$0.00"
warnings:
- code: line_item_removed
- message: Product 611681 was removed because it was sold out
+ message: Product 619413 was removed because it was sold out
line_item_id: li_UkLWZg9DAJ
variant_id: variant_UkLWZg9DAJ
store_credit_total: '0.0'
@@ -2082,39 +2084,39 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 104 Lovely Street
+ address1: 108 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_135
- state_abbr: STATE_ABBR_135
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_135
+ state_name: New York
shipping_address:
id: addr_gbHJdmfrXB
first_name: John
last_name: Doe
full_name: John Doe
- address1: 105 Lovely Street
+ address1: 109 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_136
- state_abbr: STATE_ABBR_136
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_136
+ state_name: New York
payment_methods: []
gift_card:
market:
@@ -2199,9 +2201,9 @@ paths:
example:
id: cart_UkLWZg9DAJ
market_id:
- number: R957103637
- token: HQxdHjJrkj5DHrLzDsZrCmHh6HAnkckM4nb
+ number: R101821028
+ token: auf9jP48vgoAgv6dDF5pocrdj2xRFmaC79Y
customer_note: Leave at door
currency: USD
locale: en
@@ -2245,8 +2247,8 @@ paths:
variant_id: variant_UkLWZg9DAJ
quantity: 1
currency: USD
- name: Product 624104
- slug: product-624104
+ name: Product 628443
+ slug: product-628443
options_text: ''
price: '19.99'
display_price: "$19.99"
@@ -2271,7 +2273,7 @@ paths:
digital_links: []
fulfillments:
- id: ful_gbHJdmfrXB
- number: H86120439581
+ number: H07153056867
tracking:
tracking_url:
cost: '10.0'
@@ -2299,14 +2301,14 @@ paths:
code: UPS_GROUND
stock_location:
id: sloc_UkLWZg9DAJ
- state_abbr: STATE_ABBR_137
- name: Sook Cummerata
+ state_abbr: NY
+ name: Kendrick Nienow
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
country_iso: US
country_name: United States of America
- state_text: STATE_ABBR_137
+ state_text: NY
delivery_rates:
- id: dr_gbHJdmfrXB
delivery_method_id: dm_UkLWZg9DAJ
@@ -2332,39 +2334,39 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 108 Lovely Street
+ address1: 112 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_139
- state_abbr: STATE_ABBR_139
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_139
+ state_name: New York
shipping_address:
id: addr_VqXmZF31wY
first_name: John
last_name: Doe
full_name: John Doe
- address1: 109 Lovely Street
+ address1: 113 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_140
- state_abbr: STATE_ABBR_140
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_140
+ state_name: New York
payment_methods: []
gift_card:
market:
@@ -2537,9 +2539,9 @@ paths:
example:
id: cart_UkLWZg9DAJ
market_id:
- number: R786196151
- token: e5rvddh349aEjUgBen6GeL7QLySXMZVUoD8
+ number: R496488366
+ token: QyG1CoSmhsREvUj68UV6mdCjbK6B588iEDX
customer_note:
currency: USD
locale: en
@@ -2581,8 +2583,8 @@ paths:
variant_id: variant_UkLWZg9DAJ
quantity: 1
currency: USD
- name: Product 643839
- slug: product-643839
+ name: Product 643922
+ slug: product-643922
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -2607,7 +2609,7 @@ paths:
digital_links: []
fulfillments:
- id: ful_UkLWZg9DAJ
- number: H59612746246
+ number: H01312263235
tracking: U10000
tracking_url:
cost: '100.0'
@@ -2635,14 +2637,14 @@ paths:
code: UPS_GROUND
stock_location:
id: sloc_UkLWZg9DAJ
- state_abbr: STATE_ABBR_145
- name: Adelaide Jones
+ state_abbr: NY
+ name: Kyra Jast
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
country_iso: US
country_name: United States of America
- state_text: STATE_ABBR_145
+ state_text: NY
delivery_rates:
- id: dr_UkLWZg9DAJ
delivery_method_id: dm_UkLWZg9DAJ
@@ -2668,39 +2670,39 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 114 Lovely Street
+ address1: 118 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_145
- state_abbr: STATE_ABBR_145
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_145
+ state_name: New York
shipping_address:
id: addr_gbHJdmfrXB
first_name: John
last_name: Doe
full_name: John Doe
- address1: 115 Lovely Street
+ address1: 119 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_146
- state_abbr: STATE_ABBR_146
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_146
+ state_name: New York
payment_methods: []
gift_card:
market:
@@ -2770,8 +2772,8 @@ paths:
example:
id: or_UkLWZg9DAJ
market_id:
- number: R100883351
+ number: R661978413
customer_note:
currency: USD
locale: en
@@ -2798,7 +2800,7 @@ paths:
display_delivery_total: "$10.00"
fulfillment_status: backorder
payment_status: paid
- completed_at: '2026-04-29T10:50:29.089Z'
+ completed_at: '2026-04-29T16:00:20.549Z'
store_credit_total: '0.0'
display_store_credit_total: "$0.00"
covered_by_store_credit: false
@@ -2808,8 +2810,8 @@ paths:
variant_id: variant_UkLWZg9DAJ
quantity: 1
currency: USD
- name: Product 663637
- slug: product-663637
+ name: Product 662849
+ slug: product-662849
options_text: ''
price: '19.99'
display_price: "$19.99"
@@ -2834,7 +2836,7 @@ paths:
digital_links: []
fulfillments:
- id: ful_gbHJdmfrXB
- number: H88952533523
+ number: H95827918638
tracking:
tracking_url:
cost: '10.0'
@@ -2862,14 +2864,14 @@ paths:
code: UPS_GROUND
stock_location:
id: sloc_UkLWZg9DAJ
- state_abbr: STATE_ABBR_151
- name: Aliza Botsford
+ state_abbr: NY
+ name: Carola Lueilwitz
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
country_iso: US
country_name: United States of America
- state_text: STATE_ABBR_151
+ state_text: NY
delivery_rates:
- id: dr_gbHJdmfrXB
delivery_method_id: dm_UkLWZg9DAJ
@@ -2892,8 +2894,8 @@ paths:
payments:
- id: py_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
- response_code: BGS-ce1c387a56e5
- number: PYPRN144
+ response_code: BGS-def49f44c66f
+ number: P97I9JEM
amount: '29.99'
display_amount: "$29.99"
status: completed
@@ -2914,44 +2916,45 @@ paths:
description:
type: Spree::PaymentMethod::Check
session_required: false
+ source_required: false
billing_address:
id: addr_EfhxLZ9ck8
first_name: John
last_name: Doe
full_name: John Doe
- address1: 122 Lovely Street
+ address1: 126 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_153
- state_abbr: STATE_ABBR_153
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_153
+ state_name: New York
shipping_address:
id: addr_VqXmZF31wY
first_name: John
last_name: Doe
full_name: John Doe
- address1: 123 Lovely Street
+ address1: 127 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_154
- state_abbr: STATE_ABBR_154
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_154
+ state_name: New York
gift_card:
market:
schema:
@@ -3240,7 +3243,7 @@ paths:
example:
data:
- iso: DE
- iso3: IS41
+ iso3: IS32
name: Germany
states_required: false
zipcode_required: true
@@ -3748,15 +3751,16 @@ paths:
content:
application/json:
example:
- token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6Ijc5ZDhhNzJmLTk1MWItNDI3MS1iMTM0LWI4ZmY4YjJiZTlhOSIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzc3NDYzNDM1fQ.FRmEBHJOnv0F_FEQCxz1TLg-moXIFvKqvUR6Etg9iMo
- refresh_token: RoHNyL7rZQNfkzTJm4Bj4Eov
+ token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6ImYzY2MwMDFiLTMzMTgtNGE5YS1hNzM3LWRhNTAwMTE4MmMyNCIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzc3NDgyMDI3fQ.2nR7D1VUtVOj9FetV56yOhfIdSpAoQGXQIT5X19D3YE
+ refresh_token: JxbtKAkym9dtQo5d3PawV1A2
user:
id: cus_UkLWZg9DAJ
- first_name: Darrin
- last_name: Langosh
+ first_name: Gayla
+ last_name: Witting
phone:
accepts_email_marketing: false
+ full_name: Gayla Witting
available_store_credit_total: '0'
display_available_store_credit_total: "$0.00"
addresses: []
@@ -3926,8 +3930,8 @@ paths:
data:
- id: or_UkLWZg9DAJ
market_id:
- number: R199401374
+ number: R832819108
customer_note:
currency: USD
locale: en
@@ -3954,7 +3958,7 @@ paths:
display_delivery_total: "$100.00"
fulfillment_status:
payment_status:
- completed_at: '2026-04-29T10:50:36.041Z'
+ completed_at: '2026-04-29T16:00:28.242Z'
store_credit_total: '0.0'
display_store_credit_total: "$0.00"
covered_by_store_credit: false
@@ -3964,8 +3968,8 @@ paths:
variant_id: variant_UkLWZg9DAJ
quantity: 1
currency: USD
- name: Product 752016
- slug: product-752016
+ name: Product 755263
+ slug: product-755263
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -3990,7 +3994,7 @@ paths:
digital_links: []
fulfillments:
- id: ful_UkLWZg9DAJ
- number: H91888025843
+ number: H44154252716
tracking: U10000
tracking_url:
cost: '100.0'
@@ -4018,14 +4022,14 @@ paths:
code: UPS_GROUND
stock_location:
id: sloc_UkLWZg9DAJ
- state_abbr: STATE_ABBR_178
- name: Merrill Lemke
+ state_abbr: NY
+ name: Alane Hegmann
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
country_iso: US
country_name: United States of America
- state_text: STATE_ABBR_178
+ state_text: NY
delivery_rates:
- id: dr_gbHJdmfrXB
delivery_method_id: dm_UkLWZg9DAJ
@@ -4051,39 +4055,39 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 142 Lovely Street
+ address1: 146 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_180
- state_abbr: STATE_ABBR_180
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_180
+ state_name: New York
shipping_address:
id: addr_VqXmZF31wY
first_name: John
last_name: Doe
full_name: John Doe
- address1: 143 Lovely Street
+ address1: 147 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_181
- state_abbr: STATE_ABBR_181
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_181
+ state_name: New York
gift_card:
market:
meta:
@@ -4181,8 +4185,8 @@ paths:
example:
id: or_UkLWZg9DAJ
market_id:
- number: R192684346
+ number: R624689755
customer_note:
currency: USD
locale: en
@@ -4209,7 +4213,7 @@ paths:
display_delivery_total: "$100.00"
fulfillment_status:
payment_status:
- completed_at: '2026-04-29T10:50:36.721Z'
+ completed_at: '2026-04-29T16:00:28.955Z'
store_credit_total: '0.0'
display_store_credit_total: "$0.00"
covered_by_store_credit: false
@@ -4219,8 +4223,8 @@ paths:
variant_id: variant_UkLWZg9DAJ
quantity: 1
currency: USD
- name: Product 777387
- slug: product-777387
+ name: Product 772121
+ slug: product-772121
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -4245,7 +4249,7 @@ paths:
digital_links: []
fulfillments:
- id: ful_UkLWZg9DAJ
- number: H03244332837
+ number: H33308593214
tracking: U10000
tracking_url:
cost: '100.0'
@@ -4273,14 +4277,14 @@ paths:
code: UPS_GROUND
stock_location:
id: sloc_UkLWZg9DAJ
- state_abbr: STATE_ABBR_184
- name: Ceola Heathcote
+ state_abbr: NY
+ name: Valery Conn
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
country_iso: US
country_name: United States of America
- state_text: STATE_ABBR_184
+ state_text: NY
delivery_rates:
- id: dr_gbHJdmfrXB
delivery_method_id: dm_UkLWZg9DAJ
@@ -4306,39 +4310,39 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 148 Lovely Street
+ address1: 152 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_186
- state_abbr: STATE_ABBR_186
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_186
+ state_name: New York
shipping_address:
id: addr_VqXmZF31wY
first_name: John
last_name: Doe
full_name: John Doe
- address1: 149 Lovely Street
+ address1: 153 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_187
- state_abbr: STATE_ABBR_187
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_187
+ state_name: New York
gift_card:
market:
schema:
@@ -4394,8 +4398,8 @@ paths:
content:
application/json:
example:
- token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6IjI3YmM5YjBlLTFiZjEtNDU5Ny1iMWYxLTk5N2Q2OGRkZjFjOSIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzc3NDYzNDM3fQ.uA9BQYSznjc35ScHblb6KCqvbB9doDnTu2mo5XlA3a8
- refresh_token: MUk9YT6q227ADbBesnF8VxHD
+ token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6ImQ5MmE1OWU0LTMzMDAtNDk0Ny04MzFmLTU4OGZlYzNjNGYxOCIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzc3NDgyMDMwfQ.-EYQoFb28Sqk6onWxtgXarFXyr3ysIgg2W1uGpM440w
+ refresh_token: KV2opHCMpzNqp5bpPCo9Yd6u
user:
id: cus_UkLWZg9DAJ
@@ -4403,6 +4407,7 @@ paths:
last_name: Doe
phone: "+1234567890"
accepts_email_marketing: true
+ full_name: John Doe
available_store_credit_total: '0'
display_available_store_credit_total: "$0.00"
addresses: []
@@ -4508,11 +4513,12 @@ paths:
application/json:
example:
id: cus_UkLWZg9DAJ
- first_name: Meaghan
- last_name: Ebert
+ first_name: Jonah
+ last_name: Rutherford
phone: 555-555-0199
accepts_email_marketing: false
+ full_name: Jonah Rutherford
available_store_credit_total: '0'
display_available_store_credit_total: "$0.00"
addresses:
@@ -4520,76 +4526,76 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 155 Lovely Street
+ address1: 159 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_193
- state_abbr: STATE_ABBR_193
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: true
is_default_shipping: false
- state_name: STATE_NAME_193
+ state_name: New York
- id: addr_UkLWZg9DAJ
first_name: John
last_name: Doe
full_name: John Doe
- address1: 154 Lovely Street
+ address1: 158 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_192
- state_abbr: STATE_ABBR_192
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: true
- state_name: STATE_NAME_192
+ state_name: New York
default_billing_address:
id: addr_gbHJdmfrXB
first_name: John
last_name: Doe
full_name: John Doe
- address1: 155 Lovely Street
+ address1: 159 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_193
- state_abbr: STATE_ABBR_193
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: true
is_default_shipping: false
- state_name: STATE_NAME_193
+ state_name: New York
default_shipping_address:
id: addr_UkLWZg9DAJ
first_name: John
last_name: Doe
full_name: John Doe
- address1: 154 Lovely Street
+ address1: 158 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_192
- state_abbr: STATE_ABBR_192
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: true
- state_name: STATE_NAME_192
+ state_name: New York
schema:
"$ref": "#/components/schemas/Customer"
'401':
@@ -4646,11 +4652,12 @@ paths:
application/json:
example:
id: cus_UkLWZg9DAJ
first_name: Updated
last_name: Name
phone: 555-555-0199
accepts_email_marketing: false
+ full_name: Updated Name
available_store_credit_total: '0'
display_available_store_credit_total: "$0.00"
addresses:
@@ -4658,76 +4665,76 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 157 Lovely Street
+ address1: 161 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_195
- state_abbr: STATE_ABBR_195
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: true
is_default_shipping: false
- state_name: STATE_NAME_195
+ state_name: New York
- id: addr_UkLWZg9DAJ
first_name: John
last_name: Doe
full_name: John Doe
- address1: 156 Lovely Street
+ address1: 160 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_194
- state_abbr: STATE_ABBR_194
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: true
- state_name: STATE_NAME_194
+ state_name: New York
default_billing_address:
id: addr_gbHJdmfrXB
first_name: John
last_name: Doe
full_name: John Doe
- address1: 157 Lovely Street
+ address1: 161 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_195
- state_abbr: STATE_ABBR_195
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: true
is_default_shipping: false
- state_name: STATE_NAME_195
+ state_name: New York
default_shipping_address:
id: addr_UkLWZg9DAJ
first_name: John
last_name: Doe
full_name: John Doe
- address1: 156 Lovely Street
+ address1: 160 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_194
- state_abbr: STATE_ABBR_194
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: true
- state_name: STATE_NAME_194
+ state_name: New York
schema:
"$ref": "#/components/schemas/Customer"
'422':
@@ -4885,9 +4892,9 @@ paths:
example:
id: cart_UkLWZg9DAJ
market_id:
- number: R379896415
- token: Pt7j1jUzgy5J9dJuWnrLUMCUZ5DT6TD38oo
+ number: R684238326
+ token: u6ecSSHe1CGhDripbUftdK41Jsec1LqM4bc
customer_note:
currency: USD
locale: en
@@ -4936,8 +4943,8 @@ paths:
variant_id: variant_UkLWZg9DAJ
quantity: 1
currency: USD
- name: Product 853932
- slug: product-853932
+ name: Product 855536
+ slug: product-855536
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -4962,7 +4969,7 @@ paths:
digital_links: []
fulfillments:
- id: ful_UkLWZg9DAJ
- number: H76685276530
+ number: H53375671698
tracking: U10000
tracking_url:
cost: '100.0'
@@ -4990,14 +4997,14 @@ paths:
code: UPS_GROUND
stock_location:
id: sloc_UkLWZg9DAJ
- state_abbr: STATE_ABBR_210
- name: Andera Barrows
+ state_abbr: NY
+ name: Camila McCullough
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
country_iso: US
country_name: United States of America
- state_text: STATE_ABBR_210
+ state_text: NY
delivery_rates:
- id: dr_UkLWZg9DAJ
delivery_method_id: dm_UkLWZg9DAJ
@@ -5023,39 +5030,39 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 174 Lovely Street
+ address1: 178 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_212
- state_abbr: STATE_ABBR_212
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_212
+ state_name: New York
shipping_address:
id: addr_VqXmZF31wY
first_name: John
last_name: Doe
full_name: John Doe
- address1: 175 Lovely Street
+ address1: 179 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_213
- state_abbr: STATE_ABBR_213
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_213
+ state_name: New York
payment_methods: []
gift_card:
market:
@@ -5145,9 +5152,9 @@ paths:
example:
id: cart_UkLWZg9DAJ
market_id:
- number: R743152262
- token: 4g5Rd89j2tekAsqrBM5rHFiKYJrEhCY1jyv
+ number: R636351307
+ token: ZuEsV7CieZAFaG4m17MPKposzN9bASB18Gg
customer_note:
currency: USD
locale: en
@@ -5189,8 +5196,8 @@ paths:
variant_id: variant_UkLWZg9DAJ
quantity: 1
currency: USD
- name: Product 872597
- slug: product-872597
+ name: Product 878882
+ slug: product-878882
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -5215,7 +5222,7 @@ paths:
digital_links: []
fulfillments:
- id: ful_UkLWZg9DAJ
- number: H00373340716
+ number: H40345253216
tracking: U10000
tracking_url:
cost: '100.0'
@@ -5243,14 +5250,14 @@ paths:
code: UPS_GROUND
stock_location:
id: sloc_UkLWZg9DAJ
- state_abbr: STATE_ABBR_218
- name: Bea Schultz
+ state_abbr: NY
+ name: Shane DuBuque
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
country_iso: US
country_name: United States of America
- state_text: STATE_ABBR_218
+ state_text: NY
delivery_rates:
- id: dr_UkLWZg9DAJ
delivery_method_id: dm_UkLWZg9DAJ
@@ -5276,39 +5283,39 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 182 Lovely Street
+ address1: 186 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_220
- state_abbr: STATE_ABBR_220
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_220
+ state_name: New York
shipping_address:
id: addr_VqXmZF31wY
first_name: John
last_name: Doe
full_name: John Doe
- address1: 183 Lovely Street
+ address1: 187 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_221
- state_abbr: STATE_ABBR_221
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_221
+ state_name: New York
payment_methods: []
gift_card:
market:
@@ -5387,9 +5394,9 @@ paths:
example:
id: cart_UkLWZg9DAJ
market_id:
- number: R104959955
- token: aMgNdSuL7EPtwsCPZG1AoCRQWo2jRkKV5HL
+ number: R682532547
+ token: cJ71DWMVgw44QB3afABkDchQ8VC76qvjNjp
customer_note:
currency: USD
locale: en
@@ -5433,8 +5440,8 @@ paths:
variant_id: variant_UkLWZg9DAJ
quantity: 1
currency: USD
- name: Product 893232
- slug: product-893232
+ name: Product 89648
+ slug: product-89648
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -5459,7 +5466,7 @@ paths:
digital_links: []
fulfillments:
- id: ful_UkLWZg9DAJ
- number: H32040529041
+ number: H83618197901
tracking: U10000
tracking_url:
cost: '100.0'
@@ -5487,14 +5494,14 @@ paths:
code: UPS_GROUND
stock_location:
id: sloc_UkLWZg9DAJ
- state_abbr: STATE_ABBR_226
- name: Treasa Kuhn
+ state_abbr: NY
+ name: Yer Cassin
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
country_iso: US
country_name: United States of America
- state_text: STATE_ABBR_226
+ state_text: NY
delivery_rates:
- id: dr_UkLWZg9DAJ
delivery_method_id: dm_UkLWZg9DAJ
@@ -5520,39 +5527,39 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 190 Lovely Street
+ address1: 194 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_228
- state_abbr: STATE_ABBR_228
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_228
+ state_name: New York
shipping_address:
id: addr_VqXmZF31wY
first_name: John
last_name: Doe
full_name: John Doe
- address1: 191 Lovely Street
+ address1: 195 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_229
- state_abbr: STATE_ABBR_229
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_229
+ state_name: New York
payment_methods: []
gift_card:
market:
@@ -5645,9 +5652,9 @@ paths:
example:
id: cart_UkLWZg9DAJ
market_id:
- number: R999279559
- token: QHzk9caWQYRLB5xisENjfm95gSMvD1df2Lx
+ number: R134509356
+ token: Pc31yhLMexVeuwqP7x3aKHw8r1v9n8X1PHk
customer_note:
currency: USD
locale: en
@@ -5686,8 +5693,8 @@ paths:
variant_id: variant_UkLWZg9DAJ
quantity: 1
currency: USD
- name: Product 911122
- slug: product-911122
+ name: Product 919205
+ slug: product-919205
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -5712,7 +5719,7 @@ paths:
digital_links: []
fulfillments:
- id: ful_UkLWZg9DAJ
- number: H62216687249
+ number: H44860419830
tracking: U10000
tracking_url:
cost: '100.0'
@@ -5740,14 +5747,14 @@ paths:
code: UPS_GROUND
stock_location:
id: sloc_UkLWZg9DAJ
- state_abbr: STATE_ABBR_234
- name: Heide Hansen
+ state_abbr: NY
+ name: Lue Windler
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
country_iso: US
country_name: United States of America
- state_text: STATE_ABBR_234
+ state_text: NY
delivery_rates:
- id: dr_UkLWZg9DAJ
delivery_method_id: dm_UkLWZg9DAJ
@@ -5770,8 +5777,8 @@ paths:
payments:
- id: py_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
- response_code: 1-SC-20260429105046678898
- number: PD180RFA
+ response_code: 1-SC-20260429160039175123
+ number: P1F24VXD
amount: '50.0'
display_amount: "$50.00"
status: checkout
@@ -5792,50 +5799,52 @@ paths:
description:
type: Spree::PaymentMethod::StoreCredit
session_required: false
+ source_required: true
billing_address:
id: addr_EfhxLZ9ck8
first_name: John
last_name: Doe
full_name: John Doe
- address1: 198 Lovely Street
+ address1: 202 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_236
- state_abbr: STATE_ABBR_236
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_236
+ state_name: New York
shipping_address:
id: addr_VqXmZF31wY
first_name: John
last_name: Doe
full_name: John Doe
- address1: 199 Lovely Street
+ address1: 203 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_237
- state_abbr: STATE_ABBR_237
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_237
+ state_name: New York
payment_methods:
- id: pm_UkLWZg9DAJ
name: Store Credit
description:
type: Spree::PaymentMethod::StoreCredit
session_required: false
+ source_required: true
gift_card:
id: gc_UkLWZg9DAJ
code: GIFTCODE1
@@ -5948,9 +5957,9 @@ paths:
example:
id: cart_UkLWZg9DAJ
market_id:
- number: R659207348
- token: o3FM6PoYwtZRFdpaprtgnbgUXMbojhaaRmn
+ number: R058228208
+ token: vKMtw8bFJNKEKCDEo6wkcCGjagCReoeQ5hT
customer_note:
currency: USD
locale: en
@@ -5992,8 +6001,8 @@ paths:
variant_id: variant_UkLWZg9DAJ
quantity: 1
currency: USD
- name: Product 95217
- slug: product-95217
+ name: Product 955154
+ slug: product-955154
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -6018,7 +6027,7 @@ paths:
digital_links: []
fulfillments:
- id: ful_UkLWZg9DAJ
- number: H45267185219
+ number: H82159045492
tracking: U10000
tracking_url:
cost: '100.0'
@@ -6046,14 +6055,14 @@ paths:
code: UPS_GROUND
stock_location:
id: sloc_UkLWZg9DAJ
- state_abbr: STATE_ABBR_250
- name: Lindsay Bosco
+ state_abbr: NY
+ name: Arleen Bartell
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
country_iso: US
country_name: United States of America
- state_text: STATE_ABBR_250
+ state_text: NY
delivery_rates:
- id: dr_UkLWZg9DAJ
delivery_method_id: dm_UkLWZg9DAJ
@@ -6076,8 +6085,8 @@ paths:
payments:
- id: py_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
- response_code: 1-SC-20260429105049202019
- number: PPL7OPNI
+ response_code: 1-SC-20260429160041706187
+ number: PB0HE5QW
amount: '50.0'
display_amount: "$50.00"
status: invalid
@@ -6098,44 +6107,45 @@ paths:
description:
type: Spree::PaymentMethod::StoreCredit
session_required: false
+ source_required: true
billing_address:
id: addr_EfhxLZ9ck8
first_name: John
last_name: Doe
full_name: John Doe
- address1: 214 Lovely Street
+ address1: 218 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_252
- state_abbr: STATE_ABBR_252
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_252
+ state_name: New York
shipping_address:
id: addr_VqXmZF31wY
first_name: John
last_name: Doe
full_name: John Doe
- address1: 215 Lovely Street
+ address1: 219 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_253
- state_abbr: STATE_ABBR_253
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_253
+ state_name: New York
payment_methods: []
gift_card:
market:
@@ -6200,7 +6210,7 @@ paths:
example:
data:
- id: gc_UkLWZg9DAJ
- code: 7130BB409ABC20D8
+ code: 2FE4341082F198C4
status: active
currency: USD
amount: '10.0'
@@ -6296,7 +6306,7 @@ paths:
application/json:
example:
id: gc_UkLWZg9DAJ
- code: E41BF12E6A00C9BA
+ code: ED365F485FE3776A
status: active
currency: USD
amount: '10.0'
@@ -6387,9 +6397,9 @@ paths:
example:
id: cart_UkLWZg9DAJ
market_id:
- number: R738376524
- token: zoXK6oAmUiuyfM4JqfVfrj1estkPocer8Fi
+ number: R775361233
+ token: W1EWaRx5iBZnn83Vn66BSjeqUq9jQjy438s
customer_note:
currency: USD
locale: en
@@ -6437,8 +6447,8 @@ paths:
variant_id: variant_UkLWZg9DAJ
quantity: 1
currency: USD
- name: Product 985403
- slug: product-985403
+ name: Product 984707
+ slug: product-984707
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -6465,8 +6475,8 @@ paths:
variant_id: variant_gbHJdmfrXB
quantity: 1
currency: USD
- name: Product 995517
- slug: product-995517
+ name: Product 99985
+ slug: product-99985
options_text: ''
price: '19.99'
display_price: "$19.99"
@@ -6496,20 +6506,20 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 229 Lovely Street
+ address1: 233 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_267
- state_abbr: STATE_ABBR_267
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_267
+ state_name: New York
shipping_address:
payment_methods: []
gift_card:
@@ -6609,9 +6619,9 @@ paths:
example:
id: cart_UkLWZg9DAJ
market_id:
- number: R136473536
- token: Tdvb8Y6Y3ewiJijNpgm4vwNR4si2ry3Curb
+ number: R042592274
+ token: uJnik897i8sPndA2u7koP8pUgbZW9rte8gs
customer_note:
currency: USD
locale: en
@@ -6656,8 +6666,8 @@ paths:
variant_id: variant_UkLWZg9DAJ
quantity: 1
currency: USD
- name: Product 1023331
- slug: product-1023331
+ name: Product 102651
+ slug: product-102651
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -6687,20 +6697,20 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 238 Lovely Street
+ address1: 242 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_276
- state_abbr: STATE_ABBR_276
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_276
+ state_name: New York
shipping_address:
payment_methods: []
gift_card:
@@ -6780,9 +6790,9 @@ paths:
example:
id: cart_UkLWZg9DAJ
market_id:
- number: R118751837
- token: A1CvoYBtS1kjJ2HEDgU3MTNjcctFDrmhiDm
+ number: R910961026
+ token: uEZu67z8eF6jkqokHhX5ZG5oj3hk4gparTn
customer_note:
currency: USD
locale: en
@@ -6833,20 +6843,20 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 241 Lovely Street
+ address1: 245 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_279
- state_abbr: STATE_ABBR_279
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_279
+ state_name: New York
shipping_address:
payment_methods: []
gift_card:
@@ -6994,12 +7004,12 @@ paths:
- fr
countries:
- iso: DE
- iso3: IS68
+ iso3: IS59
name: Germany
states_required: false
zipcode_required: true
- iso: FR
- iso3: IS69
+ iso3: IS60
name: France
states_required: false
zipcode_required: true
@@ -7078,12 +7088,12 @@ paths:
- fr
countries:
- iso: DE
- iso3: IS72
+ iso3: IS63
name: Germany
states_required: false
zipcode_required: true
- iso: FR
- iso3: IS73
+ iso3: IS64
name: France
states_required: false
zipcode_required: true
@@ -7158,12 +7168,12 @@ paths:
- fr
countries:
- iso: DE
- iso3: IS76
+ iso3: IS67
name: Germany
states_required: false
zipcode_required: true
- iso: FR
- iso3: IS77
+ iso3: IS68
name: France
states_required: false
zipcode_required: true
@@ -7227,12 +7237,12 @@ paths:
example:
data:
- iso: FR
- iso3: IS81
+ iso3: IS72
name: France
states_required: false
zipcode_required: true
- iso: DE
- iso3: IS80
+ iso3: IS71
name: Germany
states_required: false
zipcode_required: true
@@ -7383,7 +7393,7 @@ paths:
example:
id: or_UkLWZg9DAJ
market_id:
- number: R107458949
+ number: R404436615
customer_note:
currency: USD
@@ -7411,7 +7421,7 @@ paths:
display_delivery_total: "$100.00"
fulfillment_status:
payment_status:
- completed_at: '2026-04-29T10:50:57.067Z'
+ completed_at: '2026-04-29T16:00:49.872Z'
store_credit_total: '0.0'
display_store_credit_total: "$0.00"
covered_by_store_credit: false
@@ -7421,8 +7431,8 @@ paths:
variant_id: variant_UkLWZg9DAJ
quantity: 1
currency: USD
- name: Product 1066551
- slug: product-1066551
+ name: Product 106449
+ slug: product-106449
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -7447,7 +7457,7 @@ paths:
digital_links: []
fulfillments:
- id: ful_UkLWZg9DAJ
- number: H25115000054
+ number: H83574844550
tracking: U10000
tracking_url:
cost: '100.0'
@@ -7475,14 +7485,14 @@ paths:
code: UPS_GROUND
stock_location:
id: sloc_UkLWZg9DAJ
- state_abbr: STATE_ABBR_287
- name: Madonna Roob
+ state_abbr: NY
+ name: Nora Mueller
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
country_iso: US
country_name: United States of America
- state_text: STATE_ABBR_287
+ state_text: NY
delivery_rates:
- id: dr_gbHJdmfrXB
delivery_method_id: dm_UkLWZg9DAJ
@@ -7508,39 +7518,39 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 249 Lovely Street
+ address1: 253 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_287
- state_abbr: STATE_ABBR_287
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_287
+ state_name: New York
shipping_address:
id: addr_gbHJdmfrXB
first_name: John
last_name: Doe
full_name: John Doe
- address1: 250 Lovely Street
+ address1: 254 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_288
- state_abbr: STATE_ABBR_288
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_288
+ state_name: New York
gift_card:
market:
schema:
@@ -7621,9 +7631,9 @@ paths:
id: ps_gbHJdmfrXB
status: pending
currency: USD
- external_id: bogus_ae7d1a1ff0a0beb194aa3443
+ external_id: bogus_7c95fb2319657ba994cc2207
external_data:
- client_secret: bogus_secret_7db742b773345c67
+ client_secret: bogus_secret_1dccd1a9fa1716cf
customer_external_id:
expires_at:
amount: '110.0'
@@ -7635,6 +7645,7 @@ paths:
description:
type: Spree::Gateway::Bogus
session_required: true
+ source_required: true
schema:
"$ref": "#/components/schemas/PaymentSession"
requestBody:
@@ -7720,7 +7731,7 @@ paths:
id: ps_UkLWZg9DAJ
status: pending
currency: USD
- external_id: bogus_7018c5066dfe2f5eb9cb4250
+ external_id: bogus_ccc13a869ffecd10dffe7812
external_data:
client_secret: secret_123
customer_external_id:
@@ -7734,6 +7745,7 @@ paths:
description:
type: Spree::Gateway::Bogus
session_required: true
+ source_required: true
schema:
"$ref": "#/components/schemas/PaymentSession"
'404':
@@ -7781,7 +7793,7 @@ paths:
id: ps_UkLWZg9DAJ
status: pending
currency: USD
- external_id: bogus_3a664db563f40c4715880d9e
+ external_id: bogus_554e57fdc224df25d5e22aa4
external_data:
client_secret: secret_123
customer_external_id:
@@ -7795,6 +7807,7 @@ paths:
description:
type: Spree::Gateway::Bogus
session_required: true
+ source_required: true
schema:
"$ref": "#/components/schemas/PaymentSession"
requestBody:
@@ -7882,7 +7895,7 @@ paths:
id: ps_UkLWZg9DAJ
status: completed
currency: USD
- external_id: bogus_dcee48f27758a45d58fa7ac7
+ external_id: bogus_b2779ff1fd23789a717fc8b5
external_data:
client_secret: secret_123
customer_external_id:
@@ -7896,6 +7909,7 @@ paths:
description:
type: Spree::Gateway::Bogus
session_required: true
+ source_required: true
schema:
"$ref": "#/components/schemas/PaymentSession"
'404':
@@ -7966,8 +7980,8 @@ paths:
example:
id: pss_gbHJdmfrXB
status: pending
- external_id: bogus_seti_daa821c21a77241b20325bd9
- external_client_secret: bogus_seti_secret_ac6eda78228e2b69
+ external_id: bogus_seti_18928969f2502cd4c2c1ce32
+ external_client_secret: bogus_seti_secret_64707f0d54f29d38
external_data: {}
payment_method_id: pm_UkLWZg9DAJ
payment_source_id:
@@ -7979,6 +7993,7 @@ paths:
description:
type: Spree::Gateway::Bogus
session_required: true
+ source_required: true
schema:
"$ref": "#/components/schemas/PaymentSetupSession"
'401':
@@ -8065,8 +8080,8 @@ paths:
example:
id: pss_UkLWZg9DAJ
status: pending
- external_id: seti_test_5de54867a27e5f854231ff0e
- external_client_secret: seti_secret_652723a3cd866daacc01d898
+ external_id: seti_test_95227153d866b2994ca7ca92
+ external_client_secret: seti_secret_17c2c2cef27524e368875fb0
external_data:
client_secret: secret_123
payment_method_id: pm_UkLWZg9DAJ
@@ -8079,6 +8094,7 @@ paths:
description:
type: Spree::Gateway::Bogus
session_required: true
+ source_required: true
schema:
"$ref": "#/components/schemas/PaymentSetupSession"
'404':
@@ -8141,8 +8157,8 @@ paths:
example:
id: pss_UkLWZg9DAJ
status: completed
- external_id: seti_test_a790e6fc19873d08e23219b4
- external_client_secret: seti_secret_303ab6a822fb5afdd4eae7ef
+ external_id: seti_test_7dba83629f90b18f1b1e43fa
+ external_client_secret: seti_secret_f0f84f9147db743c3bd09176
external_data:
client_secret: secret_123
payment_method_id: pm_UkLWZg9DAJ
@@ -8155,6 +8171,7 @@ paths:
description:
type: Spree::Gateway::Bogus
session_required: true
+ source_required: true
schema:
"$ref": "#/components/schemas/PaymentSetupSession"
'404':
@@ -8235,7 +8252,7 @@ paths:
id: py_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
response_code:
- number: P8RVG2ZC
+ number: PT31KFV5
amount: '110.0'
display_amount: "$110.00"
status: checkout
@@ -8248,6 +8265,7 @@ paths:
description:
type: Spree::PaymentMethod::Check
session_required: false
+ source_required: false
schema:
"$ref": "#/components/schemas/Payment"
'422':
@@ -8330,7 +8348,7 @@ paths:
body_html: ''
- id: pol_OIJLhNcSbf
name: Privacy Policy
- slug: privacy-policy-1de8e153-7a63-406c-a4f6-636435567a59
+ slug: privacy-policy-ea963688-a324-427f-98ef-cb1454aa0b36
body: We respect your privacy.
body_html: |
<div class="trix-content">
@@ -8574,12 +8592,12 @@ paths:
example:
data:
- id: prod_UkLWZg9DAJ
- name: Product 1165108
- slug: product-1165108
+ name: Product 1167671
+ slug: product-1167671
meta_description:
meta_keywords:
variant_count: 1
- available_on: '2025-04-29T10:51:07.777Z'
+ available_on: '2025-04-29T16:01:00.580Z'
purchasable: true
in_stock: false
backorderable: true
@@ -8601,26 +8619,41 @@ paths:
price_list_id:
original_price:
- id: prod_gbHJdmfrXB
- name: Product 1178746
- slug: product-1178746
+ name: Product 1171988
+ slug: product-1171988
meta_description:
meta_keywords:
variant_count: 0
- available_on: '2025-04-29T10:51:07.830Z'
+ available_on: '2025-04-29T16:01:00.655Z'
purchasable: true
in_stock: false
backorderable: true
available: true
- description: Expedita quo laborum molestias cumque ullam culpa molestiae.
- Quae temporibus quia unde corporis nisi illum numquam asperiores.
- A non soluta voluptatibus excepturi nihil odit. Sapiente impedit
- deserunt sit molestiae. Repellat animi nostrum possimus officiis
- dolorem dolore placeat. Porro eum sequi sed vel. Hic commodi doloremque
- facilis debitis reprehenderit dolorem accusamus. Labore dolorem
- quisquam vel iusto maxime.
+ description: Odio ullam voluptatum illo laborum. Molestiae temporibus
+ architecto iusto ratione officia aliquam similique facilis. Molestiae
+ omnis error enim veritatis. Sequi voluptate asperiores repudiandae
+ dignissimos accusantium maxime perspiciatis praesentium. Dicta
+ assumenda reprehenderit commodi quo placeat minima voluptatum
+ incidunt. Labore quos quod quo id consectetur fugiat eaque. Nobis
+ amet cum voluptates rem minus quasi corporis. Exercitationem reprehenderit
+ maxime enim inventore assumenda. Voluptatibus debitis aliquam
+ inventore quis similique. Eaque accusantium corporis saepe doloremque
+ laudantium quam. Similique aspernatur molestiae reiciendis consequatur
+ distinctio quia. Distinctio quaerat doloribus totam ex laudantium
+ nulla eaque. Odit laborum voluptas voluptates pariatur animi praesentium
+ accusamus. Quae et numquam a cupiditate pariatur ducimus impedit.
+ Ducimus consequatur neque eligendi natus nihil esse. Rem sapiente
+ maiores iusto reiciendis. Ad dolore eum sed odio tempore eveniet
+ ipsum accusamus. Fugit aperiam quasi aut officia eligendi. Ipsa
+ adipisci asperiores doloribus eaque. Maxime perferendis non recusandae
+ sed id ipsam suscipit ducimus. Minima officiis fugit laborum dolorum
+ neque eius.
description_html: |-
- Expedita quo laborum molestias cumque ullam culpa molestiae. Quae temporibus quia unde corporis nisi illum numquam asperiores. A non soluta voluptatibus excepturi nihil odit. Sapiente impedit deserunt sit molestiae.
- Repellat animi nostrum possimus officiis dolorem dolore placeat. Porro eum sequi sed vel. Hic commodi doloremque facilis debitis reprehenderit dolorem accusamus. Labore dolorem quisquam vel iusto maxime.
+ Odio ullam voluptatum illo laborum. Molestiae temporibus architecto iusto ratione officia aliquam similique facilis. Molestiae omnis error enim veritatis. Sequi voluptate asperiores repudiandae dignissimos accusantium maxime perspiciatis praesentium.
+ Dicta assumenda reprehenderit commodi quo placeat minima voluptatum incidunt. Labore quos quod quo id consectetur fugiat eaque. Nobis amet cum voluptates rem minus quasi corporis. Exercitationem reprehenderit maxime enim inventore assumenda. Voluptatibus debitis aliquam inventore quis similique.
+ Eaque accusantium corporis saepe doloremque laudantium quam. Similique aspernatur molestiae reiciendis consequatur distinctio quia. Distinctio quaerat doloribus totam ex laudantium nulla eaque. Odit laborum voluptas voluptates pariatur animi praesentium accusamus. Quae et numquam a cupiditate pariatur ducimus impedit.
+ Ducimus consequatur neque eligendi natus nihil esse. Rem sapiente maiores iusto reiciendis. Ad dolore eum sed odio tempore eveniet ipsum accusamus. Fugit aperiam quasi aut officia eligendi.
+ Ipsa adipisci asperiores doloribus eaque. Maxime perferendis non recusandae sed id ipsam suscipit ducimus. Minima officiis fugit laborum dolorum neque eius.
default_variant_id: variant_EfhxLZ9ck8
thumbnail_url:
tags: []
@@ -8722,12 +8755,12 @@ paths:
application/json:
example:
id: prod_UkLWZg9DAJ
- name: Product 1445184
- slug: product-1445184
+ name: Product 1446790
+ slug: product-1446790
meta_description:
meta_keywords:
variant_count: 1
- available_on: '2025-04-29T10:51:09.354Z'
+ available_on: '2025-04-29T16:01:02.256Z'
purchasable: true
in_stock: false
backorderable: true
@@ -8754,7 +8787,7 @@ paths:
amount_in_cents: 999
currency: USD
display_amount: "$9.99"
- recorded_at: '2026-04-14T10:51:09Z'
+ recorded_at: '2026-04-14T16:01:02Z'
schema:
"$ref": "#/components/schemas/Product"
'404':
@@ -9129,9 +9162,9 @@ paths:
example:
id: cart_UkLWZg9DAJ
market_id:
- number: R020356036
- token: GHnHfacc14zgYkeFCtTp8q6SQMLJUzeDEYH
+ number: R021918322
+ token: SAUJRQh1TveULkP81cF4ixpTswBACZZcF6F
customer_note:
currency: USD
locale: en
@@ -9170,8 +9203,8 @@ paths:
variant_id: variant_UkLWZg9DAJ
quantity: 1
currency: USD
- name: Product 1646644
- slug: product-1646644
+ name: Product 1643340
+ slug: product-1643340
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -9196,7 +9229,7 @@ paths:
digital_links: []
fulfillments:
- id: ful_UkLWZg9DAJ
- number: H39848763315
+ number: H00294560922
tracking: U10000
tracking_url:
cost: '100.0'
@@ -9224,14 +9257,14 @@ paths:
code: UPS_GROUND
stock_location:
id: sloc_UkLWZg9DAJ
- state_abbr: STATE_ABBR_361
- name: Eliza Johnson
+ state_abbr: NY
+ name: Silva Hills
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
country_iso: US
country_name: United States of America
- state_text: STATE_ABBR_361
+ state_text: NY
delivery_rates:
- id: dr_UkLWZg9DAJ
delivery_method_id: dm_UkLWZg9DAJ
@@ -9254,8 +9287,8 @@ paths:
payments:
- id: py_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
- response_code: 1-SC-20260429105114663503
- number: PX5MHHHA
+ response_code: 1-SC-20260429160107728556
+ number: PE5SHORE
amount: '10.0'
display_amount: "$10.00"
status: checkout
@@ -9276,50 +9309,52 @@ paths:
description: Store Credit
type: Spree::PaymentMethod::StoreCredit
session_required: false
+ source_required: true
billing_address:
id: addr_EfhxLZ9ck8
first_name: John
last_name: Doe
full_name: John Doe
- address1: 313 Lovely Street
+ address1: 317 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_363
- state_abbr: STATE_ABBR_363
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_363
+ state_name: New York
shipping_address:
id: addr_VqXmZF31wY
first_name: John
last_name: Doe
full_name: John Doe
- address1: 314 Lovely Street
+ address1: 318 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_364
- state_abbr: STATE_ABBR_364
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_364
+ state_name: New York
payment_methods:
- id: pm_UkLWZg9DAJ
name: Store Credit
description: Store Credit
type: Spree::PaymentMethod::StoreCredit
session_required: false
+ source_required: true
gift_card:
market:
schema:
@@ -9396,9 +9431,9 @@ paths:
example:
id: cart_UkLWZg9DAJ
market_id:
- number: R169499153
- token: BiKX4rq41Qyxxq2UcdbhD3mXEKbp8iZsKG3
+ number: R685003154
+ token: 2HqSo4dFnwipJUsBxSm53XA3SC7q9auGjkx
customer_note:
currency: USD
locale: en
@@ -9440,8 +9475,8 @@ paths:
variant_id: variant_UkLWZg9DAJ
quantity: 1
currency: USD
- name: Product 1662939
- slug: product-1662939
+ name: Product 1662543
+ slug: product-1662543
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -9466,7 +9501,7 @@ paths:
digital_links: []
fulfillments:
- id: ful_UkLWZg9DAJ
- number: H07475797758
+ number: H00399261907
tracking: U10000
tracking_url:
cost: '100.0'
@@ -9494,14 +9529,14 @@ paths:
code: UPS_GROUND
stock_location:
id: sloc_UkLWZg9DAJ
- state_abbr: STATE_ABBR_369
- name: Hilma Spencer
+ state_abbr: NY
+ name: Ermelinda Trantow
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
country_iso: US
country_name: United States of America
- state_text: STATE_ABBR_369
+ state_text: NY
delivery_rates:
- id: dr_UkLWZg9DAJ
delivery_method_id: dm_UkLWZg9DAJ
@@ -9527,39 +9562,39 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 321 Lovely Street
+ address1: 325 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_371
- state_abbr: STATE_ABBR_371
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_371
+ state_name: New York
shipping_address:
id: addr_VqXmZF31wY
first_name: John
last_name: Doe
full_name: John Doe
- address1: 322 Lovely Street
+ address1: 326 Lovely Street
address2: Northwest
- postal_code: '35005'
- city: Herndon
+ postal_code: '10118'
+ city: New York
phone: 555-555-0199
company: Company
country_name: United States of America
country_iso: US
- state_text: STATE_ABBR_372
- state_abbr: STATE_ABBR_372
+ state_text: NY
+ state_abbr: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
- state_name: STATE_NAME_372
+ state_name: New York
payment_methods: []
gift_card:
market:
@@ -9625,7 +9660,7 @@ paths:
data:
- id: wl_UkLWZg9DAJ
name: My Wishlist
- token: Z7DaDpsmubLfKkyNfx21PsbY
+ token: qKXFEJg674GQFMJdhX4aP21s
is_default: false
is_private: true
meta:
@@ -9701,7 +9736,7 @@ paths:
example:
id: wl_gbHJdmfrXB
name: Birthday Ideas
- token: 3hdDht5j3dMfvXahEcDmUKNb
+ token: L23Wwbu1VdwURuQb3d9QhNo3
is_default: false
is_private: true
schema:
@@ -9797,7 +9832,7 @@ paths:
example:
id: wl_UkLWZg9DAJ
name: My Wishlist
- token: ubLMnj4paswMWgoZV6TmuPSC
+ token: vnMGJpfADtGcEPdtKSfeNcMf
is_default: false
is_private: true
schema:
@@ -9859,7 +9894,7 @@ paths:
example:
id: wl_UkLWZg9DAJ
name: Updated Name
- token: AdgqhhL8PxMQyeqZrB5ZqVda
+ token: 4SxcHcYqoPne3UnSxaWTyemQ
is_default: false
is_private: true
schema:
@@ -10772,6 +10807,8 @@ components:
nullable: true
accepts_email_marketing:
type: boolean
+ full_name:
+ type: string
available_store_credit_total:
type: string
display_available_store_credit_total:
@@ -10795,6 +10832,7 @@ components:
- last_name
- phone
- accepts_email_marketing
+ - full_name
- available_store_credit_total
- display_available_store_credit_total
- addresses
@@ -11622,12 +11660,15 @@ components:
type: string
session_required:
type: boolean
+ source_required:
+ type: boolean
required:
- id
- name
- description
- type
- session_required
+ - source_required
x-typelizer: true
Payment:
type: object
diff --git a/docs/plans/5.5-admin-customers-api.md b/docs/plans/5.5-admin-customers-api.md
index cc7b249c63..b5515f0998 100644
--- a/docs/plans/5.5-admin-customers-api.md
+++ b/docs/plans/5.5-admin-customers-api.md
@@ -75,15 +75,13 @@ addresses (many)
| Field | Source | Rationale |
|---|---|---|
| `login` | `user.login` | Distinct from email if customer username is supported |
-| `has_account` | `user.encrypted_password.present?` | Differentiates registered vs guest checkouts (Medusa parity) |
| `created_at`, `updated_at` | column | Audit |
| `last_sign_in_at`, `current_sign_in_at`, `sign_in_count` | columns | Already in current admin serializer |
| `last_sign_in_ip`, `current_sign_in_ip` | columns | Already in current admin serializer |
| `failed_attempts` | column | Already in current admin serializer (Devise; lockout in 6.0 platform-auth plan) |
| `tags` | `tag_list` | Merchant-tagging, not facing storefront |
| `internal_note_html` | `internal_note.body.to_s` | Sanitised HTML; matches `description_html` pattern in `6.0-rich-text-descriptions.md` |
-| `public_metadata` | column | Customer-readable metadata |
-| `private_metadata` | column | Admin-only metadata |
+| `metadata` | `user.metadata` (Stripe-style; backed by `private_metadata` column) | Admin-only key/value bag. Match the Order/LineItem/Refund convention; never expose `public_metadata`. |
| `orders_count` | `SELECT COUNT(*) FROM orders WHERE user_id=?` (cached) | Computed |
| `total_spent` | `SELECT SUM(total) FROM orders WHERE user_id=? AND state='complete'` (cached, returned as string per Alba `:oj_rails`) | Computed |
| `display_total_spent` | `Spree::Money.new(total_spent, currency).to_s` | Human format |
@@ -154,7 +152,6 @@ GET /api/v3/admin/customers?q[search]=jane&q[tags_name_in][]=VIP&sort=-last_orde
| `q[created_at_gteq]`, `q[created_at_lteq]` | ISO datetime | range |
| `q[orders_completed_at_gteq]` | last-active range — joins orders | already supported via `whitelisted_ransackable_associations` adding `orders` |
| `q[orders_total_gteq]` | total spend filter (joins orders, sums via Ransack scope) | Ransack scope `with_min_total_spent` (new — server-side aggregate) |
-| `q[has_account_eq]` | `=true` (computed) | Ransack scope `registered`/`guest` (new) |
`sort=-last_order_completed_at` — JSON:API style. Supported sorts: `created_at`, `email`, `last_sign_in_at`, `orders_count`, `total_spent`, `last_order_completed_at`.
@@ -293,8 +290,7 @@ From competitor parity + research:
3. **Last activity** — `?q[orders_completed_at_gteq]=2026-01-01` (active in 2026). `?sort=-last_order_completed_at`.
4. **High value** — `?q[orders_total_gteq]=1000` (lifetime spend ≥ $1000). New Ransack scope, joins + sums orders.
5. **Newsletter** — `?q[accepts_email_marketing_eq]=true`.
-6. **Registered vs guest** — `?q[has_account_eq]=true`. New Ransack scope.
-7. **Date filters** — `?q[created_at_gteq]=...&q[created_at_lteq]=...`.
+6. **Date filters** — `?q[created_at_gteq]=...&q[created_at_lteq]=...`.
We do not implement a Shopify-style `query=tag:VIP` parser. Ransack is the convention; the SDK can build query strings from a typed filter object on the client side.
@@ -339,7 +335,7 @@ These are reserved in `6.0-admin-api.md` and the EU compliance plan; do not impl
This is a new endpoint family. No backfills, no data migration.
-1. **Extend `Spree::User` whitelisted ransack attributes** with `phone`, `created_at`, `last_sign_in_at`, `tags` (already includes the rest). Add scopes `with_min_total_spent`, `registered`, `guest`. One PR.
+1. **Extend `Spree::User` whitelisted ransack attributes** with `phone`, `created_at`, `last_sign_in_at`, `tags` (already includes the rest). Add scope `with_min_total_spent`. One PR.
2. **Extend `Spree::Api::V3::Admin::CustomerSerializer`** with the new fields above. Run typelizer + zod regeneration per CLAUDE.md pipeline.
3. **Add `Spree::Api::V3::Admin::CustomersController`** inheriting from `ResourceController`. Override `model_class`, `serializer_class`, `scope` (filter to current_store via order or role join), `permitted_params` (use `Spree::PermittedAttributes.user_attributes`).
4. **Add `Spree::Api::V3::Admin::Customers::AddressesController`** (`/customers/:customer_id/addresses`). Uses existing `Spree::PermittedAttributes.address_attributes`. Implements default-flag rotation in a service `Spree::Customers::SetDefaultAddress`.
@@ -358,13 +354,13 @@ This is a new endpoint family. No backfills, no data migration.
- **`total_spent` is a string**, per `Alba :oj_rails` BigDecimal-as-string convention.
- **List endpoint must use `accessible_by(current_ability, :show)`** before any other scoping — admin role gating is upstream of store filtering.
-## Open Questions
+## Open Questions — RESOLVED
-1. **Store filtering scope.** What's the right "this customer belongs to this store" rule? Candidates: (a) has any order in the store, (b) is in any `CustomerGroup` scoped to the store, (c) has a store-scoped role. Today all three exist. **Proposed:** `current_store.users` association = `has_many :through` orders + groups + roles, cached. Implement once and reuse.
-2. **Welcome / invitation email on POST.** Saleor passes `redirectUrl`. Shopify has `send_invite`. Spree's pattern is "do nothing automatic; merchant calls password-reset endpoint." Confirm or revise.
-3. **`internal_note_html` direction.** ActionText is being phased out (`6.0-rich-text-descriptions.md`). For 5.5, do we accept ActionText storage but expose `internal_note_html` (sanitised) as the API contract? **Proposed:** yes — same shape as products' `description_html`.
-4. **Order count + spend cache invalidation.** A subscriber on `order.*` events keying off `customer_id` is straightforward. Confirm event payload includes `prefixed_id` so the cache key matches.
-5. **Tags write semantics.** Replace vs append? Shopify replaces. Vendure has separate `add`/`remove` mutations. **Proposed:** `tags: [...]` in PATCH replaces the full set. Concise, matches our flat-JSON convention.
+1. **Store filtering scope** → Customers are NOT store-scoped. List returns all users (matching current behavior of `Spree.user_class.for_store(store)` returning `self`).
+2. **Welcome / invitation email on POST** → No automatic email. Merchants call password-reset endpoint explicitly if needed.
+3. **`internal_note_html` direction** → Yes — accept ActionText storage, expose `internal_note_html` (sanitised) as the API contract. Matches products' `description_html`.
+4. **Order count + spend cache invalidation** → Cache via subscriber is the right design but **deferred for now** — initial implementation computes inline (acceptable for MVP).
+5. **Tags write semantics** → Replace. `tags: [...]` in PATCH replaces the full set.
## References
diff --git a/packages/admin-sdk/src/admin-client.ts b/packages/admin-sdk/src/admin-client.ts
index 5669b24669..02f4bfe814 100644
--- a/packages/admin-sdk/src/admin-client.ts
+++ b/packages/admin-sdk/src/admin-client.ts
@@ -69,7 +69,7 @@ export interface MeResponse {
};
permissions: PermissionRule[];
}
-import type { Store, Product, Order, Media, Category, TaxCategory, Country, Variant } from './types';
+import type { Store, Product, Order, Media, Category, TaxCategory, Country, Variant, PaymentMethod, Customer, CreditCard, Payment, Address, StoreCredit } from './types';
import type {
StoreUpdateParams,
ProductUpdateParams,
@@ -80,6 +80,12 @@ import type {
OrderApproveParams,
GiftCardApplyParams,
StoreCreditApplyParams,
+ PaymentCreateParams,
+ CustomerCreateParams,
+ CustomerUpdateParams,
+ CustomerAddressParams,
+ CustomerStoreCreditCreateParams,
+ CustomerStoreCreditUpdateParams,
MediaCreateParams,
MediaUpdateParams,
LineItemCreateParams,
@@ -263,6 +269,21 @@ export class AdminClient {
},
payments: {
+ list: (orderId: string, params?: ListParams & Record<string, unknown>, options?: RequestOptions): Promise<PaginatedResponse<Payment>> =>
+ this.request<PaginatedResponse<Payment>>('GET', `/orders/${orderId}/payments`, {
+ ...options,
+ params: params ? transformListParams(params) : undefined,
+ }),
+
+ get: (orderId: string, id: string, params?: { expand?: string[] }, options?: RequestOptions): Promise<Payment> =>
+ this.request<Payment>('GET', `/orders/${orderId}/payments/${id}`, {
+ ...options,
+ params: getParams(params),
+ }),
+
+ create: (orderId: string, params: PaymentCreateParams, options?: RequestOptions): Promise<Payment> =>
+ this.request<Payment>('POST', `/orders/${orderId}/payments`, { ...options, body: params }),
+
capture: (orderId: string, id: string, options?: RequestOptions): Promise<unknown> =>
this.request('PATCH', `/orders/${orderId}/payments/${id}/capture`, options),
@@ -271,6 +292,126 @@ export class AdminClient {
},
};
+ // ============================================
+ // Payment Methods
+ // ============================================
+
+ readonly paymentMethods = {
+ list: (params?: ListParams & Record<string, unknown>, options?: RequestOptions): Promise<PaginatedResponse<PaymentMethod>> =>
+ this.request<PaginatedResponse<PaymentMethod>>('GET', '/payment_methods', {
+ ...options,
+ params: params ? transformListParams(params) : undefined,
+ }),
+
+ get: (id: string, params?: { expand?: string[] }, options?: RequestOptions): Promise<PaymentMethod> =>
+ this.request<PaymentMethod>('GET', `/payment_methods/${id}`, {
+ ...options,
+ params: getParams(params),
+ }),
+ };
+
+ // ============================================
+ // Tags
+ // ============================================
+
+ readonly tags = {
+ list: (params: { taggable_type: string; q?: string }, options?: RequestOptions): Promise<{ data: Array<{ name: string }> }> =>
+ this.request<{ data: Array<{ name: string }> }>('GET', '/tags', {
+ ...options,
+ params,
+ }),
+ };
+
+ // ============================================
+ // Customers
+ // ============================================
+
+ readonly customers = {
+ list: (params?: ListParams & Record<string, unknown>, options?: RequestOptions): Promise<PaginatedResponse<Customer>> =>
+ this.request<PaginatedResponse<Customer>>('GET', '/customers', {
+ ...options,
+ params: params ? transformListParams(params) : undefined,
+ }),
+
+ get: (id: string, params?: { expand?: string[] }, options?: RequestOptions): Promise<Customer> =>
+ this.request<Customer>('GET', `/customers/${id}`, {
+ ...options,
+ params: getParams(params),
+ }),
+
+ creditCards: {
+ list: (customerId: string, params?: ListParams & Record<string, unknown>, options?: RequestOptions): Promise<PaginatedResponse<CreditCard>> =>
+ this.request<PaginatedResponse<CreditCard>>('GET', `/customers/${customerId}/credit_cards`, {
+ ...options,
+ params: params ? transformListParams(params) : undefined,
+ }),
+
+ get: (customerId: string, id: string, params?: { expand?: string[] }, options?: RequestOptions): Promise<CreditCard> =>
+ this.request<CreditCard>('GET', `/customers/${customerId}/credit_cards/${id}`, {
+ ...options,
+ params: getParams(params),
+ }),
+
+ delete: (customerId: string, id: string, options?: RequestOptions): Promise<void> =>
+ this.request<void>('DELETE', `/customers/${customerId}/credit_cards/${id}`, options),
+ },
+
+ create: (params: CustomerCreateParams, options?: RequestOptions): Promise<Customer> =>
+ this.request<Customer>('POST', '/customers', { ...options, body: params }),
+
+ update: (id: string, params: CustomerUpdateParams, options?: RequestOptions): Promise<Customer> =>
+ this.request<Customer>('PATCH', `/customers/${id}`, { ...options, body: params }),
+
+ delete: (id: string, options?: RequestOptions): Promise<void> =>
+ this.request<void>('DELETE', `/customers/${id}`, options),
+
+ addresses: {
+ list: (customerId: string, params?: ListParams & Record<string, unknown>, options?: RequestOptions): Promise<PaginatedResponse<Address>> =>
+ this.request<PaginatedResponse<Address>>('GET', `/customers/${customerId}/addresses`, {
+ ...options,
+ params: params ? transformListParams(params) : undefined,
+ }),
+
+ get: (customerId: string, id: string, params?: { expand?: string[] }, options?: RequestOptions): Promise<Address> =>
+ this.request<Address>('GET', `/customers/${customerId}/addresses/${id}`, {
+ ...options,
+ params: getParams(params),
+ }),
+
+ create: (customerId: string, params: CustomerAddressParams, options?: RequestOptions): Promise<Address> =>
+ this.request<Address>('POST', `/customers/${customerId}/addresses`, { ...options, body: params }),
+
+ update: (customerId: string, id: string, params: CustomerAddressParams, options?: RequestOptions): Promise<Address> =>
+ this.request<Address>('PATCH', `/customers/${customerId}/addresses/${id}`, { ...options, body: params }),
+
+ delete: (customerId: string, id: string, options?: RequestOptions): Promise<void> =>
+ this.request<void>('DELETE', `/customers/${customerId}/addresses/${id}`, options),
+ },
+
+ storeCredits: {
+ list: (customerId: string, params?: ListParams & Record<string, unknown>, options?: RequestOptions): Promise<PaginatedResponse<StoreCredit>> =>
+ this.request<PaginatedResponse<StoreCredit>>('GET', `/customers/${customerId}/store_credits`, {
+ ...options,
+ params: params ? transformListParams(params) : undefined,
+ }),
+
+ get: (customerId: string, id: string, params?: { expand?: string[] }, options?: RequestOptions): Promise<StoreCredit> =>
+ this.request<StoreCredit>('GET', `/customers/${customerId}/store_credits/${id}`, {
+ ...options,
+ params: getParams(params),
+ }),
+
+ create: (customerId: string, params: CustomerStoreCreditCreateParams, options?: RequestOptions): Promise<StoreCredit> =>
+ this.request<StoreCredit>('POST', `/customers/${customerId}/store_credits`, { ...options, body: params }),
+
+ update: (customerId: string, id: string, params: CustomerStoreCreditUpdateParams, options?: RequestOptions): Promise<StoreCredit> =>
+ this.request<StoreCredit>('PATCH', `/customers/${customerId}/store_credits/${id}`, { ...options, body: params }),
+
+ delete: (customerId: string, id: string, options?: RequestOptions): Promise<void> =>
+ this.request<void>('DELETE', `/customers/${customerId}/store_credits/${id}`, options),
+ },
+ };
+
// ============================================
// Categories
// ============================================
diff --git a/packages/admin-sdk/src/params.ts b/packages/admin-sdk/src/params.ts
index 4eda7febce..0204ce16e6 100644
--- a/packages/admin-sdk/src/params.ts
+++ b/packages/admin-sdk/src/params.ts
@@ -145,6 +145,62 @@ export interface StoreCreditApplyParams {
amount?: number;
}
+export interface CustomerCreateParams {
+ email: string;
+ first_name?: string;
+ last_name?: string;
+ phone?: string;
+ accepts_email_marketing?: boolean;
+ internal_note?: string;
+ metadata?: Record<string, unknown>;
+ tags?: string[];
+}
+
+export interface CustomerUpdateParams {
+ email?: string;
+ first_name?: string;
+ last_name?: string;
+ phone?: string;
+ accepts_email_marketing?: boolean;
+ internal_note?: string;
+ metadata?: Record<string, unknown>;
+ tags?: string[];
+}
+
+export interface CustomerAddressParams {
+ firstname?: string;
+ lastname?: string;
+ first_name?: string;
+ last_name?: string;
+ address1?: string;
+ address2?: string;
+ city?: string;
+ zipcode?: string;
+ postal_code?: string;
+ country_id?: string | number;
+ state_id?: string | number;
+ country_iso?: string;
+ state_abbr?: string;
+ phone?: string;
+ company?: string;
+ label?: string;
+ is_default_billing?: boolean;
+ is_default_shipping?: boolean;
+}
+
+export interface CustomerStoreCreditCreateParams {
+ amount: number;
+ currency: string;
+ category_id: string | number;
+ memo?: string;
+}
+
+export interface CustomerStoreCreditUpdateParams {
+ amount?: number;
+ category_id?: string | number;
+ memo?: string;
+}
+
export interface DirectUploadCreateParams {
blob: {
filename: string;
diff --git a/packages/admin-sdk/src/types/generated/Customer.ts b/packages/admin-sdk/src/types/generated/Customer.ts
index dbe58005e3..cb58431d06 100644
--- a/packages/admin-sdk/src/types/generated/Customer.ts
+++ b/packages/admin-sdk/src/types/generated/Customer.ts
@@ -1,7 +1,7 @@
-// Typelizer digest bb0830e64ea9b1cc4d3135ae5f295365
+// Typelizer digest 364c7ca82f639cea2fcf7042221c78cb
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {Address, Order} from '@/types'
+import type {Address, Order, StoreCredit} from '@/types'
interface Customer {
id: string;
@@ -10,6 +10,7 @@ interface Customer {
last_name: string | null;
phone: string | null;
accepts_email_marketing: boolean;
+ full_name: string;
available_store_credit_total: string;
display_available_store_credit_total: string;
addresses?: Array<Address>;
@@ -24,7 +25,17 @@ interface Customer {
failed_attempts: number;
last_sign_in_ip: string | null;
current_sign_in_ip: string | null;
+ tags: Array<string>;
+ internal_note_html: string | null;
+ metadata: Record<string, unknown> | null;
+ default_billing_address_id: string | null;
+ default_shipping_address_id: string | null;
+ orders_count: number;
+ total_spent: string;
+ display_total_spent: string;
+ last_order_completed_at: string | null;
orders?: Array<Order>;
+ store_credits?: Array<StoreCredit>;
}
export default Customer;
diff --git a/packages/admin-sdk/src/types/generated/Order.ts b/packages/admin-sdk/src/types/generated/Order.ts
index 4e6ecb8f70..2f1fa2a5e1 100644
--- a/packages/admin-sdk/src/types/generated/Order.ts
+++ b/packages/admin-sdk/src/types/generated/Order.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 3411cae469bcef40969f70ce7963aab9
+// Typelizer digest cd79116d7a5ace207b4bf85fcfe4c2b5
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {Discount, LineItem, Fulfillment, Payment, Address, GiftCard, Market, PaymentMethod, Customer, Adjustment, ReturnAuthorization, Reimbursement} from '@/types'
@@ -57,6 +57,7 @@ interface Order {
approved_at: string | null;
created_at: string;
updated_at: string;
+ tags: Array<string>;
internal_note: string | null;
metadata: Record<string, unknown> | null;
approver_id: string | null;
diff --git a/packages/admin-sdk/src/types/generated/PaymentMethod.ts b/packages/admin-sdk/src/types/generated/PaymentMethod.ts
index babdf0f928..4fdbf13df9 100644
--- a/packages/admin-sdk/src/types/generated/PaymentMethod.ts
+++ b/packages/admin-sdk/src/types/generated/PaymentMethod.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 01d633f0d9815b2d970c02b7bb6ef3a2
+// Typelizer digest 1639362fb6ae1abe86a8de8682417eb0
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
@@ -8,6 +8,7 @@ interface PaymentMethod {
description: string | null;
type: string;
session_required: boolean;
+ source_required: boolean;
active: boolean;
auto_capture: boolean | null;
created_at: string;
diff --git a/packages/admin/src/components/tag-combobox.tsx b/packages/admin/src/components/tag-combobox.tsx
new file mode 100644
index 0000000000..f4da964ed9
--- /dev/null
+++ b/packages/admin/src/components/tag-combobox.tsx
@@ -0,0 +1,93 @@
+import { useQuery } from '@tanstack/react-query'
+import { useMemo, useState } from 'react'
+import { adminClient } from '@/client'
+import { useAuth } from '@/hooks/use-auth'
+import {
+ Combobox,
+ ComboboxChip,
+ ComboboxChips,
+ ComboboxChipsInput,
+ ComboboxContent,
+ ComboboxEmpty,
+ ComboboxItem,
+ ComboboxList,
+ ComboboxValue,
+ useComboboxAnchor,
+} from '@/components/ui/combobox'
+
+export type TaggableType = 'Spree::Product' | 'Spree::Order' | 'Spree::User'
+
+export function TagCombobox({
+ taggableType,
+ value,
+ onChange,
+ placeholder = 'Type to add tags…',
+}: {
+ taggableType: TaggableType
+ value: string[]
+ onChange: (value: string[]) => void
+ placeholder?: string
+}) {
+ const anchorRef = useComboboxAnchor()
+ const [inputValue, setInputValue] = useState('')
+ const { isAuthenticated } = useAuth()
+
+ const { data } = useQuery({
+ queryKey: ['admin-tags', taggableType],
+ queryFn: () => adminClient.tags.list({ taggable_type: taggableType }),
+ enabled: isAuthenticated,
+ staleTime: 60_000,
+ })
+
+ const existingTags = data?.data?.map((t) => t.name) ?? []
+
+ // Append the typed value as a "Create" candidate so the user can confirm new tags
+ // via the dropdown (in addition to the Enter shortcut).
+ const items = useMemo(() => {
+ const set = new Set([...existingTags, ...value])
+ const trimmed = inputValue.trim()
+ if (trimmed) set.add(trimmed)
+ return Array.from(set)
+ }, [existingTags, value, inputValue])
+
+ const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
+ if (e.key === 'Enter' && inputValue.trim()) {
+ e.preventDefault()
+ const tag = inputValue.trim()
+ if (!value.includes(tag)) onChange([...value, tag])
+ setInputValue('')
+ }
+ }
+
+ return (
+ <Combobox multiple items={items} value={value} onValueChange={onChange}>
+ <ComboboxChips ref={anchorRef}>
+ <ComboboxValue>
+ {(selectedValues: string[]) =>
+ selectedValues.map((tag) => <ComboboxChip key={tag}>{tag}</ComboboxChip>)
+ }
+ </ComboboxValue>
+ <ComboboxChipsInput
+ placeholder={placeholder}
+ value={inputValue}
+ onChange={(e) => setInputValue((e.target as HTMLInputElement).value)}
+ onKeyDown={handleKeyDown}
+ />
+ </ComboboxChips>
+ <ComboboxContent anchor={anchorRef}>
+ <ComboboxEmpty>Type and press Enter to create a tag</ComboboxEmpty>
+ <ComboboxList>
+ {(tag: string) => {
+ const isSelected = value.includes(tag)
+ const isExisting = existingTags.includes(tag)
+ return (
+ <ComboboxItem key={tag} value={tag}>
+ {isExisting || isSelected ? tag : <>Create &ldquo;{tag}&rdquo;</>}
+ </ComboboxItem>
+ )
+ }}
+ </ComboboxList>
+ </ComboboxContent>
+ </Combobox>
+ )
+}
diff --git a/packages/admin/src/routeTree.gen.ts b/packages/admin/src/routeTree.gen.ts
index 43d7f9b7ff..9ac606d6af 100644
--- a/packages/admin/src/routeTree.gen.ts
+++ b/packages/admin/src/routeTree.gen.ts
@@ -16,9 +16,12 @@ import { Route as AuthenticatedStoreIdRouteImport } from './routes/_authenticate
import { Route as AuthenticatedStoreIdIndexRouteImport } from './routes/_authenticated/$storeId/index'
import { Route as AuthenticatedStoreIdProductsIndexRouteImport } from './routes/_authenticated/$storeId/products/index'
import { Route as AuthenticatedStoreIdOrdersIndexRouteImport } from './routes/_authenticated/$storeId/orders/index'
+import { Route as AuthenticatedStoreIdCustomersIndexRouteImport } from './routes/_authenticated/$storeId/customers/index'
import { Route as AuthenticatedStoreIdProductsProductIdRouteImport } from './routes/_authenticated/$storeId/products/$productId'
+import { Route as AuthenticatedStoreIdOrdersNewRouteImport } from './routes/_authenticated/$storeId/orders/new'
import { Route as AuthenticatedStoreIdOrdersDraftsRouteImport } from './routes/_authenticated/$storeId/orders/drafts'
import { Route as AuthenticatedStoreIdOrdersOrderIdRouteImport } from './routes/_authenticated/$storeId/orders/$orderId'
+import { Route as AuthenticatedStoreIdCustomersCustomerIdRouteImport } from './routes/_authenticated/$storeId/customers/$customerId'
const LoginRoute = LoginRouteImport.update({
id: '/login',
@@ -57,12 +60,24 @@ const AuthenticatedStoreIdOrdersIndexRoute =
path: '/orders/',
getParentRoute: () => AuthenticatedStoreIdRoute,
} as any)
+const AuthenticatedStoreIdCustomersIndexRoute =
+ AuthenticatedStoreIdCustomersIndexRouteImport.update({
+ id: '/customers/',
+ path: '/customers/',
+ getParentRoute: () => AuthenticatedStoreIdRoute,
+ } as any)
const AuthenticatedStoreIdProductsProductIdRoute =
AuthenticatedStoreIdProductsProductIdRouteImport.update({
id: '/products/$productId',
path: '/products/$productId',
getParentRoute: () => AuthenticatedStoreIdRoute,
} as any)
+const AuthenticatedStoreIdOrdersNewRoute =
+ AuthenticatedStoreIdOrdersNewRouteImport.update({
+ id: '/orders/new',
+ path: '/orders/new',
+ getParentRoute: () => AuthenticatedStoreIdRoute,
+ } as any)
const AuthenticatedStoreIdOrdersDraftsRoute =
AuthenticatedStoreIdOrdersDraftsRouteImport.update({
id: '/orders/drafts',
@@ -75,15 +90,24 @@ const AuthenticatedStoreIdOrdersOrderIdRoute =
path: '/orders/$orderId',
getParentRoute: () => AuthenticatedStoreIdRoute,
} as any)
+const AuthenticatedStoreIdCustomersCustomerIdRoute =
+ AuthenticatedStoreIdCustomersCustomerIdRouteImport.update({
+ id: '/customers/$customerId',
+ path: '/customers/$customerId',
+ getParentRoute: () => AuthenticatedStoreIdRoute,
+ } as any)
export interface FileRoutesByFullPath {
'/': typeof AuthenticatedIndexRoute
'/login': typeof LoginRoute
'/$storeId': typeof AuthenticatedStoreIdRouteWithChildren
'/$storeId/': typeof AuthenticatedStoreIdIndexRoute
+ '/$storeId/customers/$customerId': typeof AuthenticatedStoreIdCustomersCustomerIdRoute
'/$storeId/orders/$orderId': typeof AuthenticatedStoreIdOrdersOrderIdRoute
'/$storeId/orders/drafts': typeof AuthenticatedStoreIdOrdersDraftsRoute
+ '/$storeId/orders/new': typeof AuthenticatedStoreIdOrdersNewRoute
'/$storeId/products/$productId': typeof AuthenticatedStoreIdProductsProductIdRoute
+ '/$storeId/customers/': typeof AuthenticatedStoreIdCustomersIndexRoute
'/$storeId/orders/': typeof AuthenticatedStoreIdOrdersIndexRoute
'/$storeId/products/': typeof AuthenticatedStoreIdProductsIndexRoute
}
@@ -91,9 +115,12 @@ export interface FileRoutesByTo {
'/login': typeof LoginRoute
'/': typeof AuthenticatedIndexRoute
'/$storeId': typeof AuthenticatedStoreIdIndexRoute
+ '/$storeId/customers/$customerId': typeof AuthenticatedStoreIdCustomersCustomerIdRoute
'/$storeId/orders/$orderId': typeof AuthenticatedStoreIdOrdersOrderIdRoute
'/$storeId/orders/drafts': typeof AuthenticatedStoreIdOrdersDraftsRoute
+ '/$storeId/orders/new': typeof AuthenticatedStoreIdOrdersNewRoute
'/$storeId/products/$productId': typeof AuthenticatedStoreIdProductsProductIdRoute
+ '/$storeId/customers': typeof AuthenticatedStoreIdCustomersIndexRoute
'/$storeId/orders': typeof AuthenticatedStoreIdOrdersIndexRoute
'/$storeId/products': typeof AuthenticatedStoreIdProductsIndexRoute
}
@@ -104,9 +131,12 @@ export interface FileRoutesById {
'/_authenticated/$storeId': typeof AuthenticatedStoreIdRouteWithChildren
'/_authenticated/': typeof AuthenticatedIndexRoute
'/_authenticated/$storeId/': typeof AuthenticatedStoreIdIndexRoute
+ '/_authenticated/$storeId/customers/$customerId': typeof AuthenticatedStoreIdCustomersCustomerIdRoute
'/_authenticated/$storeId/orders/$orderId': typeof AuthenticatedStoreIdOrdersOrderIdRoute
'/_authenticated/$storeId/orders/drafts': typeof AuthenticatedStoreIdOrdersDraftsRoute
+ '/_authenticated/$storeId/orders/new': typeof AuthenticatedStoreIdOrdersNewRoute
'/_authenticated/$storeId/products/$productId': typeof AuthenticatedStoreIdProductsProductIdRoute
+ '/_authenticated/$storeId/customers/': typeof AuthenticatedStoreIdCustomersIndexRoute
'/_authenticated/$storeId/orders/': typeof AuthenticatedStoreIdOrdersIndexRoute
'/_authenticated/$storeId/products/': typeof AuthenticatedStoreIdProductsIndexRoute
}
@@ -117,9 +147,12 @@ export interface FileRouteTypes {
| '/login'
| '/$storeId'
| '/$storeId/'
+ | '/$storeId/customers/$customerId'
| '/$storeId/orders/$orderId'
| '/$storeId/orders/drafts'
+ | '/$storeId/orders/new'
| '/$storeId/products/$productId'
+ | '/$storeId/customers/'
| '/$storeId/orders/'
| '/$storeId/products/'
fileRoutesByTo: FileRoutesByTo
@@ -127,9 +160,12 @@ export interface FileRouteTypes {
| '/login'
| '/'
| '/$storeId'
+ | '/$storeId/customers/$customerId'
| '/$storeId/orders/$orderId'
| '/$storeId/orders/drafts'
+ | '/$storeId/orders/new'
| '/$storeId/products/$productId'
+ | '/$storeId/customers'
| '/$storeId/orders'
| '/$storeId/products'
id:
@@ -139,9 +175,12 @@ export interface FileRouteTypes {
| '/_authenticated/$storeId'
| '/_authenticated/'
| '/_authenticated/$storeId/'
+ | '/_authenticated/$storeId/customers/$customerId'
| '/_authenticated/$storeId/orders/$orderId'
| '/_authenticated/$storeId/orders/drafts'
+ | '/_authenticated/$storeId/orders/new'
| '/_authenticated/$storeId/products/$productId'
+ | '/_authenticated/$storeId/customers/'
| '/_authenticated/$storeId/orders/'
| '/_authenticated/$storeId/products/'
fileRoutesById: FileRoutesById
@@ -202,6 +241,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof AuthenticatedStoreIdOrdersIndexRouteImport
parentRoute: typeof AuthenticatedStoreIdRoute
}
+ '/_authenticated/$storeId/customers/': {
+ id: '/_authenticated/$storeId/customers/'
+ path: '/customers'
+ fullPath: '/$storeId/customers/'
+ preLoaderRoute: typeof AuthenticatedStoreIdCustomersIndexRouteImport
+ parentRoute: typeof AuthenticatedStoreIdRoute
+ }
'/_authenticated/$storeId/products/$productId': {
id: '/_authenticated/$storeId/products/$productId'
path: '/products/$productId'
@@ -209,6 +255,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof AuthenticatedStoreIdProductsProductIdRouteImport
parentRoute: typeof AuthenticatedStoreIdRoute
}
+ '/_authenticated/$storeId/orders/new': {
+ id: '/_authenticated/$storeId/orders/new'
+ path: '/orders/new'
+ fullPath: '/$storeId/orders/new'
+ preLoaderRoute: typeof AuthenticatedStoreIdOrdersNewRouteImport
+ parentRoute: typeof AuthenticatedStoreIdRoute
+ }
'/_authenticated/$storeId/orders/drafts': {
id: '/_authenticated/$storeId/orders/drafts'
path: '/orders/drafts'
@@ -223,25 +276,40 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof AuthenticatedStoreIdOrdersOrderIdRouteImport
parentRoute: typeof AuthenticatedStoreIdRoute
}
+ '/_authenticated/$storeId/customers/$customerId': {
+ id: '/_authenticated/$storeId/customers/$customerId'
+ path: '/customers/$customerId'
+ fullPath: '/$storeId/customers/$customerId'
+ preLoaderRoute: typeof AuthenticatedStoreIdCustomersCustomerIdRouteImport
+ parentRoute: typeof AuthenticatedStoreIdRoute
+ }
}
}
interface AuthenticatedStoreIdRouteChildren {
AuthenticatedStoreIdIndexRoute: typeof AuthenticatedStoreIdIndexRoute
+ AuthenticatedStoreIdCustomersCustomerIdRoute: typeof AuthenticatedStoreIdCustomersCustomerIdRoute
AuthenticatedStoreIdOrdersOrderIdRoute: typeof AuthenticatedStoreIdOrdersOrderIdRoute
AuthenticatedStoreIdOrdersDraftsRoute: typeof AuthenticatedStoreIdOrdersDraftsRoute
+ AuthenticatedStoreIdOrdersNewRoute: typeof AuthenticatedStoreIdOrdersNewRoute
AuthenticatedStoreIdProductsProductIdRoute: typeof AuthenticatedStoreIdProductsProductIdRoute
+ AuthenticatedStoreIdCustomersIndexRoute: typeof AuthenticatedStoreIdCustomersIndexRoute
AuthenticatedStoreIdOrdersIndexRoute: typeof AuthenticatedStoreIdOrdersIndexRoute
AuthenticatedStoreIdProductsIndexRoute: typeof AuthenticatedStoreIdProductsIndexRoute
}
const AuthenticatedStoreIdRouteChildren: AuthenticatedStoreIdRouteChildren = {
AuthenticatedStoreIdIndexRoute: AuthenticatedStoreIdIndexRoute,
+ AuthenticatedStoreIdCustomersCustomerIdRoute:
+ AuthenticatedStoreIdCustomersCustomerIdRoute,
AuthenticatedStoreIdOrdersOrderIdRoute:
AuthenticatedStoreIdOrdersOrderIdRoute,
AuthenticatedStoreIdOrdersDraftsRoute: AuthenticatedStoreIdOrdersDraftsRoute,
+ AuthenticatedStoreIdOrdersNewRoute: AuthenticatedStoreIdOrdersNewRoute,
AuthenticatedStoreIdProductsProductIdRoute:
AuthenticatedStoreIdProductsProductIdRoute,
+ AuthenticatedStoreIdCustomersIndexRoute:
+ AuthenticatedStoreIdCustomersIndexRoute,
AuthenticatedStoreIdOrdersIndexRoute: AuthenticatedStoreIdOrdersIndexRoute,
AuthenticatedStoreIdProductsIndexRoute:
AuthenticatedStoreIdProductsIndexRoute,
diff --git a/packages/admin/src/routes/_authenticated/$storeId/customers/$customerId.tsx b/packages/admin/src/routes/_authenticated/$storeId/customers/$customerId.tsx
new file mode 100644
index 0000000000..08b7028fe1
--- /dev/null
+++ b/packages/admin/src/routes/_authenticated/$storeId/customers/$customerId.tsx
@@ -0,0 +1,873 @@
+import type { Address, Customer, Order, StoreCredit } from '@spree/admin-sdk'
+import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
+import { createFileRoute, Link } from '@tanstack/react-router'
+import {
+ EllipsisVerticalIcon,
+ MailIcon,
+ PencilIcon,
+ PhoneIcon,
+ PlusIcon,
+ StarIcon,
+ TrashIcon,
+} from 'lucide-react'
+import { type FormEvent, useState } from 'react'
+import { adminClient } from '@/client'
+import { useAuth } from '@/hooks/use-auth'
+import { BackButton } from '@/components/back-button'
+import { useConfirm } from '@/components/confirm-dialog'
+import { TagCombobox } from '@/components/tag-combobox'
+import { Badge, StatusBadge } from '@/components/ui/badge'
+import { Button } from '@/components/ui/button'
+import { Card, CardAction, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
+import {
+ Dialog,
+ DialogBody,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@/components/ui/dialog'
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from '@/components/ui/dropdown-menu'
+import { Field, FieldGroup, FieldLabel } from '@/components/ui/field'
+import { Input } from '@/components/ui/input'
+import { Textarea } from '@/components/ui/textarea'
+import { formatRelativeTime } from '@/lib/formatters'
+
+export const Route = createFileRoute('/_authenticated/$storeId/customers/$customerId')({
+ component: CustomerDetailPage,
+})
+
+function useCustomer(customerId: string) {
+ const { isAuthenticated } = useAuth()
+ return useQuery({
+ queryKey: ['customer', customerId],
+ queryFn: () => adminClient.customers.get(customerId, { expand: ['addresses', 'store_credits'] }),
+ enabled: isAuthenticated,
+ })
+}
+
+function useCustomerMutation<TParams>(
+ customerId: string,
+ mutationFn: (params: TParams) => Promise<unknown>,
+) {
+ const queryClient = useQueryClient()
+ return useMutation({
+ mutationFn,
+ onSuccess: () => queryClient.invalidateQueries({ queryKey: ['customer', customerId] }),
+ })
+}
+
+function CustomerDetailPage() {
+ const { customerId } = Route.useParams()
+ const { data: customer, isLoading, error } = useCustomer(customerId)
+
+ if (isLoading) return <p className="text-muted-foreground">Loading customer…</p>
+ if (error || !customer) return <p className="text-destructive">Failed to load customer {customerId}.</p>
+
+ const defaultShipping = customer.addresses?.find((a) => a.is_default_shipping)
+ const location = [defaultShipping?.city, defaultShipping?.country_iso].filter(Boolean).join(', ')
+
+ return (
+ <div className="flex flex-col gap-6">
+ <div className="flex items-center gap-3">
+ <BackButton fallback="customers" />
+ <h1 className="text-2xl font-medium">{customer.full_name}</h1>
+ {location && <span className="text-base font-normal text-muted-foreground">{location}</span>}
+ {customer.tags?.map((tag) => <Badge key={tag}>{tag}</Badge>)}
+ </div>
+
+ <LifetimeStatsCard customer={customer} />
+
+ <CustomerBody customer={customer} />
+ </div>
+ )
+}
+
+function CustomerBody({ customer }: { customer: Customer }) {
+ const { data, isLoading } = useCustomerOrders(customer.id, { limit: 10 })
+ const orders = data?.data ?? []
+ const totalCount = data?.meta?.count ?? orders.length
+ const lastCompletedOrder = orders.find((o) => o.status === 'complete')
+
+ return (
+ <div className="grid grid-cols-12 gap-6">
+ <div className="col-span-12 lg:col-span-8 flex flex-col gap-6">
+ {lastCompletedOrder && <LastOrderCard order={lastCompletedOrder} />}
+ <OrdersCard customer={customer} orders={orders} totalCount={totalCount} isLoading={isLoading} />
+ <StoreCreditsCard customer={customer} />
+ </div>
+
+ <div className="col-span-12 lg:col-span-4 flex flex-col gap-6">
+ <ProfileCard customer={customer} />
+ <AddressesCard customer={customer} />
+ <InternalNoteCard customer={customer} />
+ </div>
+ </div>
+ )
+}
+
+// ---------------------------------------------------------------------------
+// Profile
+// ---------------------------------------------------------------------------
+
+function ProfileCard({ customer }: { customer: Customer }) {
+ const [editOpen, setEditOpen] = useState(false)
+
+ return (
+ <>
+ <Card>
+ <CardHeader>
+ <CardTitle>Profile</CardTitle>
+ <CardAction>
+ <Button size="sm" variant="outline" onClick={() => setEditOpen(true)}>
+ <PencilIcon className="size-4" />
+ Edit
+ </Button>
+ </CardAction>
+ </CardHeader>
+ <CardContent className="flex flex-col gap-3">
+ <div className="flex items-center gap-2 text-sm">
+ <MailIcon className="size-4 text-muted-foreground" />
+ <span>{customer.email}</span>
+ </div>
+ {customer.phone && (
+ <div className="flex items-center gap-2 text-sm">
+ <PhoneIcon className="size-4 text-muted-foreground" />
+ <span>{customer.phone}</span>
+ </div>
+ )}
+ <div className="flex items-center gap-2 text-sm">
+ <StarIcon className="size-4 text-muted-foreground" />
+ <span>{customer.accepts_email_marketing ? 'Subscribed to marketing' : 'Not subscribed to marketing'}</span>
+ </div>
+ {customer.created_at && (
+ <div className="text-xs text-muted-foreground">
+ Customer since {formatRelativeTime(customer.created_at)}
+ </div>
+ )}
+ </CardContent>
+ </Card>
+ <EditProfileDialog customer={customer} open={editOpen} onOpenChange={setEditOpen} />
+ </>
+ )
+}
+
+function EditProfileDialog({
+ customer,
+ open,
+ onOpenChange,
+}: {
+ customer: Customer
+ open: boolean
+ onOpenChange: (open: boolean) => void
+}) {
+ const [tags, setTags] = useState<string[]>(customer.tags ?? [])
+ const mutation = useCustomerMutation(customer.id, (params: Record<string, unknown>) =>
+ adminClient.customers.update(customer.id, params as Parameters<typeof adminClient.customers.update>[1]),
+ )
+
+ function handleSubmit(e: FormEvent<HTMLFormElement>) {
+ e.preventDefault()
+ const fd = new FormData(e.currentTarget)
+ const payload: Record<string, unknown> = {
+ email: fd.get('email'),
+ first_name: fd.get('first_name'),
+ last_name: fd.get('last_name'),
+ phone: fd.get('phone'),
+ accepts_email_marketing: fd.get('accepts_email_marketing') === 'on',
+ tags,
+ }
+ mutation.mutate(payload, { onSuccess: () => onOpenChange(false) })
+ }
+
+ return (
+ <Dialog open={open} onOpenChange={onOpenChange}>
+ <DialogContent>
+ <DialogHeader>
+ <DialogTitle>Edit Customer</DialogTitle>
+ <DialogDescription>Update the customer's profile information.</DialogDescription>
+ </DialogHeader>
+ <form onSubmit={handleSubmit}>
+ <DialogBody>
+ <FieldGroup>
+ <Field>
+ <FieldLabel htmlFor="email">Email</FieldLabel>
+ <Input id="email" name="email" type="email" defaultValue={customer.email} required />
+ </Field>
+ <Field>
+ <FieldLabel htmlFor="first_name">First name</FieldLabel>
+ <Input id="first_name" name="first_name" defaultValue={customer.first_name ?? ''} />
+ </Field>
+ <Field>
+ <FieldLabel htmlFor="last_name">Last name</FieldLabel>
+ <Input id="last_name" name="last_name" defaultValue={customer.last_name ?? ''} />
+ </Field>
+ <Field>
+ <FieldLabel htmlFor="phone">Phone</FieldLabel>
+ <Input id="phone" name="phone" defaultValue={customer.phone ?? ''} />
+ </Field>
+ <Field>
+ <FieldLabel>Tags</FieldLabel>
+ <TagCombobox taggableType="Spree::User" value={tags} onChange={setTags} />
+ </Field>
+ <Field>
+ <label className="flex items-center gap-2 text-sm">
+ <input type="checkbox" name="accepts_email_marketing" defaultChecked={customer.accepts_email_marketing} />
+ Subscribed to marketing
+ </label>
+ </Field>
+ </FieldGroup>
+ </DialogBody>
+ <DialogFooter>
+ <Button type="button" variant="outline" onClick={() => onOpenChange(false)}>Cancel</Button>
+ <Button type="submit" disabled={mutation.isPending}>
+ {mutation.isPending ? 'Saving…' : 'Save'}
+ </Button>
+ </DialogFooter>
+ </form>
+ </DialogContent>
+ </Dialog>
+ )
+}
+
+// ---------------------------------------------------------------------------
+// Lifetime Stats
+// ---------------------------------------------------------------------------
+
+function LifetimeStatsCard({ customer }: { customer: Customer }) {
+ const orders = customer.orders_count ?? 0
+ const totalSpent = Number(customer.total_spent ?? '0')
+ const aov = orders > 0 ? totalSpent / orders : 0
+ const aovDisplay = orders > 0 && totalSpent > 0
+ ? customer.display_total_spent?.replace(/[\d.,]+/, aov.toFixed(2))
+ : '—'
+
+ return (
+ <Card>
+ <CardContent className="grid grid-cols-2 lg:grid-cols-5 gap-6 py-6">
+ <Stat label="Total spent" value={customer.display_total_spent ?? '—'} />
+ <Stat label="Orders" value={String(orders)} />
+ <Stat label="Avg order value" value={aovDisplay ?? '—'} />
+ <Stat label="Store credit" value={customer.display_available_store_credit_total ?? '—'} />
+ <Stat label="Customer since" value={formatRelativeTime(customer.created_at)} />
+ </CardContent>
+ </Card>
+ )
+}
+
+function Stat({ label, value }: { label: string; value: string }) {
+ return (
+ <div className="flex flex-col gap-1">
+ <span className="text-sm text-muted-foreground">{label}</span>
+ <span className="text-lg font-semibold">{value}</span>
+ </div>
+ )
+}
+
+// ---------------------------------------------------------------------------
+// Last Order
+// ---------------------------------------------------------------------------
+
+function useCustomerOrders(customerId: string, params: { limit: number; status?: string }) {
+ const { isAuthenticated } = useAuth()
+ return useQuery({
+ queryKey: ['customer-orders', customerId, params],
+ queryFn: () =>
+ adminClient.orders.list({
+ q: { user_id_eq: customerId, ...(params.status ? { status_eq: params.status } : {}) },
+ per_page: params.limit,
+ sort: '-completed_at',
+ expand: ['items'],
+ }),
+ enabled: isAuthenticated,
+ })
+}
+
+function LastOrderCard({ order }: { order: Order }) {
+ return (
+ <Card>
+ <CardHeader>
+ <CardTitle>Last order placed</CardTitle>
+ </CardHeader>
+ <CardContent className="p-0">
+ <div className="border-t flex items-center justify-between px-6 py-3">
+ <div>
+ <Link
+ to={"/$storeId/orders/$orderId" as string}
+ params={{ orderId: order.id }}
+ className="font-medium text-zinc-950 no-underline"
+ >
+ #{order.number}
+ </Link>
+ <span className="ml-2 inline-flex gap-2">
+ {order.payment_status && <StatusBadge status={order.payment_status} />}
+ {order.fulfillment_status && <StatusBadge status={order.fulfillment_status} />}
+ </span>
+ {order.completed_at && (
+ <div className="text-xs text-muted-foreground mt-1">{formatRelativeTime(order.completed_at)}</div>
+ )}
+ </div>
+ <div className="font-semibold">{order.display_total}</div>
+ </div>
+ {order.items?.slice(0, 5).map((item) => (
+ <div key={item.id} className="border-t flex items-center gap-3 px-6 py-3 text-sm">
+ {item.thumbnail_url && (
+ <img src={item.thumbnail_url} alt="" className="size-10 rounded object-cover" />
+ )}
+ <div className="flex-1 min-w-0">
+ <div className="truncate">{item.name}</div>
+ {item.options_text && (
+ <div className="text-xs text-muted-foreground truncate">{item.options_text}</div>
+ )}
+ </div>
+ <div className="text-muted-foreground">×{item.quantity}</div>
+ <div className="font-medium tabular-nums">{item.display_total}</div>
+ </div>
+ ))}
+ </CardContent>
+ </Card>
+ )
+}
+
+// ---------------------------------------------------------------------------
+// Orders
+// ---------------------------------------------------------------------------
+
+function OrdersCard({
+ customer,
+ orders,
+ totalCount,
+ isLoading,
+}: {
+ customer: Customer
+ orders: Order[]
+ totalCount: number
+ isLoading: boolean
+}) {
+ if (isLoading) {
+ return (
+ <Card>
+ <CardHeader><CardTitle>Orders</CardTitle></CardHeader>
+ <CardContent><p className="text-sm text-muted-foreground">Loading orders…</p></CardContent>
+ </Card>
+ )
+ }
+
+ return (
+ <Card>
+ <CardHeader>
+ <CardTitle>
+ Orders
+ {totalCount > 0 && <Badge>{totalCount}</Badge>}
+ </CardTitle>
+ {totalCount > orders.length && (
+ <CardAction>
+ <Link
+ to={"/$storeId/orders" as string}
+ search={{ filters: [{ id: '1', field: 'user_id_eq', operator: 'eq', value: customer.id }] }}
+ className="text-sm text-primary hover:underline"
+ >
+ View all →
+ </Link>
+ </CardAction>
+ )}
+ </CardHeader>
+ {orders.length === 0 ? (
+ <CardContent>
+ <p className="text-sm text-muted-foreground">No orders yet</p>
+ </CardContent>
+ ) : (
+ <CardContent className="p-0">
+ <table className="w-full text-sm">
+ <thead>
+ <tr className="border-b text-muted-foreground text-left">
+ <th className="px-6 py-2 font-normal">Order</th>
+ <th className="px-6 py-2 font-normal">Date</th>
+ <th className="px-6 py-2 font-normal">Status</th>
+ <th className="px-6 py-2 font-normal text-right">Total</th>
+ </tr>
+ </thead>
+ <tbody>
+ {orders.map((order: Order) => (
+ <tr key={order.id} className="border-b last:border-b-0">
+ <td className="px-6 py-3">
+ <Link
+ to={"/$storeId/orders/$orderId" as string}
+ params={{ orderId: order.id }}
+ className="font-medium text-zinc-950 no-underline"
+ >
+ #{order.number}
+ </Link>
+ </td>
+ <td className="px-6 py-3 text-muted-foreground">
+ {formatRelativeTime(order.completed_at ?? order.created_at)}
+ </td>
+ <td className="px-6 py-3">
+ <span className="inline-flex gap-1">
+ <StatusBadge status={order.status} />
+ {order.payment_status && <StatusBadge status={order.payment_status} />}
+ {order.fulfillment_status && <StatusBadge status={order.fulfillment_status} />}
+ </span>
+ </td>
+ <td className="px-6 py-3 text-right font-medium tabular-nums">{order.display_total}</td>
+ </tr>
+ ))}
+ </tbody>
+ </table>
+ </CardContent>
+ )}
+ </Card>
+ )
+}
+
+// ---------------------------------------------------------------------------
+// Internal Note
+// ---------------------------------------------------------------------------
+
+function InternalNoteCard({ customer }: { customer: Customer }) {
+ const [editing, setEditing] = useState(false)
+ const [note, setNote] = useState(customer.internal_note_html ?? '')
+
+ const mutation = useCustomerMutation(customer.id, (params: { internal_note: string }) =>
+ adminClient.customers.update(customer.id, params),
+ )
+
+ return (
+ <Card>
+ <CardHeader>
+ <CardTitle>Internal Note</CardTitle>
+ {!editing && (
+ <CardAction>
+ <Button size="sm" variant="outline" onClick={() => setEditing(true)}>
+ <PencilIcon className="size-4" />
+ Edit
+ </Button>
+ </CardAction>
+ )}
+ </CardHeader>
+ <CardContent>
+ {editing ? (
+ <div className="flex flex-col gap-3">
+ <Textarea
+ rows={4}
+ value={note}
+ onChange={(e) => setNote(e.target.value)}
+ placeholder="Staff-only notes about this customer…"
+ />
+ <div className="flex gap-2 justify-end">
+ <Button type="button" variant="outline" size="sm" onClick={() => { setEditing(false); setNote(customer.internal_note_html ?? '') }}>
+ Cancel
+ </Button>
+ <Button
+ type="button"
+ size="sm"
+ disabled={mutation.isPending}
+ onClick={() => mutation.mutate({ internal_note: note }, { onSuccess: () => setEditing(false) })}
+ >
+ {mutation.isPending ? 'Saving…' : 'Save'}
+ </Button>
+ </div>
+ </div>
+ ) : customer.internal_note_html ? (
+ <div className="text-sm prose-sm" dangerouslySetInnerHTML={{ __html: customer.internal_note_html }} />
+ ) : (
+ <p className="text-sm text-muted-foreground">No internal notes</p>
+ )}
+ </CardContent>
+ </Card>
+ )
+}
+
+// ---------------------------------------------------------------------------
+// Addresses
+// ---------------------------------------------------------------------------
+
+function AddressesCard({ customer }: { customer: Customer }) {
+ const [addOpen, setAddOpen] = useState(false)
+ const [editing, setEditing] = useState<Address | null>(null)
+ const confirm = useConfirm()
+ const isDefault = (a: Address) => a.is_default_billing || a.is_default_shipping
+ const addresses = [...(customer.addresses ?? [])].sort((a, b) => Number(isDefault(b)) - Number(isDefault(a)))
+
+ const deleteMutation = useCustomerMutation(customer.id, (id: string) =>
+ adminClient.customers.addresses.delete(customer.id, id),
+ )
+
+ const setDefaultMutation = useCustomerMutation(
+ customer.id,
+ (params: { id: string; kind: 'billing' | 'shipping' }) =>
+ adminClient.customers.addresses.update(customer.id, params.id, {
+ [params.kind === 'billing' ? 'is_default_billing' : 'is_default_shipping']: true,
+ }),
+ )
+
+ return (
+ <>
+ <Card>
+ <CardHeader>
+ <CardTitle>
+ Addresses
+ {addresses.length > 0 && <Badge>{addresses.length}</Badge>}
+ </CardTitle>
+ <CardAction>
+ <Button size="sm" variant="outline" onClick={() => setAddOpen(true)}>
+ <PlusIcon className="size-4" />
+ Add Address
+ </Button>
+ </CardAction>
+ </CardHeader>
+ {addresses.length === 0 ? (
+ <CardContent>
+ <p className="text-sm text-muted-foreground">No saved addresses</p>
+ </CardContent>
+ ) : (
+ <CardContent className="flex flex-col gap-3">
+ {addresses.map((addr) => (
+ <div key={addr.id} className="flex items-start justify-between gap-2 rounded-md border p-3">
+ <div className="text-sm">
+ <div className="font-medium">
+ {[addr.first_name, addr.last_name].filter(Boolean).join(' ').trim() || addr.label || '—'}
+ <span className="ml-2 inline-flex gap-1">
+ {addr.is_default_billing && <Badge variant="info">Default billing</Badge>}
+ {addr.is_default_shipping && <Badge variant="info">Default shipping</Badge>}
+ </span>
+ </div>
+ <div className="text-muted-foreground">{addr.address1}</div>
+ {addr.address2 && <div className="text-muted-foreground">{addr.address2}</div>}
+ <div className="text-muted-foreground">
+ {[addr.city, addr.state_abbr, addr.postal_code].filter(Boolean).join(', ')} · {addr.country_iso}
+ </div>
+ {addr.phone && <div className="text-muted-foreground">{addr.phone}</div>}
+ </div>
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button variant="ghost" size="icon-xs">
+ <EllipsisVerticalIcon className="size-4" />
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <DropdownMenuItem onClick={() => setEditing(addr)}>
+ <PencilIcon className="size-4" />
+ Edit
+ </DropdownMenuItem>
+ {!addr.is_default_billing && (
+ <DropdownMenuItem onClick={() => setDefaultMutation.mutate({ id: addr.id, kind: 'billing' })}>
+ Set as default billing
+ </DropdownMenuItem>
+ )}
+ {!addr.is_default_shipping && (
+ <DropdownMenuItem onClick={() => setDefaultMutation.mutate({ id: addr.id, kind: 'shipping' })}>
+ Set as default shipping
+ </DropdownMenuItem>
+ )}
+ <DropdownMenuItem
+ className="text-destructive focus:text-destructive"
+ onClick={async () => {
+ if (await confirm({ message: 'Delete this address?', variant: 'destructive', confirmLabel: 'Delete' })) {
+ deleteMutation.mutate(addr.id)
+ }
+ }}
+ >
+ <TrashIcon className="size-4" />
+ Delete
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </div>
+ ))}
+ </CardContent>
+ )}
+ </Card>
+
+ <AddressDialog
+ customerId={customer.id}
+ address={null}
+ open={addOpen}
+ onOpenChange={setAddOpen}
+ />
+ <AddressDialog
+ customerId={customer.id}
+ address={editing}
+ open={editing !== null}
+ onOpenChange={(o) => { if (!o) setEditing(null) }}
+ />
+ </>
+ )
+}
+
+function AddressDialog({
+ customerId,
+ address,
+ open,
+ onOpenChange,
+}: {
+ customerId: string
+ address: Address | null
+ open: boolean
+ onOpenChange: (open: boolean) => void
+}) {
+ const isEdit = address !== null
+ const mutation = useCustomerMutation(customerId, (params: Record<string, unknown>) =>
+ isEdit
+ ? adminClient.customers.addresses.update(customerId, address!.id, params as Parameters<typeof adminClient.customers.addresses.update>[2])
+ : adminClient.customers.addresses.create(customerId, params as Parameters<typeof adminClient.customers.addresses.create>[1]),
+ )
+
+ function handleSubmit(e: FormEvent<HTMLFormElement>) {
+ e.preventDefault()
+ const fd = new FormData(e.currentTarget)
+ const payload: Record<string, unknown> = {
+ first_name: fd.get('first_name'),
+ last_name: fd.get('last_name'),
+ address1: fd.get('address1'),
+ address2: fd.get('address2'),
+ city: fd.get('city'),
+ postal_code: fd.get('postal_code'),
+ country_iso: fd.get('country_iso'),
+ state_abbr: fd.get('state_abbr'),
+ phone: fd.get('phone'),
+ label: fd.get('label'),
+ is_default_billing: fd.get('is_default_billing') === 'on',
+ is_default_shipping: fd.get('is_default_shipping') === 'on',
+ }
+ mutation.mutate(payload, { onSuccess: () => onOpenChange(false) })
+ }
+
+ return (
+ <Dialog open={open} onOpenChange={onOpenChange}>
+ <DialogContent>
+ <DialogHeader>
+ <DialogTitle>{isEdit ? 'Edit Address' : 'Add Address'}</DialogTitle>
+ </DialogHeader>
+ <form onSubmit={handleSubmit}>
+ <DialogBody>
+ <FieldGroup>
+ <Field>
+ <FieldLabel htmlFor="addr-label">Label</FieldLabel>
+ <Input id="addr-label" name="label" placeholder="e.g. Home, Office" defaultValue={address?.label ?? ''} />
+ </Field>
+ <div className="grid grid-cols-2 gap-3">
+ <Field>
+ <FieldLabel htmlFor="addr-first">First name</FieldLabel>
+ <Input id="addr-first" name="first_name" defaultValue={address?.first_name ?? ''} />
+ </Field>
+ <Field>
+ <FieldLabel htmlFor="addr-last">Last name</FieldLabel>
+ <Input id="addr-last" name="last_name" defaultValue={address?.last_name ?? ''} />
+ </Field>
+ </div>
+ <Field>
+ <FieldLabel htmlFor="addr-1">Address line 1</FieldLabel>
+ <Input id="addr-1" name="address1" defaultValue={address?.address1 ?? ''} required />
+ </Field>
+ <Field>
+ <FieldLabel htmlFor="addr-2">Address line 2</FieldLabel>
+ <Input id="addr-2" name="address2" defaultValue={address?.address2 ?? ''} />
+ </Field>
+ <div className="grid grid-cols-2 gap-3">
+ <Field>
+ <FieldLabel htmlFor="addr-city">City</FieldLabel>
+ <Input id="addr-city" name="city" defaultValue={address?.city ?? ''} required />
+ </Field>
+ <Field>
+ <FieldLabel htmlFor="addr-zip">Postal code</FieldLabel>
+ <Input id="addr-zip" name="postal_code" defaultValue={address?.postal_code ?? ''} required />
+ </Field>
+ </div>
+ <div className="grid grid-cols-2 gap-3">
+ <Field>
+ <FieldLabel htmlFor="addr-country">Country (ISO)</FieldLabel>
+ <Input id="addr-country" name="country_iso" defaultValue={address?.country_iso ?? ''} placeholder="US" required />
+ </Field>
+ <Field>
+ <FieldLabel htmlFor="addr-state">State / Province</FieldLabel>
+ <Input id="addr-state" name="state_abbr" defaultValue={address?.state_abbr ?? ''} placeholder="NY" />
+ </Field>
+ </div>
+ <Field>
+ <FieldLabel htmlFor="addr-phone">Phone</FieldLabel>
+ <Input id="addr-phone" name="phone" defaultValue={address?.phone ?? ''} />
+ </Field>
+ <Field>
+ <label className="flex items-center gap-2 text-sm">
+ <input type="checkbox" name="is_default_billing" defaultChecked={address?.is_default_billing} />
+ Default billing address
+ </label>
+ </Field>
+ <Field>
+ <label className="flex items-center gap-2 text-sm">
+ <input type="checkbox" name="is_default_shipping" defaultChecked={address?.is_default_shipping} />
+ Default shipping address
+ </label>
+ </Field>
+ </FieldGroup>
+ </DialogBody>
+ <DialogFooter>
+ <Button type="button" variant="outline" onClick={() => onOpenChange(false)}>Cancel</Button>
+ <Button type="submit" disabled={mutation.isPending}>
+ {mutation.isPending ? 'Saving…' : isEdit ? 'Save' : 'Add Address'}
+ </Button>
+ </DialogFooter>
+ </form>
+ </DialogContent>
+ </Dialog>
+ )
+}
+
+// ---------------------------------------------------------------------------
+// Store Credits
+// ---------------------------------------------------------------------------
+
+function StoreCreditsCard({ customer }: { customer: Customer }) {
+ const [addOpen, setAddOpen] = useState(false)
+ const confirm = useConfirm()
+ const credits = customer.store_credits ?? []
+
+ const deleteMutation = useCustomerMutation(customer.id, (id: string) =>
+ adminClient.customers.storeCredits.delete(customer.id, id),
+ )
+
+ return (
+ <>
+ <Card>
+ <CardHeader>
+ <CardTitle>
+ Store Credits
+ {credits.length > 0 && <Badge>{credits.length}</Badge>}
+ </CardTitle>
+ <CardAction>
+ <Button size="sm" variant="outline" onClick={() => setAddOpen(true)}>
+ <PlusIcon className="size-4" />
+ Issue Credit
+ </Button>
+ </CardAction>
+ </CardHeader>
+ {credits.length === 0 ? (
+ <CardContent>
+ <p className="text-sm text-muted-foreground">No store credits issued</p>
+ </CardContent>
+ ) : (
+ <CardContent>
+ <table className="w-full text-sm">
+ <thead>
+ <tr className="border-b text-muted-foreground text-left">
+ <th className="py-2 font-normal">Amount</th>
+ <th className="py-2 font-normal">Used</th>
+ <th className="py-2 font-normal">Remaining</th>
+ <th className="py-2 font-normal">Memo</th>
+ <th className="py-2 w-10" />
+ </tr>
+ </thead>
+ <tbody>
+ {credits.map((sc: StoreCredit & { memo?: string | null }) => (
+ <tr key={sc.id} className="border-b last:border-b-0">
+ <td className="py-2">{sc.display_amount ?? sc.amount}</td>
+ <td className="py-2">{sc.display_amount_used ?? sc.amount_used}</td>
+ <td className="py-2">{sc.display_amount_remaining ?? sc.amount_remaining}</td>
+ <td className="py-2 text-muted-foreground">{sc.memo ?? '—'}</td>
+ <td className="py-2 text-right">
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button variant="ghost" size="icon-xs">
+ <EllipsisVerticalIcon className="size-4" />
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <DropdownMenuItem
+ className="text-destructive focus:text-destructive"
+ onClick={async () => {
+ if (await confirm({ message: 'Delete this store credit?', variant: 'destructive', confirmLabel: 'Delete' })) {
+ deleteMutation.mutate(sc.id)
+ }
+ }}
+ >
+ <TrashIcon className="size-4" />
+ Delete
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </td>
+ </tr>
+ ))}
+ </tbody>
+ </table>
+ </CardContent>
+ )}
+ </Card>
+
+ <IssueStoreCreditDialog customerId={customer.id} open={addOpen} onOpenChange={setAddOpen} />
+ </>
+ )
+}
+
+function IssueStoreCreditDialog({
+ customerId,
+ open,
+ onOpenChange,
+}: {
+ customerId: string
+ open: boolean
+ onOpenChange: (open: boolean) => void
+}) {
+ const mutation = useCustomerMutation(customerId, (params: Parameters<typeof adminClient.customers.storeCredits.create>[1]) =>
+ adminClient.customers.storeCredits.create(customerId, params),
+ )
+
+ function handleSubmit(e: FormEvent<HTMLFormElement>) {
+ e.preventDefault()
+ const fd = new FormData(e.currentTarget)
+ mutation.mutate({
+ amount: Number(fd.get('amount')),
+ currency: String(fd.get('currency') ?? ''),
+ category_id: String(fd.get('category_id') ?? ''),
+ memo: (fd.get('memo') as string) || undefined,
+ }, { onSuccess: () => onOpenChange(false) })
+ }
+
+ return (
+ <Dialog open={open} onOpenChange={onOpenChange}>
+ <DialogContent>
+ <DialogHeader>
+ <DialogTitle>Issue Store Credit</DialogTitle>
+ <DialogDescription>Add store credit to this customer's account.</DialogDescription>
+ </DialogHeader>
+ <form onSubmit={handleSubmit}>
+ <DialogBody>
+ <FieldGroup>
+ <div className="grid grid-cols-2 gap-3">
+ <Field>
+ <FieldLabel htmlFor="sc-amount">Amount</FieldLabel>
+ <Input id="sc-amount" name="amount" type="number" step="0.01" required />
+ </Field>
+ <Field>
+ <FieldLabel htmlFor="sc-currency">Currency</FieldLabel>
+ <Input id="sc-currency" name="currency" defaultValue="USD" required />
+ </Field>
+ </div>
+ <Field>
+ <FieldLabel htmlFor="sc-category">Category ID</FieldLabel>
+ <Input id="sc-category" name="category_id" placeholder="e.g. 1" required />
+ </Field>
+ <Field>
+ <FieldLabel htmlFor="sc-memo">Memo</FieldLabel>
+ <Textarea id="sc-memo" name="memo" rows={3} placeholder="Reason for issuing this credit" />
+ </Field>
+ </FieldGroup>
+ </DialogBody>
+ <DialogFooter>
+ <Button type="button" variant="outline" onClick={() => onOpenChange(false)}>Cancel</Button>
+ <Button type="submit" disabled={mutation.isPending}>
+ {mutation.isPending ? 'Issuing…' : 'Issue Credit'}
+ </Button>
+ </DialogFooter>
+ </form>
+ </DialogContent>
+ </Dialog>
+ )
+}
diff --git a/packages/admin/src/routes/_authenticated/$storeId/customers/index.tsx b/packages/admin/src/routes/_authenticated/$storeId/customers/index.tsx
new file mode 100644
index 0000000000..276784ce3a
--- /dev/null
+++ b/packages/admin/src/routes/_authenticated/$storeId/customers/index.tsx
@@ -0,0 +1,22 @@
+import { createFileRoute } from '@tanstack/react-router'
+import { adminClient } from '@/client'
+import { ResourceTable, resourceSearchSchema } from '@/components/resource-table'
+import '@/tables/customers'
+
+export const Route = createFileRoute('/_authenticated/$storeId/customers/')({
+ validateSearch: resourceSearchSchema,
+ component: CustomersPage,
+})
+
+function CustomersPage() {
+ const searchParams = Route.useSearch()
+
+ return (
+ <ResourceTable
+ tableKey="customers"
+ queryKey="customers"
+ queryFn={(params) => adminClient.customers.list(params)}
+ searchParams={searchParams}
+ />
+ )
+}
diff --git a/packages/admin/src/routes/_authenticated/$storeId/orders/$orderId.tsx b/packages/admin/src/routes/_authenticated/$storeId/orders/$orderId.tsx
index 5788127e8e..0f2a976eb0 100644
--- a/packages/admin/src/routes/_authenticated/$storeId/orders/$orderId.tsx
+++ b/packages/admin/src/routes/_authenticated/$storeId/orders/$orderId.tsx
@@ -5,6 +5,7 @@ import { AddressBlock } from '@/components/address-block'
import { AddressFormDialog, type AddressParams } from '@/components/address-form-dialog'
import { BackButton } from '@/components/back-button'
import {
+ CheckCircleIcon,
CreditCardIcon,
EllipsisVerticalIcon,
ExternalLinkIcon,
@@ -13,13 +14,16 @@ import {
PackageIcon,
PencilIcon,
PlusIcon,
+ RotateCcwIcon,
+ ShieldCheckIcon,
ShoppingCartIcon,
TrashIcon,
TruckIcon,
XCircleIcon,
} from 'lucide-react'
-import { type FormEvent, useState } from 'react'
+import { type FormEvent, useEffect, useState } from 'react'
import { useConfirm } from '@/components/confirm-dialog'
+import { TagCombobox } from '@/components/tag-combobox'
import { adminClient } from '@/client'
import { formatRelativeTime } from '@/lib/formatters'
import { Badge, StatusBadge } from '@/components/ui/badge'
@@ -51,7 +55,9 @@ import {
} from '@/components/ui/sheet'
import { Field, FieldGroup, FieldLabel } from '@/components/ui/field'
import { Input } from '@/components/ui/input'
+import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'
import { Separator } from '@/components/ui/separator'
+import { Switch } from '@/components/ui/switch'
import { Skeleton } from '@/components/ui/skeleton'
import { Textarea } from '@/components/ui/textarea'
import { useAuth } from '@/hooks/use-auth'
@@ -81,6 +87,10 @@ function useOrder(orderId: string) {
'billing_address',
'shipping_address',
'customer',
+ 'created_by',
+ 'canceler',
+ 'approver',
+ 'market',
],
}),
enabled: isAuthenticated,
@@ -142,6 +152,8 @@ function OrderDetailPage() {
{/* Sidebar */}
<div className="col-span-12 lg:col-span-4 flex flex-col gap-6">
<CustomerCard order={order} />
+ <TagsCard order={order} />
+ <DiscountsCard order={order} />
<SpecialInstructionsCard order={order} />
<InternalNoteCard order={order} />
</div>
@@ -163,6 +175,15 @@ function OrderHeader({ order }: { order: Order }) {
const cancelMutation = useOrderMutation(orderId, () =>
adminClient.orders.cancel(orderId),
)
+ const completeMutation = useOrderMutation(orderId, () =>
+ adminClient.orders.complete(orderId),
+ )
+ const approveMutation = useOrderMutation(orderId, () =>
+ adminClient.orders.approve(orderId),
+ )
+ const resumeMutation = useOrderMutation(orderId, () =>
+ adminClient.orders.resume(orderId),
+ )
const resendMutation = useOrderMutation(orderId, () =>
adminClient.orders.resendConfirmation(orderId, {}),
)
@@ -190,6 +211,45 @@ function OrderHeader({ order }: { order: Order }) {
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
+ {order.status === 'draft' && (
+ <DropdownMenuItem
+ onClick={async () => {
+ if (await confirm({ message: 'Complete this draft order now?', confirmLabel: 'Complete' })) {
+ completeMutation.mutate(undefined)
+ }
+ }}
+ disabled={completeMutation.isPending}
+ >
+ <CheckCircleIcon className="size-4" />
+ Complete Order
+ </DropdownMenuItem>
+ )}
+ {order.considered_risky && !order.approved_at && (
+ <DropdownMenuItem
+ onClick={async () => {
+ if (await confirm({ message: 'Approve this order?', confirmLabel: 'Approve' })) {
+ approveMutation.mutate(undefined)
+ }
+ }}
+ disabled={approveMutation.isPending}
+ >
+ <ShieldCheckIcon className="size-4" />
+ Approve Order
+ </DropdownMenuItem>
+ )}
+ {order.status === 'canceled' && (
+ <DropdownMenuItem
+ onClick={async () => {
+ if (await confirm({ message: 'Resume this canceled order?', confirmLabel: 'Resume' })) {
+ resumeMutation.mutate(undefined)
+ }
+ }}
+ disabled={resumeMutation.isPending}
+ >
+ <RotateCcwIcon className="size-4" />
+ Resume Order
+ </DropdownMenuItem>
+ )}
{order.completed_at && (
<>
<DropdownMenuItem>
@@ -778,6 +838,7 @@ function ShipmentsCard({ order }: { order: Order }) {
function PaymentsCard({ order }: { order: Order }) {
const { orderId } = Route.useParams()
const confirm = useConfirm()
+ const [addOpen, setAddOpen] = useState(false)
const payments = order.payments ?? []
@@ -788,20 +849,27 @@ function PaymentsCard({ order }: { order: Order }) {
adminClient.orders.payments.void(orderId, paymentId, {}),
)
- if (payments.length === 0) return null
-
return (
<Card>
<CardHeader>
<CardTitle>
<CreditCardIcon className="size-4" />
Payments
- <Badge>{payments.length}</Badge>
+ {payments.length > 0 && <Badge>{payments.length}</Badge>}
</CardTitle>
<CardAction className="flex items-center gap-2">
{order.payment_status && <StatusBadge status={order.payment_status} />}
+ <Button size="sm" variant="outline" onClick={() => setAddOpen(true)}>
+ <PlusIcon data-icon="inline-start" />
+ Add Payment
+ </Button>
</CardAction>
</CardHeader>
+ {payments.length === 0 ? (
+ <CardContent>
+ <p className="text-center text-muted-foreground py-8">No payments yet</p>
+ </CardContent>
+ ) : (
<div className="overflow-x-auto">
<table className="w-full text-sm">
<thead>
@@ -871,10 +939,192 @@ function PaymentsCard({ order }: { order: Order }) {
</tbody>
</table>
</div>
+ )}
+ <AddPaymentDialog order={order} open={addOpen} onOpenChange={setAddOpen} />
</Card>
)
}
+function AddPaymentDialog({
+ order,
+ open,
+ onOpenChange,
+}: {
+ order: Order
+ open: boolean
+ onOpenChange: (open: boolean) => void
+}) {
+ const orderId = order.id
+ const customerId = order.customer_id ?? undefined
+ const [paymentMethodId, setPaymentMethodId] = useState<string>('')
+ const [sourceId, setSourceId] = useState<string>('')
+ const [amount, setAmount] = useState<string>(order.amount_due ?? '')
+ const [capture, setCapture] = useState(false)
+
+ // Re-seed amount from outstanding balance whenever the dialog opens.
+ useEffect(() => {
+ if (open) setAmount(order.amount_due ?? '')
+ }, [open, order.amount_due])
+
+ const { data: methodsData } = useQuery({
+ queryKey: ['payment-methods'],
+ queryFn: () => adminClient.paymentMethods.list({ limit: 50 }),
+ enabled: open,
+ staleTime: 60_000,
+ })
+ const paymentMethods = methodsData?.data ?? []
+ const selectedMethod = paymentMethods.find((m) => m.id === paymentMethodId)
+ const sourceRequired = selectedMethod?.source_required ?? false
+
+ const { data: cardsData } = useQuery({
+ queryKey: ['customer-credit-cards', customerId],
+ queryFn: () => customerId ? adminClient.customers.creditCards.list(customerId, { limit: 50 }) : Promise.resolve(null),
+ enabled: open && Boolean(customerId) && sourceRequired,
+ staleTime: 30_000,
+ })
+ const savedCards = cardsData?.data ?? []
+ const canSubmit = Boolean(paymentMethodId) && (!sourceRequired || Boolean(sourceId))
+
+ const mutation = useOrderMutation(orderId, () =>
+ adminClient.orders.payments.create(orderId, {
+ payment_method_id: paymentMethodId,
+ ...(sourceId ? { source_id: sourceId } : {}),
+ ...(amount ? { amount: Number(amount) } : {}),
+ }),
+ )
+
+ const captureMutation = useOrderMutation(orderId, (paymentId: string) =>
+ adminClient.orders.payments.capture(orderId, paymentId, {}),
+ )
+
+ function reset() {
+ setPaymentMethodId('')
+ setSourceId('')
+ setAmount('')
+ setCapture(false)
+ }
+
+ function handleSubmit(e: FormEvent<HTMLFormElement>) {
+ e.preventDefault()
+ if (!canSubmit) return
+
+ mutation.mutate(undefined, {
+ onSuccess: (payment) => {
+ if (capture && payment && (payment as { id?: string }).id) {
+ captureMutation.mutate((payment as { id: string }).id, {
+ onSuccess: () => {
+ onOpenChange(false)
+ reset()
+ },
+ })
+ } else {
+ onOpenChange(false)
+ reset()
+ }
+ },
+ })
+ }
+
+ return (
+ <Dialog open={open} onOpenChange={onOpenChange}>
+ <DialogContent>
+ <DialogHeader>
+ <DialogTitle>Add Payment</DialogTitle>
+ <DialogDescription>
+ Charge a payment method against this order.
+ </DialogDescription>
+ </DialogHeader>
+ <form onSubmit={handleSubmit}>
+ <DialogBody>
+ <FieldGroup>
+ <Field>
+ <FieldLabel htmlFor="pay-method">Payment method</FieldLabel>
+ <Select value={paymentMethodId} onValueChange={(v) => { setPaymentMethodId(v); setSourceId('') }}>
+ <SelectTrigger id="pay-method">
+ <SelectValue placeholder="Choose a payment method...">
+ {(value) => paymentMethods.find((m) => m.id === value)?.name ?? 'Choose a payment method...'}
+ </SelectValue>
+ </SelectTrigger>
+ <SelectContent>
+ {paymentMethods.map((m) => (
+ <SelectItem key={m.id} value={m.id}>
+ {m.name}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </Field>
+
+ {sourceRequired && (
+ <Field>
+ <FieldLabel htmlFor="pay-source">Source</FieldLabel>
+ {!customerId ? (
+ <p className="text-sm text-destructive">
+ This payment method requires a saved source. Assign a customer to the order first.
+ </p>
+ ) : savedCards.length === 0 ? (
+ <p className="text-sm text-muted-foreground">
+ Customer has no saved cards for this payment method.
+ </p>
+ ) : (
+ <Select value={sourceId} onValueChange={setSourceId}>
+ <SelectTrigger id="pay-source">
+ <SelectValue placeholder="Choose a saved card…">
+ {(value) => {
+ const card = savedCards.find((c) => c.id === value)
+ return card ? `${card.brand} •••• ${card.last4} (${card.month}/${card.year})` : 'Choose a saved card…'
+ }}
+ </SelectValue>
+ </SelectTrigger>
+ <SelectContent>
+ {savedCards.map((c) => (
+ <SelectItem key={c.id} value={c.id}>
+ {c.brand} •••• {c.last4} ({c.month}/{c.year})
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ )}
+ </Field>
+ )}
+
+ <Field>
+ <FieldLabel htmlFor="pay-amount">Amount</FieldLabel>
+ <Input
+ id="pay-amount"
+ type="number"
+ step="0.01"
+ placeholder={order.amount_due ?? '0.00'}
+ value={amount}
+ onChange={(e) => setAmount(e.target.value)}
+ />
+ <p className="text-xs text-muted-foreground mt-1">
+ Leave blank to default to the outstanding balance ({order.display_amount_due ?? '$0.00'}).
+ </p>
+ </Field>
+
+ <Field>
+ <label className="flex items-center gap-2 text-sm">
+ <Switch checked={capture} onCheckedChange={setCapture} />
+ Capture immediately
+ </label>
+ </Field>
+ </FieldGroup>
+ </DialogBody>
+ <DialogFooter>
+ <Button type="button" variant="outline" onClick={() => onOpenChange(false)}>
+ Cancel
+ </Button>
+ <Button type="submit" disabled={!canSubmit || mutation.isPending || captureMutation.isPending}>
+ {mutation.isPending || captureMutation.isPending ? 'Processing…' : 'Add Payment'}
+ </Button>
+ </DialogFooter>
+ </form>
+ </DialogContent>
+ </Dialog>
+ )
+}
+
// ---------------------------------------------------------------------------
// Order Summary
// ---------------------------------------------------------------------------
@@ -904,8 +1154,14 @@ function SummaryRow({
)
}
+function customerDisplayName(customer?: { first_name: string | null; last_name: string | null; email: string } | null): string {
+ if (!customer) return '—'
+ const name = [customer.first_name, customer.last_name].filter(Boolean).join(' ').trim()
+ return name || customer.email
+}
+
function OrderSummaryCard({ order }: { order: Order }) {
- const outstandingBalance = Number.parseFloat(order.total) - Number.parseFloat(order.payment_total)
+ const outstandingBalance = Number.parseFloat(order.amount_due ?? '0')
return (
<Card>
@@ -913,16 +1169,33 @@ function OrderSummaryCard({ order }: { order: Order }) {
<CardTitle>Summary</CardTitle>
</CardHeader>
<div className="py-1">
+ {order.created_by && (
+ <SummaryRow label="Created by" value={customerDisplayName(order.created_by)} />
+ )}
+ <SummaryRow label="Created at" value={formatDate(order.created_at)} />
+
{order.completed_at && (
+ <SummaryRow label="Completed at" value={formatDate(order.completed_at)} />
+ )}
+
+ {order.canceled_at && (
<>
- <SummaryRow label="Completed" value={formatDate(order.completed_at)} />
- {order.canceled_at && (
- <SummaryRow label="Canceled" value={formatDate(order.canceled_at)} />
+ <SummaryRow label="Canceled at" value={formatDate(order.canceled_at)} />
+ {order.canceler && (
+ <SummaryRow label="Canceler" value={customerDisplayName(order.canceler)} />
)}
- <Separator />
</>
)}
+ {order.approved_at && order.approver && (
+ <SummaryRow label="Approved by" value={customerDisplayName(order.approver)} />
+ )}
+
+ <Separator />
+
+ {order.market && (
+ <SummaryRow label="Market" value={order.market.name ?? order.market_id ?? '—'} />
+ )}
<SummaryRow label="Locale" value={order.locale ?? '—'} />
<SummaryRow label="Currency" value={order.currency} />
@@ -959,7 +1232,7 @@ function OrderSummaryCard({ order }: { order: Order }) {
<SummaryRow label="Payment total" value={order.display_payment_total} highlight />
<SummaryRow
label="Outstanding balance"
- value={`${order.currency} ${Math.abs(outstandingBalance).toFixed(2)}`}
+ value={order.display_amount_due}
highlight
danger={outstandingBalance > 0}
/>
@@ -968,6 +1241,168 @@ function OrderSummaryCard({ order }: { order: Order }) {
)
}
+// ---------------------------------------------------------------------------
+// Discounts: Gift Card + Store Credit
+// ---------------------------------------------------------------------------
+
+function DiscountsCard({ order }: { order: Order }) {
+ const { orderId } = Route.useParams()
+ const confirm = useConfirm()
+ const [giftCardOpen, setGiftCardOpen] = useState(false)
+
+ const removeGiftCardMutation = useOrderMutation(orderId, () =>
+ adminClient.orders.giftCards.remove(orderId, order.gift_card?.id ?? ''),
+ )
+ const applyStoreCreditMutation = useOrderMutation(orderId, () =>
+ adminClient.orders.storeCredits.apply(orderId),
+ )
+ const removeStoreCreditMutation = useOrderMutation(orderId, () =>
+ adminClient.orders.storeCredits.remove(orderId),
+ )
+
+ const hasStoreCredit = Number.parseFloat(order.store_credit_total ?? '0') > 0
+ const hasCustomer = Boolean(order.customer_id)
+
+ return (
+ <>
+ <Card>
+ <CardHeader>
+ <CardTitle>Gift Card &amp; Store Credit</CardTitle>
+ </CardHeader>
+ <CardContent className="flex flex-col gap-3">
+ {/* Gift card */}
+ <div className="flex items-center justify-between gap-2">
+ <div className="flex flex-col">
+ <span className="text-sm font-medium">Gift card</span>
+ {order.gift_card ? (
+ <span className="text-xs text-muted-foreground">
+ {order.gift_card.code} · {order.display_gift_card_total}
+ </span>
+ ) : (
+ <span className="text-xs text-muted-foreground">None applied</span>
+ )}
+ </div>
+ {order.gift_card ? (
+ <Button
+ size="sm"
+ variant="outline"
+ onClick={async () => {
+ if (await confirm({ message: 'Remove this gift card from the order?', confirmLabel: 'Remove' })) {
+ removeGiftCardMutation.mutate(undefined)
+ }
+ }}
+ disabled={removeGiftCardMutation.isPending}
+ >
+ Remove
+ </Button>
+ ) : (
+ <Button size="sm" variant="outline" onClick={() => setGiftCardOpen(true)}>
+ <PlusIcon className="size-4" />
+ Apply
+ </Button>
+ )}
+ </div>
+
+ <Separator />
+
+ {/* Store credit */}
+ <div className="flex items-center justify-between gap-2">
+ <div className="flex flex-col">
+ <span className="text-sm font-medium">Store credit</span>
+ {hasStoreCredit ? (
+ <span className="text-xs text-muted-foreground">
+ {order.display_store_credit_total} applied
+ </span>
+ ) : (
+ <span className="text-xs text-muted-foreground">
+ {hasCustomer ? "Apply customer's available balance" : 'Requires a customer'}
+ </span>
+ )}
+ </div>
+ {hasStoreCredit ? (
+ <Button
+ size="sm"
+ variant="outline"
+ onClick={async () => {
+ if (await confirm({ message: 'Remove store credit from the order?', confirmLabel: 'Remove' })) {
+ removeStoreCreditMutation.mutate(undefined)
+ }
+ }}
+ disabled={removeStoreCreditMutation.isPending}
+ >
+ Remove
+ </Button>
+ ) : (
+ <Button
+ size="sm"
+ variant="outline"
+ disabled={!hasCustomer || applyStoreCreditMutation.isPending}
+ onClick={() => applyStoreCreditMutation.mutate(undefined)}
+ >
+ <PlusIcon className="size-4" />
+ Apply
+ </Button>
+ )}
+ </div>
+ </CardContent>
+ </Card>
+
+ <ApplyGiftCardDialog orderId={orderId} open={giftCardOpen} onOpenChange={setGiftCardOpen} />
+ </>
+ )
+}
+
+function ApplyGiftCardDialog({
+ orderId,
+ open,
+ onOpenChange,
+}: {
+ orderId: string
+ open: boolean
+ onOpenChange: (open: boolean) => void
+}) {
+ const mutation = useOrderMutation(orderId, (params: { code: string }) =>
+ adminClient.orders.giftCards.apply(orderId, params),
+ )
+
+ function handleSubmit(e: FormEvent<HTMLFormElement>) {
+ e.preventDefault()
+ const fd = new FormData(e.currentTarget)
+ const code = (fd.get('code') as string).trim()
+ if (!code) return
+ mutation.mutate({ code }, { onSuccess: () => onOpenChange(false) })
+ }
+
+ return (
+ <Dialog open={open} onOpenChange={onOpenChange}>
+ <DialogContent>
+ <DialogHeader>
+ <DialogTitle>Apply Gift Card</DialogTitle>
+ <DialogDescription>Enter the gift card code to apply it to this order.</DialogDescription>
+ </DialogHeader>
+ <form onSubmit={handleSubmit}>
+ <DialogBody>
+ <FieldGroup>
+ <Field>
+ <FieldLabel htmlFor="gift-card-code">Code</FieldLabel>
+ <Input id="gift-card-code" name="code" placeholder="GIFT-XXXX-YYYY" required autoFocus />
+ </Field>
+ </FieldGroup>
+ </DialogBody>
+ <DialogFooter>
+ <Button type="button" variant="outline" onClick={() => onOpenChange(false)}>
+ Cancel
+ </Button>
+ <Button type="submit" disabled={mutation.isPending}>
+ {mutation.isPending ? 'Applying…' : 'Apply'}
+ </Button>
+ </DialogFooter>
+ </form>
+ </DialogContent>
+ </Dialog>
+ )
+}
+
// ---------------------------------------------------------------------------
// Customer Sidebar
// ---------------------------------------------------------------------------
@@ -1113,6 +1548,62 @@ function SpecialInstructionsCard({ order }: { order: Order }) {
)
}
+// ---------------------------------------------------------------------------
+// Tags
+// ---------------------------------------------------------------------------
+
+function TagsCard({ order }: { order: Order }) {
+ const { orderId } = Route.useParams()
+ const [editing, setEditing] = useState(false)
+ const [tags, setTags] = useState<string[]>(order.tags ?? [])
+
+ const mutation = useOrderMutation(orderId, (params: { tags: string[] }) =>
+ adminClient.orders.update(orderId, params),
+ )
+
+ return (
+ <Card>
+ <CardHeader>
+ <CardTitle>Tags</CardTitle>
+ <CardAction>
+ <Button variant="ghost" size="icon-xs" onClick={() => {
+ setTags(order.tags ?? [])
+ setEditing(!editing)
+ }}>
+ <PencilIcon className="size-4" />
+ </Button>
+ </CardAction>
+ </CardHeader>
+ <CardContent>
+ {editing ? (
+ <div className="flex flex-col gap-3">
+ <TagCombobox taggableType="Spree::Order" value={tags} onChange={setTags} />
+ <div className="flex justify-end gap-2">
+ <Button type="button" variant="outline" size="sm" onClick={() => setEditing(false)}>
+ Cancel
+ </Button>
+ <Button
+ type="button"
+ size="sm"
+ disabled={mutation.isPending}
+ onClick={() => mutation.mutate({ tags }, { onSuccess: () => setEditing(false) })}
+ >
+ {mutation.isPending ? 'Saving…' : 'Save'}
+ </Button>
+ </div>
+ </div>
+ ) : order.tags?.length ? (
+ <div className="flex flex-wrap gap-1">
+ {order.tags.map((tag) => <Badge key={tag}>{tag}</Badge>)}
+ </div>
+ ) : (
+ <p className="text-sm text-muted-foreground">None</p>
+ )}
+ </CardContent>
+ </Card>
+ )
+}
+
// ---------------------------------------------------------------------------
// Internal Note
// ---------------------------------------------------------------------------
diff --git a/packages/admin/src/routes/_authenticated/$storeId/orders/index.tsx b/packages/admin/src/routes/_authenticated/$storeId/orders/index.tsx
index 1bfa274377..c34366860b 100644
--- a/packages/admin/src/routes/_authenticated/$storeId/orders/index.tsx
+++ b/packages/admin/src/routes/_authenticated/$storeId/orders/index.tsx
@@ -1,4 +1,4 @@
-import { createFileRoute } from '@tanstack/react-router'
+import { createFileRoute, Link } from '@tanstack/react-router'
import { PlusIcon } from 'lucide-react'
import { adminClient } from '@/client'
import { ResourceTable, resourceSearchSchema } from '@/components/resource-table'
@@ -12,6 +12,7 @@ export const Route = createFileRoute('/_authenticated/$storeId/orders/')({
function OrdersPage() {
const searchParams = Route.useSearch()
+ const { storeId } = Route.useParams()
return (
<ResourceTable
@@ -21,9 +22,11 @@ function OrdersPage() {
searchParams={searchParams}
defaultParams={{ complete: 1 }}
actions={
- <Button size="sm" className="h-[2.125rem]">
- <PlusIcon className="size-4" />
- New Order
+ <Button size="sm" className="h-[2.125rem]" asChild>
+ <Link to="/$storeId/orders/new" params={{ storeId }}>
+ <PlusIcon className="size-4" />
+ New Order
+ </Link>
</Button>
}
/>
diff --git a/packages/admin/src/routes/_authenticated/$storeId/orders/new.tsx b/packages/admin/src/routes/_authenticated/$storeId/orders/new.tsx
new file mode 100644
index 0000000000..80c268565d
--- /dev/null
+++ b/packages/admin/src/routes/_authenticated/$storeId/orders/new.tsx
@@ -0,0 +1,325 @@
+import type { Customer, Variant } from '@spree/admin-sdk'
+import { useMutation, useQuery } from '@tanstack/react-query'
+import { createFileRoute, useNavigate } from '@tanstack/react-router'
+import { type FormEvent, useState } from 'react'
+import { adminClient } from '@/client'
+import { BackButton } from '@/components/back-button'
+import { Button } from '@/components/ui/button'
+import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
+import { Field, FieldGroup, FieldLabel } from '@/components/ui/field'
+import { Input } from '@/components/ui/input'
+import { Switch } from '@/components/ui/switch'
+import { Textarea } from '@/components/ui/textarea'
+import { TrashIcon, XIcon } from 'lucide-react'
+
+export const Route = createFileRoute('/_authenticated/$storeId/orders/new')({
+ component: NewOrderPage,
+})
+
+interface PendingItem {
+ variant: Variant
+ quantity: number
+}
+
+function NewOrderPage() {
+ const { storeId } = Route.useParams()
+ const navigate = useNavigate()
+
+ const [customer, setCustomer] = useState<Customer | null>(null)
+ const [customerSearch, setCustomerSearch] = useState('')
+ const [email, setEmail] = useState('')
+ const [items, setItems] = useState<PendingItem[]>([])
+ const [variantSearch, setVariantSearch] = useState('')
+ const [useDefaultAddress, setUseDefaultAddress] = useState(true)
+ const [internalNote, setInternalNote] = useState('')
+ const [customerNote, setCustomerNote] = useState('')
+ const [couponCode, setCouponCode] = useState('')
+
+ // Customer typeahead
+ const { data: customersData } = useQuery({
+ queryKey: ['customers', 'search', customerSearch],
+ queryFn: () => adminClient.customers.list({ search: customerSearch, limit: 8 }),
+ enabled: !customer && customerSearch.length >= 2,
+ staleTime: 30_000,
+ })
+ const customerResults = customersData?.data ?? []
+
+ // Variant typeahead
+ const { data: variantsData } = useQuery({
+ queryKey: ['variants', 'search', variantSearch],
+ queryFn: () => adminClient.variants.list({ search: variantSearch, limit: 8 }),
+ enabled: variantSearch.length >= 3,
+ staleTime: 30_000,
+ })
+ const variantResults = variantsData?.data ?? []
+
+ const createMutation = useMutation({
+ mutationFn: () => {
+ const payload: Record<string, unknown> = {
+ items: items.map((i) => ({ variant_id: i.variant.id, quantity: i.quantity })),
+ }
+ if (customer) {
+ payload.customer_id = customer.id
+ payload.use_customer_default_address = useDefaultAddress
+ } else if (email) {
+ payload.email = email
+ }
+ if (internalNote) payload.internal_note = internalNote
+ if (customerNote) payload.customer_note = customerNote
+ if (couponCode) payload.coupon_code = couponCode
+ return adminClient.orders.create(payload)
+ },
+ onSuccess: (order) => {
+ navigate({ to: '/$storeId/orders/$orderId', params: { storeId, orderId: order.id } })
+ },
+ })
+
+ const canSubmit = (Boolean(customer) || email.length > 0) && !createMutation.isPending
+
+ function handleSubmit(e: FormEvent<HTMLFormElement>) {
+ e.preventDefault()
+ if (!canSubmit) return
+ createMutation.mutate()
+ }
+
+ function addItem(variant: Variant) {
+ const existing = items.find((i) => i.variant.id === variant.id)
+ if (existing) {
+ setItems(items.map((i) => i.variant.id === variant.id ? { ...i, quantity: i.quantity + 1 } : i))
+ } else {
+ setItems([...items, { variant, quantity: 1 }])
+ }
+ setVariantSearch('')
+ }
+
+ function updateQuantity(variantId: string, quantity: number) {
+ if (quantity < 1) return
+ setItems(items.map((i) => i.variant.id === variantId ? { ...i, quantity } : i))
+ }
+
+ function removeItem(variantId: string) {
+ setItems(items.filter((i) => i.variant.id !== variantId))
+ }
+
+ return (
+ <div className="flex flex-col gap-6">
+ <div className="flex items-center gap-3">
+ <BackButton fallback="orders/drafts" />
+ <h1 className="text-2xl font-medium">New Order</h1>
+ </div>
+
+ <form onSubmit={handleSubmit} className="grid grid-cols-12 gap-6">
+ {/* Main */}
+ <div className="col-span-12 lg:col-span-8 flex flex-col gap-6">
+ <Card>
+ <CardHeader>
+ <CardTitle>Customer</CardTitle>
+ </CardHeader>
+ <CardContent>
+ {customer ? (
+ <div className="flex items-center justify-between rounded-md border p-3">
+ <div>
+ <div className="font-medium">{customer.email}</div>
+ {(customer.first_name || customer.last_name) && (
+ <div className="text-sm text-muted-foreground">
+ {[customer.first_name, customer.last_name].filter(Boolean).join(' ')}
+ </div>
+ )}
+ </div>
+ <Button type="button" size="sm" variant="outline" onClick={() => { setCustomer(null); setCustomerSearch('') }}>
+ <XIcon className="size-4" />
+ Change
+ </Button>
+ </div>
+ ) : (
+ <FieldGroup>
+ <Field>
+ <FieldLabel>Search by email or name</FieldLabel>
+ <Input
+ placeholder="Type 2+ chars to search…"
+ value={customerSearch}
+ onChange={(e) => setCustomerSearch(e.target.value)}
+ />
+ {customerSearch.length >= 2 && customerResults.length > 0 && (
+ <div className="mt-1 rounded-lg border bg-white shadow-xs max-h-[280px] overflow-y-auto">
+ {customerResults.map((c) => (
+ <button
+ key={c.id}
+ type="button"
+ onClick={() => { setCustomer(c); setCustomerSearch('') }}
+ className="block w-full px-3 py-2.5 text-left text-sm hover:bg-muted transition-colors border-b last:border-0"
+ >
+ <div className="font-medium">{c.email}</div>
+ {(c.first_name || c.last_name) && (
+ <div className="text-xs text-muted-foreground">
+ {[c.first_name, c.last_name].filter(Boolean).join(' ')}
+ </div>
+ )}
+ </button>
+ ))}
+ </div>
+ )}
+ </Field>
+ <Field>
+ <FieldLabel>Or use a guest email</FieldLabel>
+ <Input
+ type="email"
+ placeholder="[email protected]"
+ value={email}
+ onChange={(e) => setEmail(e.target.value)}
+ />
+ </Field>
+ </FieldGroup>
+ )}
+
+ {customer && (
+ <div className="mt-4 flex items-center gap-3">
+ <Switch checked={useDefaultAddress} onCheckedChange={setUseDefaultAddress} />
+ <span className="text-sm">Use customer's default billing & shipping addresses</span>
+ </div>
+ )}
+ </CardContent>
+ </Card>
+
+ <Card>
+ <CardHeader>
+ <CardTitle>Items</CardTitle>
+ </CardHeader>
+ <CardContent>
+ <FieldGroup>
+ <Field>
+ <FieldLabel>Add a variant</FieldLabel>
+ <Input
+ placeholder="Search by name or SKU (3+ chars)…"
+ value={variantSearch}
+ onChange={(e) => setVariantSearch(e.target.value)}
+ />
+ {variantSearch.length >= 3 && variantResults.length > 0 && (
+ <div className="mt-1 rounded-lg border bg-white shadow-xs max-h-[280px] overflow-y-auto">
+ {variantResults.map((v) => (
+ <button
+ key={v.id}
+ type="button"
+ onClick={() => addItem(v)}
+ className="block w-full px-3 py-2.5 text-left text-sm hover:bg-muted transition-colors border-b last:border-0"
+ >
+ <div className="font-medium">{v.product_name ?? v.sku ?? v.id}</div>
+ <div className="text-xs text-muted-foreground">
+ SKU {v.sku} · {v.display_price ?? '—'}
+ </div>
+ </button>
+ ))}
+ </div>
+ )}
+ </Field>
+ </FieldGroup>
+
+ {items.length > 0 && (
+ <div className="mt-4 overflow-x-auto">
+ <table className="w-full text-sm">
+ <thead>
+ <tr className="border-b bg-muted/50 text-muted-foreground">
+ <th className="p-3 pl-5 text-left font-normal">Variant</th>
+ <th className="p-3 text-left font-normal">SKU</th>
+ <th className="p-3 text-right font-normal">Qty</th>
+ <th className="p-3 pr-5 w-10" />
+ </tr>
+ </thead>
+ <tbody>
+ {items.map(({ variant, quantity }) => (
+ <tr key={variant.id} className="border-b last:border-b-0">
+ <td className="p-3 pl-5 font-medium">{variant.product_name ?? variant.sku ?? variant.id}</td>
+ <td className="p-3 text-muted-foreground">{variant.sku}</td>
+ <td className="p-3 text-right">
+ <Input
+ type="number"
+ min={1}
+ value={quantity}
+ onChange={(e) => updateQuantity(variant.id, Number(e.target.value))}
+ className="w-20 text-right ml-auto"
+ />
+ </td>
+ <td className="p-3 pr-5 text-right">
+ <Button type="button" size="icon-xs" variant="ghost" onClick={() => removeItem(variant.id)}>
+ <TrashIcon className="size-4" />
+ </Button>
+ </td>
+ </tr>
+ ))}
+ </tbody>
+ </table>
+ </div>
+ )}
+ </CardContent>
+ </Card>
+ </div>
+
+ {/* Sidebar */}
+ <div className="col-span-12 lg:col-span-4 flex flex-col gap-6">
+ <Card>
+ <CardHeader>
+ <CardTitle>Notes</CardTitle>
+ </CardHeader>
+ <CardContent>
+ <FieldGroup>
+ <Field>
+ <FieldLabel htmlFor="customer-note">Customer note (visible to customer)</FieldLabel>
+ <Textarea
+ id="customer-note"
+ rows={3}
+ value={customerNote}
+ onChange={(e) => setCustomerNote(e.target.value)}
+ />
+ </Field>
+ <Field>
+ <FieldLabel htmlFor="internal-note">Internal note (staff only)</FieldLabel>
+ <Textarea
+ id="internal-note"
+ rows={3}
+ value={internalNote}
+ onChange={(e) => setInternalNote(e.target.value)}
+ />
+ </Field>
+ </FieldGroup>
+ </CardContent>
+ </Card>
+
+ <Card>
+ <CardHeader>
+ <CardTitle>Discount</CardTitle>
+ </CardHeader>
+ <CardContent>
+ <FieldGroup>
+ <Field>
+ <FieldLabel htmlFor="coupon-code">Coupon code</FieldLabel>
+ <Input
+ id="coupon-code"
+ placeholder="Optional"
+ value={couponCode}
+ onChange={(e) => setCouponCode(e.target.value)}
+ />
+ </Field>
+ </FieldGroup>
+ </CardContent>
+ </Card>
+
+ <Card>
+ <CardContent className="flex flex-col gap-3 pt-6">
+ <Button type="submit" disabled={!canSubmit}>
+ {createMutation.isPending ? 'Creating…' : 'Create Order'}
+ </Button>
+ {createMutation.error && (
+ <p className="text-sm text-destructive">
+ {(createMutation.error as Error).message}
+ </p>
+ )}
+ <p className="text-xs text-muted-foreground">
+ Creates a draft order. Add payments and complete it after creation.
+ </p>
+ </CardContent>
+ </Card>
+ </div>
+ </form>
+ </div>
+ )
+}
diff --git a/packages/admin/src/routes/_authenticated/$storeId/products/$productId.tsx b/packages/admin/src/routes/_authenticated/$storeId/products/$productId.tsx
index 35d73b27bd..328da23790 100644
--- a/packages/admin/src/routes/_authenticated/$storeId/products/$productId.tsx
+++ b/packages/admin/src/routes/_authenticated/$storeId/products/$productId.tsx
@@ -16,6 +16,7 @@ import { zodResolver } from '@hookform/resolvers/zod'
import { createFileRoute, useRouter } from '@tanstack/react-router'
import { BackButton } from '@/components/back-button'
import { useConfirm } from '@/components/confirm-dialog'
+import { TagCombobox } from '@/components/tag-combobox'
import {
ImagePlusIcon,
Loader2Icon,
@@ -754,6 +755,7 @@ function CategorizationCard({ form }: FormCardProps) {
control={form.control}
render={({ field }) => (
<TagCombobox
+ taggableType="Spree::Product"
value={field.value ?? []}
onChange={field.onChange}
/>
@@ -829,74 +831,6 @@ function CategoryCombobox({
)
}
-function TagCombobox({
- value,
- onChange,
-}: {
- value: string[]
- onChange: (value: string[]) => void
-}) {
- const anchorRef = useComboboxAnchor()
- const [inputValue, setInputValue] = useState('')
-
- // Items = current tags + any new typed value
- const tagItems = useMemo(() => {
- const trimmed = inputValue.trim()
- if (trimmed && !value.includes(trimmed)) {
- return [...value, trimmed]
- }
- return value
- }, [value, inputValue])
-
- const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
- if (e.key === 'Enter' && inputValue.trim()) {
- e.preventDefault()
- const tag = inputValue.trim()
- if (!value.includes(tag)) {
- onChange([...value, tag])
- }
- setInputValue('')
- }
- }
-
- return (
- <Combobox
- multiple
- items={tagItems}
- value={value}
- onValueChange={onChange}
- >
- <ComboboxChips ref={anchorRef}>
- <ComboboxValue>
- {(selectedValues: string[]) =>
- selectedValues.map((tag) => (
- <ComboboxChip key={tag}>
- {tag}
- </ComboboxChip>
- ))
- }
- </ComboboxValue>
- <ComboboxChipsInput
- placeholder="Type to add tags..."
- value={inputValue}
- onChange={(e) => setInputValue((e.target as HTMLInputElement).value)}
- onKeyDown={handleKeyDown}
- />
- </ComboboxChips>
- <ComboboxContent anchor={anchorRef}>
- <ComboboxEmpty>Type and press Enter to create a tag</ComboboxEmpty>
- <ComboboxList>
- {(tag: string) => (
- <ComboboxItem key={tag} value={tag}>
- {value.includes(tag) ? tag : <>Create &ldquo;{tag}&rdquo;</>}
- </ComboboxItem>
- )}
- </ComboboxList>
- </ComboboxContent>
- </Combobox>
- )
-}
-
// ---------------------------------------------------------------------------
// Shipping
// ---------------------------------------------------------------------------
diff --git a/packages/admin/src/tables/customers.tsx b/packages/admin/src/tables/customers.tsx
new file mode 100644
index 0000000000..dc25fdd825
--- /dev/null
+++ b/packages/admin/src/tables/customers.tsx
@@ -0,0 +1,89 @@
+import { Link } from '@tanstack/react-router'
+import { UsersIcon } from 'lucide-react'
+import { formatRelativeTime } from '@/lib/formatters'
+import { defineTable } from '@/lib/table-registry'
+
+defineTable('customers', {
+ title: 'Customers',
+ searchParam: 'search',
+ searchPlaceholder: 'Search by email or name…',
+ defaultSort: { field: 'created_at', direction: 'desc' },
+ emptyIcon: <UsersIcon className="size-8 text-muted-foreground/50" />,
+ emptyMessage: 'No customers yet',
+ columns: [
+ {
+ key: 'email',
+ label: 'Email',
+ sortable: true,
+ filterable: true,
+ default: true,
+ render: (c) => (
+ <Link
+ to={"/$storeId/customers/$customerId" as string}
+ params={{ customerId: c.id }}
+ className="font-medium text-zinc-950 no-underline"
+ >
+ {c.email}
+ </Link>
+ ),
+ },
+ {
+ key: 'first_name',
+ label: 'Name',
+ sortable: true,
+ filterable: true,
+ default: true,
+ render: (c) => {
+ const name = [c.first_name, c.last_name].filter(Boolean).join(' ').trim()
+ return name || '—'
+ },
+ },
+ {
+ key: 'phone',
+ label: 'Phone',
+ sortable: true,
+ filterable: true,
+ default: false,
+ render: (c) => c.phone ?? '—',
+ },
+ {
+ key: 'orders_count',
+ label: 'Orders',
+ default: true,
+ className: 'text-right tabular-nums',
+ render: (c) => c.orders_count ?? 0,
+ },
+ {
+ key: 'total_spent',
+ label: 'Total spent',
+ default: true,
+ className: 'text-right tabular-nums whitespace-nowrap font-medium',
+ render: (c) => c.display_total_spent ?? '—',
+ },
+ {
+ key: 'last_order_completed_at',
+ label: 'Last order',
+ default: true,
+ className: 'text-sm text-muted-foreground whitespace-nowrap',
+ render: (c) => (c.last_order_completed_at ? formatRelativeTime(c.last_order_completed_at) : '—'),
+ },
+ {
+ key: 'accepts_email_marketing',
+ label: 'Newsletter',
+ sortable: true,
+ filterable: true,
+ default: false,
+ filterType: 'boolean',
+ render: (c) => (c.accepts_email_marketing ? 'Yes' : 'No'),
+ },
+ {
+ key: 'created_at',
+ label: 'Created',
+ sortable: true,
+ default: false,
+ filterType: 'date',
+ className: 'text-sm text-muted-foreground whitespace-nowrap',
+ render: (c) => formatRelativeTime(c.created_at),
+ },
+ ],
+})
diff --git a/packages/sdk/src/types/generated/Customer.ts b/packages/sdk/src/types/generated/Customer.ts
index 7d19db5bee..99cb9b69a6 100644
--- a/packages/sdk/src/types/generated/Customer.ts
+++ b/packages/sdk/src/types/generated/Customer.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 5111c001c78d6e769a3155686a150770
+// Typelizer digest 7d1453a54b13edd5631d5ee2954b6dcb
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {Address} from '@/types'
@@ -10,6 +10,7 @@ interface Customer {
last_name: string | null;
phone: string | null;
accepts_email_marketing: boolean;
+ full_name: string;
available_store_credit_total: string;
display_available_store_credit_total: string;
addresses: Array<Address>;
diff --git a/packages/sdk/src/types/generated/PaymentMethod.ts b/packages/sdk/src/types/generated/PaymentMethod.ts
index 2d099b1ed7..b4d5033f26 100644
--- a/packages/sdk/src/types/generated/PaymentMethod.ts
+++ b/packages/sdk/src/types/generated/PaymentMethod.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 819c1ac22fddb64e0dcdca265c11df4a
+// Typelizer digest 271e69a5f3ec75c1bc65a9ef8a1007ab
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
@@ -8,6 +8,7 @@ interface PaymentMethod {
description: string | null;
type: string;
session_required: boolean;
+ source_required: boolean;
}
export default PaymentMethod;
diff --git a/spree/api/app/controllers/spree/api/v3/admin/customers/addresses_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/customers/addresses_controller.rb
new file mode 100644
index 0000000000..b2d5f9827e
--- /dev/null
+++ b/spree/api/app/controllers/spree/api/v3/admin/customers/addresses_controller.rb
@@ -0,0 +1,86 @@
+module Spree
+ module Api
+ module V3
+ module Admin
+ module Customers
+ class AddressesController < ResourceController
+ # POST /api/v3/admin/customers/:customer_id/addresses
+ def create
+ @resource = @parent.addresses.new(address_attrs)
+ authorize_resource!(@resource, :create)
+
+ ApplicationRecord.transaction do
+ if @resource.save
+ apply_default_flags(@resource)
+ render json: serialize_resource(@resource.reload), status: :created
+ else
+ render_validation_error(@resource.errors)
+ raise ActiveRecord::Rollback
+ end
+ end
+ end
+
+ # PATCH /api/v3/admin/customers/:customer_id/addresses/:id
+ def update
+ authorize_resource!(@resource)
+
+ ApplicationRecord.transaction do
+ if @resource.update(address_attrs)
+ apply_default_flags(@resource)
+ render json: serialize_resource(@resource.reload)
+ else
+ render_validation_error(@resource.errors)
+ raise ActiveRecord::Rollback
+ end
+ end
+ end
+
+ # DELETE /api/v3/admin/customers/:customer_id/addresses/:id
+ def destroy
+ authorize_resource!(@resource)
+ @resource.destroy
+ head :no_content
+ end
+
+ protected
+
+ def set_parent
+ @parent = Spree.user_class.find_by_prefix_id!(params[:customer_id])
+ end
+
+ def parent_association
+ :addresses
+ end
+
+ def model_class
+ Spree::Address
+ end
+
+ def serializer_class
+ Spree.api.admin_address_serializer
+ end
+
+ private
+
+ def address_attrs
+ params.permit(
+ :firstname, :lastname, :first_name, :last_name,
+ :address1, :address2, :city,
+ :country_iso, :state_abbr, :country_id, :state_id,
+ :zipcode, :postal_code, :phone, :alternative_phone,
+ :state_name, :company, :label, :quick_checkout
+ )
+ end
+
+ def apply_default_flags(address)
+ updates = {}
+ updates[:bill_address_id] = address.id if ActiveModel::Type::Boolean.new.cast(params[:is_default_billing])
+ updates[:ship_address_id] = address.id if ActiveModel::Type::Boolean.new.cast(params[:is_default_shipping])
+ @parent.update!(updates) if updates.any?
+ end
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/spree/api/app/controllers/spree/api/v3/admin/customers/credit_cards_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/customers/credit_cards_controller.rb
new file mode 100644
index 0000000000..21ad9c3e67
--- /dev/null
+++ b/spree/api/app/controllers/spree/api/v3/admin/customers/credit_cards_controller.rb
@@ -0,0 +1,29 @@
+module Spree
+ module Api
+ module V3
+ module Admin
+ module Customers
+ class CreditCardsController < ResourceController
+ protected
+
+ def set_parent
+ @parent = Spree.user_class.find_by_prefix_id!(params[:customer_id])
+ end
+
+ def parent_association
+ :credit_cards
+ end
+
+ def model_class
+ Spree::CreditCard
+ end
+
+ def serializer_class
+ Spree.api.admin_credit_card_serializer
+ end
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/spree/api/app/controllers/spree/api/v3/admin/customers/store_credits_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/customers/store_credits_controller.rb
new file mode 100644
index 0000000000..704ad87cd2
--- /dev/null
+++ b/spree/api/app/controllers/spree/api/v3/admin/customers/store_credits_controller.rb
@@ -0,0 +1,91 @@
+module Spree
+ module Api
+ module V3
+ module Admin
+ module Customers
+ class StoreCreditsController < ResourceController
+ # POST /api/v3/admin/customers/:customer_id/store_credits
+ def create
+ @resource = @parent.store_credits.new(create_attrs)
+ @resource.created_by = try_spree_current_user
+ @resource.store ||= current_store
+ @resource.category ||= Spree::StoreCreditCategory.first
+ authorize_resource!(@resource, :create)
+
+ if @resource.save
+ render json: serialize_resource(@resource), status: :created
+ else
+ render_validation_error(@resource.errors)
+ end
+ end
+
+ # PATCH /api/v3/admin/customers/:customer_id/store_credits/:id
+ def update
+ authorize_resource!(@resource)
+
+ if @resource.amount_used.positive? && update_attrs.key?(:amount)
+ render_error(
+ code: 'store_credit_in_use',
+ message: 'Cannot change amount on a store credit that has already been used',
+ status: :unprocessable_content
+ )
+ return
+ end
+
+ if @resource.update(update_attrs)
+ render json: serialize_resource(@resource.reload)
+ else
+ render_validation_error(@resource.errors)
+ end
+ end
+
+ # DELETE /api/v3/admin/customers/:customer_id/store_credits/:id
+ def destroy
+ authorize_resource!(@resource)
+
+ if @resource.amount_used.positive?
+ render_error(
+ code: 'store_credit_in_use',
+ message: 'Cannot delete a store credit that has already been used',
+ status: :unprocessable_content
+ )
+ return
+ end
+
+ @resource.destroy
+ head :no_content
+ end
+
+ protected
+
+ def set_parent
+ @parent = Spree.user_class.find_by_prefix_id!(params[:customer_id])
+ end
+
+ def parent_association
+ :store_credits
+ end
+
+ def model_class
+ Spree::StoreCredit
+ end
+
+ def serializer_class
+ Spree.api.admin_store_credit_serializer
+ end
+
+ private
+
+ def create_attrs
+ params.permit(:amount, :currency, :category_id, :memo).to_h
+ end
+
+ def update_attrs
+ params.permit(:memo, :category_id, :amount).to_h
+ end
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/spree/api/app/controllers/spree/api/v3/admin/customers_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/customers_controller.rb
new file mode 100644
index 0000000000..0f2ad55056
--- /dev/null
+++ b/spree/api/app/controllers/spree/api/v3/admin/customers_controller.rb
@@ -0,0 +1,71 @@
+module Spree
+ module Api
+ module V3
+ module Admin
+ class CustomersController < ResourceController
+ def create
+ @resource = Spree.user_class.new(permitted_params)
+ authorize!(:create, @resource)
+
+ if @resource.save
+ render json: serialize_resource(@resource), status: :created
+ else
+ render_validation_error(@resource.errors)
+ end
+ end
+
+ def update
+ authorize_resource!(@resource)
+
+ if @resource.update(permitted_params)
+ render json: serialize_resource(@resource.reload)
+ else
+ render_validation_error(@resource.errors)
+ end
+ end
+
+ def destroy
+ authorize_resource!(@resource)
+ @resource.destroy
+ head :no_content
+ rescue Spree::Core::DestroyWithOrdersError => e
+ render_error(
+ code: 'customer_has_orders',
+ message: e.message.presence || Spree.t(:error_user_destroy_with_orders),
+ status: :unprocessable_content
+ )
+ end
+
+ protected
+
+ def model_class
+ Spree.user_class
+ end
+
+ def serializer_class
+ Spree.api.admin_customer_serializer
+ end
+
+ def scope
+ super.with_order_aggregates
+ end
+
+ def collection_includes
+ [:rich_text_internal_note, taggings: :tag]
+ end
+
+ private
+
+ def permitted_params
+ params.permit(
+ :email, :first_name, :last_name, :phone,
+ :password, :password_confirmation, :selected_locale,
+ :avatar, :accepts_email_marketing, :internal_note,
+ metadata: {}, tags: []
+ )
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/spree/api/app/controllers/spree/api/v3/admin/media_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/media_controller.rb
index 2b395331da..54c085fa26 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/media_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/media_controller.rb
@@ -61,7 +61,7 @@ module Spree
end
def permitted_params
- params.permit(*Spree::PermittedAttributes.asset_attributes)
+ params.permit(:type, :alt, :position, :attachment, :url, :signed_id)
end
def create_from_url
diff --git a/spree/api/app/controllers/spree/api/v3/admin/option_types_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/option_types_controller.rb
index 6da4249e94..fe8b2dbbc1 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/option_types_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/option_types_controller.rb
@@ -52,8 +52,10 @@ module Spree
def option_type_service_params
params.permit(
- :name, :presentation, :position, :filterable,
- option_values: [:id, *Spree::PermittedAttributes.option_value_attributes]
+ :name, :presentation, :position, :filterable, :kind,
+ option_values: [
+ :id, :name, :presentation, :position, :color_code, :image, :_destroy
+ ]
)
end
end
diff --git a/spree/api/app/controllers/spree/api/v3/admin/orders/fulfillments_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/orders/fulfillments_controller.rb
index 8c58a03432..c98c2f2a2b 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/orders/fulfillments_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/orders/fulfillments_controller.rb
@@ -92,7 +92,7 @@ module Spree
end
def permitted_params
- params.permit(*Spree::PermittedAttributes.shipment_attributes - [:id])
+ params.permit(:tracking, :selected_shipping_rate_id, :stock_location_id, :state)
end
end
end
diff --git a/spree/api/app/controllers/spree/api/v3/admin/orders/items_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/orders/items_controller.rb
index 965a651b94..5920ee2bf5 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/orders/items_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/orders/items_controller.rb
@@ -74,7 +74,7 @@ module Spree
end
def permitted_params
- params.permit(*Spree::PermittedAttributes.line_item_attributes, { options: {} })
+ params.permit(:variant_id, :quantity, metadata: {}, options: {})
end
private
diff --git a/spree/api/app/controllers/spree/api/v3/admin/orders/payments_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/orders/payments_controller.rb
index 85a1499603..4385760807 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/orders/payments_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/orders/payments_controller.rb
@@ -69,7 +69,7 @@ module Spree
end
def permitted_params
- params.permit(*Spree::PermittedAttributes.payment_attributes, :source_id)
+ params.permit(:amount, :payment_method_id, :source_id)
end
# Saved-source charges require an order customer — sources are scoped
diff --git a/spree/api/app/controllers/spree/api/v3/admin/orders_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/orders_controller.rb
index 11c11ebebd..8572272018 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/orders_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/orders_controller.rb
@@ -129,7 +129,7 @@ module Spree
end
def collection_includes
- [:line_items, :user]
+ [:line_items, :user, :rich_text_internal_note]
end
private
@@ -149,21 +149,39 @@ module Spree
:shipping_address_id, :billing_address_id,
:coupon_code,
metadata: {},
- shipping_address: Spree::PermittedAttributes.address_attributes,
- billing_address: Spree::PermittedAttributes.address_attributes,
- items: [:variant_id, :quantity, { metadata: {} }]
+ tags: [],
+ shipping_address: address_permitted_keys,
+ billing_address: address_permitted_keys,
+ items: item_permitted_keys
)
end
def order_update_params
params.permit(
- *Spree::PermittedAttributes.checkout_attributes,
- :customer_id,
- ship_address: Spree::PermittedAttributes.address_attributes,
- bill_address: Spree::PermittedAttributes.address_attributes,
- items: [:variant_id, :quantity, { metadata: {} }]
+ :email, :customer_id, :user_id,
+ :customer_note, :internal_note,
+ :currency, :locale, :market_id,
+ metadata: {},
+ tags: [],
+ ship_address: address_permitted_keys,
+ bill_address: address_permitted_keys,
+ items: item_permitted_keys
)
end
+
+ def address_permitted_keys
+ [
+ :firstname, :lastname, :first_name, :last_name,
+ :address1, :address2, :city,
+ :country_iso, :state_abbr, :country_id, :state_id,
+ :zipcode, :postal_code, :phone, :alternative_phone,
+ :state_name, :company, :label
+ ]
+ end
+
+ def item_permitted_keys
+ [:variant_id, :quantity, { metadata: {} }]
+ end
end
end
end
diff --git a/spree/api/app/controllers/spree/api/v3/admin/payment_methods_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/payment_methods_controller.rb
new file mode 100644
index 0000000000..d173395fa5
--- /dev/null
+++ b/spree/api/app/controllers/spree/api/v3/admin/payment_methods_controller.rb
@@ -0,0 +1,23 @@
+module Spree
+ module Api
+ module V3
+ module Admin
+ class PaymentMethodsController < ResourceController
+ protected
+
+ def model_class
+ Spree::PaymentMethod
+ end
+
+ def serializer_class
+ Spree.api.admin_payment_method_serializer
+ end
+
+ def scope
+ current_store.payment_methods.accessible_by(current_ability, :show)
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/spree/api/app/controllers/spree/api/v3/admin/products_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/products_controller.rb
index 7c7b55b4b1..3baad6d110 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/products_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/products_controller.rb
@@ -57,9 +57,19 @@ module Spree
def permitted_params
params.permit(
- *Spree::PermittedAttributes.product_attributes,
+ :name, :description, :slug, :status,
+ :available_on, :discontinue_on, :make_active_at,
+ :meta_title, :meta_description, :meta_keywords,
+ :tax_category_id, :shipping_category_id,
+ :promotionable, :digital,
+ # Master-variant convenience fields (forwarded to master variant)
+ :sku, :barcode, :price, :compare_at_price,
+ :cost_price, :cost_currency,
+ :weight, :height, :width, :depth, :weight_unit, :dimensions_unit,
+ :track_inventory,
tags: [],
category_ids: [],
+ metadata: {},
prices: [:amount, :compare_at_amount, :currency],
variants: [
:id, :sku, :barcode, :price, :compare_at_price,
diff --git a/spree/api/app/controllers/spree/api/v3/admin/store_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/store_controller.rb
index 60731702d5..00645749e1 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/store_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/store_controller.rb
@@ -31,7 +31,19 @@ module Spree
end
def permitted_params
- params.permit(Spree::PermittedAttributes.store_attributes)
+ params.permit(
+ :name, :url, :seo_title, :code, :meta_keywords, :meta_description,
+ :default_currency, :default_country_iso, :default_locale,
+ :mail_from_address, :customer_support_email,
+ :description, :address, :contact_phone,
+ :supported_locales, :supported_currencies,
+ :new_order_notifications_email,
+ :preferred_admin_locale, :preferred_timezone,
+ :preferred_weight_unit, :preferred_unit_system,
+ :preferred_digital_asset_authorized_clicks, :preferred_digital_asset_authorized_days,
+ :preferred_limit_digital_download_count, :preferred_limit_digital_download_days,
+ :preferred_digital_asset_link_expire_time
+ )
end
end
end
diff --git a/spree/api/app/controllers/spree/api/v3/admin/tags_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/tags_controller.rb
new file mode 100644
index 0000000000..854f2be081
--- /dev/null
+++ b/spree/api/app/controllers/spree/api/v3/admin/tags_controller.rb
@@ -0,0 +1,45 @@
+module Spree
+ module Api
+ module V3
+ module Admin
+ class TagsController < BaseController
+ MAX_RESULTS = 50
+
+ def index
+ taggable_type = params[:taggable_type].to_s
+ unless allowed_taggable_types.include?(taggable_type)
+ render_error(
+ code: 'invalid_taggable_type',
+ message: "taggable_type must be one of #{allowed_taggable_types.join(', ')}",
+ status: :unprocessable_content
+ )
+ return
+ end
+
+ scope = ActsAsTaggableOn::Tag.
+ joins(:taggings).
+ where(ActsAsTaggableOn.taggings_table => { taggable_type: taggable_type, context: 'tags' }).
+ distinct.
+ order(:name).
+ limit(MAX_RESULTS)
+
+ if params[:q].present?
+ # Escape LIKE wildcards in user input so a query like "foo_" matches
+ # only the literal underscore, not any single character.
+ escaped = params[:q].to_s.downcase.gsub(/[\\%_]/) { |c| "\\#{c}" }
+ scope = scope.where('LOWER(name) LIKE ? ESCAPE ?', "%#{escaped}%", '\\')
+ end
+
+ render json: { data: scope.pluck(:name).map { |name| { name: name } } }
+ end
+
+ private
+
+ def allowed_taggable_types
+ ['Spree::Product', 'Spree::Order', Spree.user_class.to_s]
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/spree/api/app/controllers/spree/api/v3/resource_controller.rb b/spree/api/app/controllers/spree/api/v3/resource_controller.rb
index b0e26bf894..c06d1ee24a 100644
--- a/spree/api/app/controllers/spree/api/v3/resource_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/resource_controller.rb
@@ -139,8 +139,11 @@ module Spree
# Ransack query parameters with sort translation.
# Translates `-field` notation (JSON:API standard) to Ransack `s` format.
# e.g., sort=-price,name → s=price desc,name asc
+ # Also decodes Stripe-style prefixed IDs found in keys like `*_id_eq`,
+ # `*_id_in`, `*_id_not_eq`, etc. so SPA filters can pass prefixed IDs.
def ransack_params
rp = params[:q]&.to_unsafe_h || params[:q] || {}
+ rp = decode_prefixed_id_predicates(rp)
sort_value = sort_param
if sort_value.present?
@@ -157,6 +160,27 @@ module Spree
rp
end
+ def decode_prefixed_id_predicates(hash)
+ return hash unless hash.is_a?(Hash)
+
+ hash.each_with_object({}) do |(key, value), result|
+ result[key] = if ransack_id_predicate?(key)
+ Array(value).map { |v| Spree::PrefixedId.prefixed_id?(v) ? Spree::PrefixedId.decode_prefixed_id(v) || v : v }.then { |arr|
+ value.is_a?(Array) ? arr : arr.first
+ }
+ elsif value.is_a?(Hash)
+ decode_prefixed_id_predicates(value)
+ else
+ value
+ end
+ end
+ end
+
+ RANSACK_ID_PREDICATE_RE = /_id(?:s)?(?:_(?:eq|not_eq|in|not_in|lt|lteq|gt|gteq))?\z/.freeze
+ def ransack_id_predicate?(key)
+ RANSACK_ID_PREDICATE_RE.match?(key.to_s)
+ end
+
# Sort parameter from the request
def sort_param
params[:sort]
diff --git a/spree/api/app/serializers/spree/api/v3/admin/customer_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/customer_serializer.rb
index 2b4c8a59fb..cbe432ff48 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/customer_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/customer_serializer.rb
@@ -8,7 +8,16 @@ module Spree
typelize login: [:string, nullable: true],
last_sign_in_at: [:string, nullable: true], current_sign_in_at: [:string, nullable: true],
sign_in_count: :number, failed_attempts: :number,
- last_sign_in_ip: [:string, nullable: true], current_sign_in_ip: [:string, nullable: true]
+ last_sign_in_ip: [:string, nullable: true], current_sign_in_ip: [:string, nullable: true],
+ tags: [:string, multi: true],
+ internal_note_html: [:string, nullable: true],
+ metadata: 'Record<string, unknown> | null',
+ orders_count: :number,
+ total_spent: :string,
+ display_total_spent: :string,
+ last_order_completed_at: [:string, nullable: true],
+ default_billing_address_id: [:string, nullable: true],
+ default_shipping_address_id: [:string, nullable: true]
# Admin-only attributes
attributes :login,
@@ -31,6 +40,49 @@ module Spree
user.current_sign_in_ip
end
+ attribute :tags do |user|
+ user.tag_list.to_a
+ end
+
+ attribute :internal_note_html do |user|
+ user.respond_to?(:internal_note) ? user.internal_note&.body&.to_s.presence : nil
+ end
+
+ attribute :metadata do |user|
+ user.metadata.presence
+ end
+
+ attribute :default_billing_address_id do |user|
+ user.bill_address&.prefixed_id
+ end
+
+ attribute :default_shipping_address_id do |user|
+ user.ship_address&.prefixed_id
+ end
+
+ # Order aggregates: prefer attributes precomputed on the scope (see
+ # CustomersController#scope) to avoid N+1 on list endpoints. Fall
+ # back to per-user queries when not preloaded (e.g. show endpoint
+ # for a freshly loaded record).
+ attribute :orders_count do |user|
+ user.attributes['orders_count']&.to_i || user.orders.complete.count
+ end
+
+ attribute :total_spent do |user|
+ (user.attributes['total_spent'] || user.orders.complete.sum(:total)).to_s
+ end
+
+ attribute :display_total_spent do |user|
+ amount = user.attributes['total_spent'] || user.orders.complete.sum(:total)
+ currency = Spree::Current.currency || Spree::Current.store&.default_currency || Spree::Config[:currency]
+ Spree::Money.new(amount, currency: currency).to_s
+ end
+
+ attribute :last_order_completed_at do |user|
+ value = user.attributes.key?('last_order_completed_at') ? user.attributes['last_order_completed_at'] : user.orders.complete.maximum(:completed_at)
+ value.respond_to?(:iso8601) ? value.iso8601 : value
+ end
+
# Override inherited associations to use admin serializers
many :addresses, resource: Spree.api.admin_address_serializer, if: proc { expand?('addresses') }
one :bill_address, key: :default_billing_address, resource: Spree.api.admin_address_serializer, if: proc { expand?('default_billing_address') }
@@ -39,6 +91,10 @@ module Spree
many :orders,
resource: Spree.api.admin_order_serializer,
if: proc { expand?('orders') }
+
+ many :store_credits,
+ resource: Spree.api.admin_store_credit_serializer,
+ if: proc { expand?('store_credits') }
end
end
end
diff --git a/spree/api/app/serializers/spree/api/v3/admin/order_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/order_serializer.rb
index 7ef5f91fba..468c28c39c 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/order_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/order_serializer.rb
@@ -15,6 +15,7 @@ module Spree
customer_id: [:string, nullable: true],
canceled_at: [:string, nullable: true], approved_at: [:string, nullable: true],
payment_total: :string, display_payment_total: :string,
+ tags: [:string, multi: true],
metadata: 'Record<string, unknown> | null'
# Admin-only attributes
@@ -24,6 +25,10 @@ module Spree
canceled_at: :iso8601, approved_at: :iso8601,
created_at: :iso8601, updated_at: :iso8601
+ attribute :tags do |order|
+ order.tag_list.to_a
+ end
+
attribute :internal_note do |order|
order.internal_note&.to_plain_text.presence
end
diff --git a/spree/api/app/serializers/spree/api/v3/customer_serializer.rb b/spree/api/app/serializers/spree/api/v3/customer_serializer.rb
index 8f78c18abf..c3d9fbac15 100644
--- a/spree/api/app/serializers/spree/api/v3/customer_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/customer_serializer.rb
@@ -5,12 +5,17 @@ module Spree
# Customer-facing user data
class CustomerSerializer < BaseSerializer
typelize email: :string, first_name: [:string, nullable: true], last_name: [:string, nullable: true],
+ full_name: :string,
phone: [:string, nullable: true], accepts_email_marketing: :boolean,
available_store_credit_total: :string, display_available_store_credit_total: :string,
default_billing_address: { nullable: true }, default_shipping_address: { nullable: true }
attributes :email, :first_name, :last_name, :phone, :accepts_email_marketing
+ attribute :full_name do |user|
+ user.full_name.presence || user.email
+ end
+
attribute :available_store_credit_total do |user, params|
store = params&.dig(:store) || Spree::Current.store
currency = params&.dig(:currency) || Spree::Current.currency || store&.default_currency
diff --git a/spree/api/app/serializers/spree/api/v3/payment_method_serializer.rb b/spree/api/app/serializers/spree/api/v3/payment_method_serializer.rb
index 483a14a91f..137646a005 100644
--- a/spree/api/app/serializers/spree/api/v3/payment_method_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/payment_method_serializer.rb
@@ -2,13 +2,18 @@ module Spree
module Api
module V3
class PaymentMethodSerializer < BaseSerializer
- typelize name: :string, description: [:string, nullable: true], type: :string, session_required: :boolean
+ typelize name: :string, description: [:string, nullable: true], type: :string,
+ session_required: :boolean, source_required: :boolean
attributes :name, :description, :type
attribute :session_required do |payment_method|
payment_method.session_required?
end
+
+ attribute :source_required do |payment_method|
+ payment_method.source_required?
+ end
end
end
end
diff --git a/spree/api/config/routes.rb b/spree/api/config/routes.rb
index 079d2c7570..3f2712da3f 100644
--- a/spree/api/config/routes.rb
+++ b/spree/api/config/routes.rb
@@ -129,6 +129,19 @@ Spree::Core::Engine.add_routes do
# Tax Categories
resources :tax_categories, only: [:index, :show]
+ # Payment Methods
+ resources :payment_methods, only: [:index, :show]
+
+ # Tags (autocomplete for product/order/user tag inputs)
+ resources :tags, only: [:index]
+
+ # Customers
+ resources :customers do
+ resources :addresses, controller: 'customers/addresses'
+ resources :credit_cards, controller: 'customers/credit_cards', only: [:index, :show, :destroy]
+ resources :store_credits, controller: 'customers/store_credits'
+ end
+
# Variants (top-level, for search/autocomplete across all products)
resources :variants, only: [:index, :show]
diff --git a/spree/api/spec/controllers/spree/api/v3/admin/customers/addresses_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/customers/addresses_controller_spec.rb
new file mode 100644
index 0000000000..d99deb1e48
--- /dev/null
+++ b/spree/api/spec/controllers/spree/api/v3/admin/customers/addresses_controller_spec.rb
@@ -0,0 +1,96 @@
+require 'spec_helper'
+
+RSpec.describe Spree::Api::V3::Admin::Customers::AddressesController, type: :controller do
+ render_views
+
+ include_context 'API v3 Admin authenticated'
+
+ let(:customer) { create(:user) }
+ let!(:address) { create(:address, user: customer) }
+
+ before { request.headers.merge!(headers) }
+
+ describe 'GET #index' do
+ it 'returns the customer addresses' do
+ get :index, params: { customer_id: customer.prefixed_id }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response['data']).to be_an(Array)
+ expect(json_response['data'].map { |a| a['id'] }).to include(address.prefixed_id)
+ end
+ end
+
+ describe 'POST #create' do
+ let(:state) { create(:state) }
+ let(:country) { state.country }
+ let(:create_params) do
+ {
+ customer_id: customer.prefixed_id,
+ firstname: 'Jane',
+ lastname: 'Doe',
+ address1: '123 Main St',
+ city: 'Brooklyn',
+ zipcode: '11201',
+ country_id: country.id,
+ state_id: state.id,
+ phone: '+15551234567'
+ }
+ end
+
+ it 'creates a new address for the customer' do
+ expect { post :create, params: create_params, as: :json }.to change(customer.addresses, :count).by(1)
+
+ expect(response).to have_http_status(:created)
+ expect(json_response['address1']).to eq('123 Main St')
+ end
+
+ context 'with is_default_billing flag' do
+ it 'sets the customer default billing address' do
+ post :create, params: create_params.merge(is_default_billing: true), as: :json
+
+ expect(response).to have_http_status(:created)
+ new_id = Spree::Address.find_by_prefix_id(json_response['id']).id
+ expect(customer.reload.bill_address_id).to eq(new_id)
+ end
+ end
+
+ context 'with is_default_shipping flag' do
+ it 'sets the customer default shipping address' do
+ post :create, params: create_params.merge(is_default_shipping: true), as: :json
+
+ expect(response).to have_http_status(:created)
+ new_id = Spree::Address.find_by_prefix_id(json_response['id']).id
+ expect(customer.reload.ship_address_id).to eq(new_id)
+ end
+ end
+ end
+
+ describe 'PATCH #update' do
+ it 'updates the address' do
+ patch :update, params: { customer_id: customer.prefixed_id, id: address.prefixed_id, city: 'NewCity' }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(JSON.parse(response.body)['city']).to eq('NewCity')
+ end
+
+ it 'rotates the default billing flag' do
+ other = create(:address, user: customer)
+ customer.update!(bill_address_id: other.id)
+ target_id = address.id
+
+ patch :update, params: { customer_id: customer.prefixed_id, id: address.prefixed_id, is_default_billing: true }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(customer.reload.bill_address_id).to eq(target_id)
+ end
+ end
+
+ describe 'DELETE #destroy' do
+ it 'destroys the address when not referenced by completed orders' do
+ delete :destroy, params: { customer_id: customer.prefixed_id, id: address.prefixed_id }, as: :json
+
+ expect(response).to have_http_status(:no_content)
+ expect(Spree::Address.where(id: address.id)).to be_empty
+ end
+ end
+end
diff --git a/spree/api/spec/controllers/spree/api/v3/admin/customers/credit_cards_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/customers/credit_cards_controller_spec.rb
new file mode 100644
index 0000000000..2d08c2b360
--- /dev/null
+++ b/spree/api/spec/controllers/spree/api/v3/admin/customers/credit_cards_controller_spec.rb
@@ -0,0 +1,63 @@
+require 'spec_helper'
+
+RSpec.describe Spree::Api::V3::Admin::Customers::CreditCardsController, type: :controller do
+ render_views
+
+ include_context 'API v3 Admin authenticated'
+
+ let(:customer) { create(:user) }
+ let(:payment_method) { create(:credit_card_payment_method, stores: [store]) }
+ let!(:credit_card) { create(:credit_card, user: customer, payment_method: payment_method) }
+
+ before { request.headers.merge!(headers) }
+
+ describe 'GET #index' do
+ it 'returns the customer credit cards' do
+ get :index, params: { customer_id: customer.prefixed_id }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response['data']).to be_an(Array)
+ expect(json_response['data'].map { |c| c['id'] }).to include(credit_card.prefixed_id)
+ end
+
+ context 'when customer has no cards' do
+ let(:customer) { create(:user) }
+ let!(:credit_card) { nil }
+
+ it 'returns an empty array' do
+ get :index, params: { customer_id: customer.prefixed_id }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response['data']).to eq([])
+ end
+ end
+
+ context 'when customer does not exist' do
+ it 'returns 404' do
+ get :index, params: { customer_id: 'cus_unknown' }, as: :json
+
+ expect(response).to have_http_status(:not_found)
+ end
+ end
+ end
+
+ describe 'GET #show' do
+ it 'returns the credit card' do
+ get :show, params: { customer_id: customer.prefixed_id, id: credit_card.prefixed_id }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response['id']).to eq(credit_card.prefixed_id)
+ end
+
+ context 'when card belongs to a different customer (security check)' do
+ let(:other_customer) { create(:user) }
+ let!(:other_card) { create(:credit_card, user: other_customer, payment_method: payment_method) }
+
+ it 'returns 404 — cannot read another customer\'s cards' do
+ get :show, params: { customer_id: customer.prefixed_id, id: other_card.prefixed_id }, as: :json
+
+ expect(response).to have_http_status(:not_found)
+ end
+ end
+ end
+end
diff --git a/spree/api/spec/controllers/spree/api/v3/admin/customers/store_credits_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/customers/store_credits_controller_spec.rb
new file mode 100644
index 0000000000..205d4962ff
--- /dev/null
+++ b/spree/api/spec/controllers/spree/api/v3/admin/customers/store_credits_controller_spec.rb
@@ -0,0 +1,85 @@
+require 'spec_helper'
+
+RSpec.describe Spree::Api::V3::Admin::Customers::StoreCreditsController, type: :controller do
+ render_views
+
+ include_context 'API v3 Admin authenticated'
+
+ let(:customer) { create(:user) }
+ let(:category) { create(:store_credit_category) }
+ let!(:store_credit) { create(:store_credit, user: customer, store: store, amount: 50.00, category: category) }
+
+ before { request.headers.merge!(headers) }
+
+ describe 'GET #index' do
+ it 'returns the customer store credits' do
+ get :index, params: { customer_id: customer.prefixed_id }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response['data'].map { |sc| sc['id'] }).to include(store_credit.prefixed_id)
+ end
+ end
+
+ describe 'POST #create' do
+ it 'creates a store credit and sets created_by' do
+ expect {
+ post :create, params: {
+ customer_id: customer.prefixed_id,
+ amount: 25.00,
+ currency: 'USD',
+ category_id: category.id,
+ memo: 'Goodwill'
+ }, as: :json
+ }.to change(customer.store_credits, :count).by(1)
+
+ expect(response).to have_http_status(:created)
+ created = Spree::StoreCredit.find_by_prefix_id(json_response['id'])
+ expect(created.created_by).to eq(admin_user)
+ expect(created.amount).to eq(25.00)
+ expect(created.memo).to eq('Goodwill')
+ end
+ end
+
+ describe 'PATCH #update' do
+ it 'updates memo' do
+ patch :update, params: { customer_id: customer.prefixed_id, id: store_credit.prefixed_id, memo: 'Updated memo' }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(store_credit.reload.memo).to eq('Updated memo')
+ end
+
+ context 'when store credit has been used' do
+ before { store_credit.update_column(:amount_used, 10.00) }
+
+ it 'rejects amount changes with 422' do
+ patch :update, params: { customer_id: customer.prefixed_id, id: store_credit.prefixed_id, amount: 100.00 }, as: :json
+
+ expect(response).to have_http_status(:unprocessable_content)
+ end
+
+ it 'allows memo changes' do
+ patch :update, params: { customer_id: customer.prefixed_id, id: store_credit.prefixed_id, memo: 'Still ok' }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ end
+ end
+ end
+
+ describe 'DELETE #destroy' do
+ it 'destroys an unused store credit' do
+ delete :destroy, params: { customer_id: customer.prefixed_id, id: store_credit.prefixed_id }, as: :json
+
+ expect(response).to have_http_status(:no_content)
+ end
+
+ context 'when store credit has been used' do
+ before { store_credit.update_column(:amount_used, 10.00) }
+
+ it 'returns 422' do
+ delete :destroy, params: { customer_id: customer.prefixed_id, id: store_credit.prefixed_id }, as: :json
+
+ expect(response).to have_http_status(:unprocessable_content)
+ end
+ end
+ end
+end
diff --git a/spree/api/spec/controllers/spree/api/v3/admin/customers_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/customers_controller_spec.rb
new file mode 100644
index 0000000000..26204d706e
--- /dev/null
+++ b/spree/api/spec/controllers/spree/api/v3/admin/customers_controller_spec.rb
@@ -0,0 +1,130 @@
+require 'spec_helper'
+
+RSpec.describe Spree::Api::V3::Admin::CustomersController, type: :controller do
+ render_views
+
+ include_context 'API v3 Admin authenticated'
+
+ let!(:customer) { create(:user) }
+
+ before { request.headers.merge!(headers) }
+
+ describe 'GET #index' do
+ it 'returns customers' do
+ get :index, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response['data']).to be_an(Array)
+ expect(json_response['data'].map { |c| c['id'] }).to include(customer.prefixed_id)
+ end
+
+ context 'with ransack search' do
+ let!(:matching) { create(:user, email: '[email protected]', first_name: 'Jane') }
+
+ it 'filters by search scope' do
+ get :index, params: { q: { search: 'jane' } }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response['data'].map { |c| c['id'] }).to include(matching.prefixed_id)
+ end
+
+ it 'filters by email_cont' do
+ get :index, params: { q: { email_cont: '[email protected]' } }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response['data'].map { |c| c['id'] }).to contain_exactly(matching.prefixed_id)
+ end
+ end
+ end
+
+ describe 'GET #show' do
+ it 'returns the customer with computed stats' do
+ get :show, params: { id: customer.prefixed_id }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response['id']).to eq(customer.prefixed_id)
+ expect(json_response['email']).to eq(customer.email)
+ expect(json_response).to have_key('orders_count')
+ expect(json_response).to have_key('total_spent')
+ expect(json_response).to have_key('tags')
+ end
+
+ it 'returns 404 for unknown id' do
+ get :show, params: { id: 'cus_unknown' }, as: :json
+
+ expect(response).to have_http_status(:not_found)
+ end
+ end
+
+ describe 'POST #create' do
+ let(:create_params) do
+ {
+ email: '[email protected]',
+ first_name: 'Sam',
+ last_name: 'Johnson',
+ phone: '+15555550199',
+ accepts_email_marketing: true,
+ tags: ['wholesale', 'priority']
+ }
+ end
+
+ it 'creates a customer' do
+ expect { post :create, params: create_params, as: :json }.to change(Spree.user_class, :count).by(1)
+
+ expect(response).to have_http_status(:created)
+ created = Spree.user_class.find_by_prefix_id(json_response['id'])
+ expect(created.email).to eq('[email protected]')
+ expect(created.first_name).to eq('Sam')
+ expect(created.tag_list).to contain_exactly('wholesale', 'priority')
+ end
+
+ context 'with invalid params' do
+ it 'returns validation errors for missing email' do
+ post :create, params: { first_name: 'NoEmail' }, as: :json
+
+ expect(response).to have_http_status(:unprocessable_content)
+ end
+ end
+ end
+
+ describe 'PATCH #update' do
+ it 'updates the customer' do
+ patch :update, params: { id: customer.prefixed_id, first_name: 'Updated' }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(customer.reload.first_name).to eq('Updated')
+ end
+
+ it 'replaces tags (not append)' do
+ customer.update!(tag_list: ['old-tag'])
+
+ patch :update, params: { id: customer.prefixed_id, tags: ['new-tag'] }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(customer.reload.tag_list).to contain_exactly('new-tag')
+ end
+ end
+
+ describe 'DELETE #destroy' do
+ it 'destroys a customer with no orders' do
+ target = create(:user)
+
+ expect {
+ delete :destroy, params: { id: target.prefixed_id }, as: :json
+ }.to change(Spree.user_class, :count).by(-1)
+
+ expect(response).to have_http_status(:no_content)
+ end
+
+ context 'when customer has completed orders' do
+ let(:target) { create(:user) }
+ before { create(:completed_order_with_totals, user: target, store: store) }
+
+ it 'returns 422 with error' do
+ delete :destroy, params: { id: target.prefixed_id }, as: :json
+
+ expect(response).to have_http_status(:unprocessable_content)
+ end
+ end
+ end
+end
diff --git a/spree/api/spec/controllers/spree/api/v3/admin/orders_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/orders_controller_spec.rb
index 261789166b..0206d3b4cd 100644
--- a/spree/api/spec/controllers/spree/api/v3/admin/orders_controller_spec.rb
+++ b/spree/api/spec/controllers/spree/api/v3/admin/orders_controller_spec.rb
@@ -231,6 +231,40 @@ RSpec.describe Spree::Api::V3::Admin::OrdersController, type: :controller do
expect(order.reload.user).to eq(new_customer)
end
end
+
+ context 'with tags' do
+ it 'sets tags on a previously untagged order' do
+ patch :update, params: { id: order.prefixed_id, tags: ['VIP'] }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(order.reload.tag_list).to contain_exactly('VIP')
+ expect(json_response['tags']).to contain_exactly('VIP')
+ end
+
+ it 'replaces existing tags' do
+ order.update!(tag_list: ['old'])
+ patch :update, params: { id: order.prefixed_id, tags: %w[new fresh] }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(order.reload.tag_list).to contain_exactly('new', 'fresh')
+ end
+
+ it 'clears tags when given an empty array' do
+ order.update!(tag_list: ['old'])
+ patch :update, params: { id: order.prefixed_id, tags: [] }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(order.reload.tag_list).to be_empty
+ end
+
+ it 'leaves tags untouched when key is omitted' do
+ order.update!(tag_list: ['VIP'])
+ patch :update, params: { id: order.prefixed_id, email: '[email protected]' }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(order.reload.tag_list).to contain_exactly('VIP')
+ end
+ end
end
describe 'DELETE #destroy' do
diff --git a/spree/api/spec/controllers/spree/api/v3/admin/payment_methods_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/payment_methods_controller_spec.rb
new file mode 100644
index 0000000000..9972658565
--- /dev/null
+++ b/spree/api/spec/controllers/spree/api/v3/admin/payment_methods_controller_spec.rb
@@ -0,0 +1,41 @@
+require 'spec_helper'
+
+RSpec.describe Spree::Api::V3::Admin::PaymentMethodsController, type: :controller do
+ render_views
+
+ include_context 'API v3 Admin authenticated'
+
+ let!(:payment_method) { create(:check_payment_method, stores: [store]) }
+
+ before { request.headers.merge!(headers) }
+
+ describe 'GET #index' do
+ it 'returns store-scoped payment methods' do
+ get :index, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response['data']).to be_an(Array)
+ expect(json_response['data'].map { |pm| pm['id'] }).to include(payment_method.prefixed_id)
+ end
+
+ context 'when payment method belongs to a different store' do
+ let!(:other_store) { create(:store) }
+ let!(:other_payment_method) { create(:check_payment_method, stores: [other_store]) }
+
+ it 'is not returned' do
+ get :index, as: :json
+
+ expect(json_response['data'].map { |pm| pm['id'] }).not_to include(other_payment_method.prefixed_id)
+ end
+ end
+ end
+
+ describe 'GET #show' do
+ it 'returns the payment method' do
+ get :show, params: { id: payment_method.prefixed_id }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response['id']).to eq(payment_method.prefixed_id)
+ end
+ end
+end
diff --git a/spree/api/spec/integration/spree/api/v3/admin/customers/addresses_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/customers/addresses_spec.rb
new file mode 100644
index 0000000000..f3edc786f1
--- /dev/null
+++ b/spree/api/spec/integration/spree/api/v3/admin/customers/addresses_spec.rb
@@ -0,0 +1,136 @@
+# frozen_string_literal: true
+
+require 'swagger_helper'
+
+RSpec.describe 'Admin Customer Addresses API', type: :request, swagger_doc: 'api-reference/admin.yaml' do
+ include_context 'API v3 Admin'
+
+ let!(:customer) { create(:user) }
+ let!(:address) { create(:address, user: customer) }
+ let(:country) { address.country }
+ let(:state) { address.state }
+ let(:Authorization) { "Bearer #{admin_jwt_token}" }
+
+ path '/api/v3/admin/customers/{customer_id}/addresses' do
+ let(:customer_id) { customer.prefixed_id }
+
+ get 'List customer addresses' do
+ tags 'Customer Addresses'
+ produces 'application/json'
+ security [api_key: [], bearer_auth: []]
+ description 'Returns the customer\'s saved addresses.'
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :Authorization, in: :header, type: :string, required: true
+ parameter name: :customer_id, in: :path, type: :string, required: true
+
+ response '200', 'addresses found' do
+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }
+
+ run_test! do |response|
+ data = JSON.parse(response.body)
+ expect(data['data']).to be_an(Array)
+ end
+ end
+ end
+
+ post 'Create a customer address' do
+ tags 'Customer Addresses'
+ consumes 'application/json'
+ produces 'application/json'
+ security [api_key: [], bearer_auth: []]
+ description 'Adds a new address to the customer\'s address book. Pass `is_default_billing: true` or `is_default_shipping: true` to set as the default — the previous default loses its flag in the same transaction.'
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :Authorization, in: :header, type: :string, required: true
+ parameter name: :customer_id, in: :path, type: :string, required: true
+ parameter name: :body, in: :body, schema: {
+ type: :object,
+ properties: {
+ first_name: { type: :string },
+ last_name: { type: :string },
+ address1: { type: :string },
+ address2: { type: :string },
+ city: { type: :string },
+ postal_code: { type: :string },
+ country_iso: { type: :string, description: 'ISO-2 country code (e.g. US)' },
+ state_abbr: { type: :string, description: 'State/province abbreviation (e.g. NY)' },
+ phone: { type: :string },
+ company: { type: :string },
+ label: { type: :string },
+ is_default_billing: { type: :boolean },
+ is_default_shipping: { type: :boolean }
+ }
+ }
+
+ response '201', 'address created' do
+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }
+ let(:body) do
+ {
+ first_name: 'Jane', last_name: 'Doe',
+ address1: '350 Fifth Avenue', city: 'New York', postal_code: '10118',
+ country_iso: 'US', state_abbr: 'NY', phone: '+12125551234',
+ label: 'Office'
+ }
+ end
+
+ run_test! do |response|
+ data = JSON.parse(response.body)
+ expect(data['city']).to eq('New York')
+ end
+ end
+ end
+ end
+
+ path '/api/v3/admin/customers/{customer_id}/addresses/{id}' do
+ let(:customer_id) { customer.prefixed_id }
+ let(:id) { address.prefixed_id }
+
+ patch 'Update a customer address' do
+ tags 'Customer Addresses'
+ consumes 'application/json'
+ produces 'application/json'
+ security [api_key: [], bearer_auth: []]
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :Authorization, in: :header, type: :string, required: true
+ parameter name: :customer_id, in: :path, type: :string, required: true
+ parameter name: :id, in: :path, type: :string, required: true
+ parameter name: :body, in: :body, schema: {
+ type: :object,
+ properties: {
+ city: { type: :string },
+ is_default_billing: { type: :boolean },
+ is_default_shipping: { type: :boolean }
+ }
+ }
+
+ response '200', 'address updated' do
+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }
+ let(:body) { { city: 'Manhattan' } }
+
+ run_test! do |response|
+ data = JSON.parse(response.body)
+ expect(data['city']).to eq('Manhattan')
+ end
+ end
+ end
+
+ delete 'Delete a customer address' do
+ tags 'Customer Addresses'
+ security [api_key: [], bearer_auth: []]
+ description 'Deletes the address. If it was a default, the customer loses that default (no auto-promotion).'
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :Authorization, in: :header, type: :string, required: true
+ parameter name: :customer_id, in: :path, type: :string, required: true
+ parameter name: :id, in: :path, type: :string, required: true
+
+ response '204', 'address deleted' do
+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }
+
+ run_test!
+ end
+ end
+ end
+end
diff --git a/spree/api/spec/integration/spree/api/v3/admin/customers/credit_cards_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/customers/credit_cards_spec.rb
new file mode 100644
index 0000000000..f0dec328b0
--- /dev/null
+++ b/spree/api/spec/integration/spree/api/v3/admin/customers/credit_cards_spec.rb
@@ -0,0 +1,77 @@
+# frozen_string_literal: true
+
+require 'swagger_helper'
+
+RSpec.describe 'Admin Customer Credit Cards API', type: :request, swagger_doc: 'api-reference/admin.yaml' do
+ include_context 'API v3 Admin'
+
+ let!(:customer) { create(:user) }
+ let!(:payment_method) { create(:credit_card_payment_method, stores: [store]) }
+ let!(:credit_card) { create(:credit_card, user: customer, payment_method: payment_method) }
+ let(:Authorization) { "Bearer #{admin_jwt_token}" }
+
+ path '/api/v3/admin/customers/{customer_id}/credit_cards' do
+ let(:customer_id) { customer.prefixed_id }
+
+ get 'List customer credit cards' do
+ tags 'Customer Credit Cards'
+ produces 'application/json'
+ security [api_key: [], bearer_auth: []]
+ description 'Returns the customer\'s saved credit cards. Useful for off-session admin charges via `POST /admin/orders/:id/payments { source_id }`.'
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :Authorization, in: :header, type: :string, required: true
+ parameter name: :customer_id, in: :path, type: :string, required: true
+
+ response '200', 'credit cards found' do
+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }
+
+ run_test! do |response|
+ data = JSON.parse(response.body)
+ expect(data['data']).to be_an(Array)
+ end
+ end
+ end
+ end
+
+ path '/api/v3/admin/customers/{customer_id}/credit_cards/{id}' do
+ let(:customer_id) { customer.prefixed_id }
+ let(:id) { credit_card.prefixed_id }
+
+ get 'Show a customer credit card' do
+ tags 'Customer Credit Cards'
+ produces 'application/json'
+ security [api_key: [], bearer_auth: []]
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :Authorization, in: :header, type: :string, required: true
+ parameter name: :customer_id, in: :path, type: :string, required: true
+ parameter name: :id, in: :path, type: :string, required: true
+
+ response '200', 'credit card found' do
+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }
+
+ run_test! do |response|
+ data = JSON.parse(response.body)
+ expect(data['id']).to eq(credit_card.prefixed_id)
+ end
+ end
+ end
+
+ delete 'Delete a customer credit card' do
+ tags 'Customer Credit Cards'
+ security [api_key: [], bearer_auth: []]
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :Authorization, in: :header, type: :string, required: true
+ parameter name: :customer_id, in: :path, type: :string, required: true
+ parameter name: :id, in: :path, type: :string, required: true
+
+ response '204', 'credit card deleted' do
+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }
+
+ run_test!
+ end
+ end
+ end
+end
diff --git a/spree/api/spec/integration/spree/api/v3/admin/customers/store_credits_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/customers/store_credits_spec.rb
new file mode 100644
index 0000000000..71496cd6f1
--- /dev/null
+++ b/spree/api/spec/integration/spree/api/v3/admin/customers/store_credits_spec.rb
@@ -0,0 +1,120 @@
+# frozen_string_literal: true
+
+require 'swagger_helper'
+
+RSpec.describe 'Admin Customer Store Credits API', type: :request, swagger_doc: 'api-reference/admin.yaml' do
+ include_context 'API v3 Admin'
+
+ let!(:customer) { create(:user) }
+ let!(:category) { create(:store_credit_category) }
+ let!(:store_credit) { create(:store_credit, user: customer, store: store, amount: 50.00, category: category) }
+ let(:Authorization) { "Bearer #{admin_jwt_token}" }
+
+ path '/api/v3/admin/customers/{customer_id}/store_credits' do
+ let(:customer_id) { customer.prefixed_id }
+
+ get 'List customer store credits' do
+ tags 'Customer Store Credits'
+ produces 'application/json'
+ security [api_key: [], bearer_auth: []]
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :Authorization, in: :header, type: :string, required: true
+ parameter name: :customer_id, in: :path, type: :string, required: true
+
+ response '200', 'store credits found' do
+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }
+
+ run_test! do |response|
+ data = JSON.parse(response.body)
+ expect(data['data']).to be_an(Array)
+ end
+ end
+ end
+
+ post 'Issue a store credit to a customer' do
+ tags 'Customer Store Credits'
+ consumes 'application/json'
+ produces 'application/json'
+ security [api_key: [], bearer_auth: []]
+ description '`created_by` is set automatically from the authenticated admin.'
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :Authorization, in: :header, type: :string, required: true
+ parameter name: :customer_id, in: :path, type: :string, required: true
+ parameter name: :body, in: :body, schema: {
+ type: :object,
+ required: %w[amount currency category_id],
+ properties: {
+ amount: { type: :number, example: 50.0 },
+ currency: { type: :string, example: 'USD' },
+ category_id: { type: :string, description: 'StoreCreditCategory ID' },
+ memo: { type: :string }
+ }
+ }
+
+ response '201', 'store credit created' do
+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }
+ let(:body) { { amount: 25.00, currency: 'USD', category_id: category.id, memo: 'Goodwill' } }
+
+ run_test! do |response|
+ data = JSON.parse(response.body)
+ created = Spree::StoreCredit.find_by_prefix_id(data['id'])
+ expect(created.memo).to eq('Goodwill')
+ end
+ end
+ end
+ end
+
+ path '/api/v3/admin/customers/{customer_id}/store_credits/{id}' do
+ let(:customer_id) { customer.prefixed_id }
+ let(:id) { store_credit.prefixed_id }
+
+ patch 'Update a store credit' do
+ tags 'Customer Store Credits'
+ consumes 'application/json'
+ produces 'application/json'
+ security [api_key: [], bearer_auth: []]
+ description 'Update memo / category / amount. The amount can only be changed if `amount_used == 0`.'
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :Authorization, in: :header, type: :string, required: true
+ parameter name: :customer_id, in: :path, type: :string, required: true
+ parameter name: :id, in: :path, type: :string, required: true
+ parameter name: :body, in: :body, schema: {
+ type: :object,
+ properties: {
+ amount: { type: :number },
+ category_id: { type: :string },
+ memo: { type: :string }
+ }
+ }
+
+ response '200', 'store credit updated' do
+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }
+ let(:body) { { memo: 'Updated' } }
+
+ run_test! do |_response|
+ expect(store_credit.reload.memo).to eq('Updated')
+ end
+ end
+ end
+
+ delete 'Delete a store credit' do
+ tags 'Customer Store Credits'
+ security [api_key: [], bearer_auth: []]
+ description 'Deletes an unused store credit (amount_used == 0). Returns 422 otherwise.'
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :Authorization, in: :header, type: :string, required: true
+ parameter name: :customer_id, in: :path, type: :string, required: true
+ parameter name: :id, in: :path, type: :string, required: true
+
+ response '204', 'store credit deleted' do
+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }
+
+ run_test!
+ end
+ end
+ end
+end
diff --git a/spree/api/spec/integration/spree/api/v3/admin/customers_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/customers_spec.rb
new file mode 100644
index 0000000000..ccc60bc023
--- /dev/null
+++ b/spree/api/spec/integration/spree/api/v3/admin/customers_spec.rb
@@ -0,0 +1,150 @@
+# frozen_string_literal: true
+
+require 'swagger_helper'
+
+RSpec.describe 'Admin Customers API', type: :request, swagger_doc: 'api-reference/admin.yaml' do
+ include_context 'API v3 Admin'
+
+ let!(:customer) { create(:user, email: '[email protected]', first_name: 'Jane', last_name: 'Doe') }
+ let(:Authorization) { "Bearer #{admin_jwt_token}" }
+
+ path '/api/v3/admin/customers' do
+ get 'List customers' do
+ tags 'Customers'
+ produces 'application/json'
+ security [api_key: [], bearer_auth: []]
+ description 'Returns a paginated list of customers. Supports Ransack search/filters.'
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :Authorization, in: :header, type: :string, required: true,
+ description: 'Bearer token for admin authentication'
+ parameter name: :page, in: :query, type: :integer, required: false
+ parameter name: :limit, in: :query, type: :integer, required: false
+ parameter name: 'q[search]', in: :query, type: :string, required: false,
+ description: 'Email + name full-text-ish search'
+
+ response '200', 'customers found' do
+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }
+
+ run_test! do |response|
+ data = JSON.parse(response.body)
+ expect(data['data']).to be_an(Array)
+ end
+ end
+ end
+
+ post 'Create a customer' do
+ tags 'Customers'
+ consumes 'application/json'
+ produces 'application/json'
+ security [api_key: [], bearer_auth: []]
+ description 'Creates a customer. No welcome email is sent automatically.'
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :Authorization, in: :header, type: :string, required: true
+ parameter name: :body, in: :body, schema: {
+ type: :object,
+ required: %w[email],
+ properties: {
+ email: { type: :string, example: '[email protected]' },
+ first_name: { type: :string },
+ last_name: { type: :string },
+ phone: { type: :string },
+ accepts_email_marketing: { type: :boolean },
+ internal_note: { type: :string },
+ tags: { type: :array, items: { type: :string } },
+ metadata: { type: :object }
+ }
+ }
+
+ response '201', 'customer created' do
+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }
+ let(:body) { { email: '[email protected]', first_name: 'New', last_name: 'Customer' } }
+
+ run_test! do |response|
+ data = JSON.parse(response.body)
+ expect(data['email']).to eq('[email protected]')
+ end
+ end
+ end
+ end
+
+ path '/api/v3/admin/customers/{id}' do
+ let(:id) { customer.prefixed_id }
+
+ get 'Show a customer' do
+ tags 'Customers'
+ produces 'application/json'
+ security [api_key: [], bearer_auth: []]
+ description 'Returns full customer details including computed order stats (orders_count, total_spent, last_order_completed_at).'
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :Authorization, in: :header, type: :string, required: true
+ parameter name: :id, in: :path, type: :string, required: true,
+ description: 'Customer prefixed ID'
+ parameter name: :expand, in: :query, type: :string, required: false,
+ description: 'Comma-separated associations: addresses, orders, store_credits, default_billing_address, default_shipping_address'
+
+ response '200', 'customer found' do
+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }
+
+ run_test! do |response|
+ data = JSON.parse(response.body)
+ expect(data['id']).to eq(customer.prefixed_id)
+ expect(data['email']).to eq(customer.email)
+ end
+ end
+ end
+
+ patch 'Update a customer' do
+ tags 'Customers'
+ consumes 'application/json'
+ produces 'application/json'
+ security [api_key: [], bearer_auth: []]
+ description 'Updates customer attributes. `tags` replaces the full set.'
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :Authorization, in: :header, type: :string, required: true
+ parameter name: :id, in: :path, type: :string, required: true
+ parameter name: :body, in: :body, schema: {
+ type: :object,
+ properties: {
+ email: { type: :string },
+ first_name: { type: :string },
+ last_name: { type: :string },
+ phone: { type: :string },
+ accepts_email_marketing: { type: :boolean },
+ internal_note: { type: :string },
+ tags: { type: :array, items: { type: :string } },
+ metadata: { type: :object }
+ }
+ }
+
+ response '200', 'customer updated' do
+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }
+ let(:body) { { first_name: 'Updated' } }
+
+ run_test! do |response|
+ data = JSON.parse(response.body)
+ expect(data['first_name']).to eq('Updated')
+ end
+ end
+ end
+
+ delete 'Delete a customer' do
+ tags 'Customers'
+ security [api_key: [], bearer_auth: []]
+ description 'Deletes a customer. Returns 422 if the customer has any orders.'
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :Authorization, in: :header, type: :string, required: true
+ parameter name: :id, in: :path, type: :string, required: true
+
+ response '204', 'customer deleted' do
+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }
+
+ run_test!
+ end
+ end
+ end
+end
diff --git a/spree/api/spec/integration/spree/api/v3/admin/payment_methods_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/payment_methods_spec.rb
new file mode 100644
index 0000000000..40d0a250f5
--- /dev/null
+++ b/spree/api/spec/integration/spree/api/v3/admin/payment_methods_spec.rb
@@ -0,0 +1,54 @@
+# frozen_string_literal: true
+
+require 'swagger_helper'
+
+RSpec.describe 'Admin Payment Methods API', type: :request, swagger_doc: 'api-reference/admin.yaml' do
+ include_context 'API v3 Admin'
+
+ let!(:payment_method) { create(:check_payment_method, stores: [store]) }
+ let(:Authorization) { "Bearer #{admin_jwt_token}" }
+
+ path '/api/v3/admin/payment_methods' do
+ get 'List payment methods' do
+ tags 'Payment Methods'
+ produces 'application/json'
+ security [api_key: [], bearer_auth: []]
+ description 'Returns the store\'s configured payment methods. Use `source_required: true` to know which methods need a saved source.'
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :Authorization, in: :header, type: :string, required: true
+
+ response '200', 'payment methods found' do
+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }
+
+ run_test! do |response|
+ data = JSON.parse(response.body)
+ expect(data['data']).to be_an(Array)
+ end
+ end
+ end
+ end
+
+ path '/api/v3/admin/payment_methods/{id}' do
+ let(:id) { payment_method.prefixed_id }
+
+ get 'Show a payment method' do
+ tags 'Payment Methods'
+ produces 'application/json'
+ security [api_key: [], bearer_auth: []]
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :Authorization, in: :header, type: :string, required: true
+ parameter name: :id, in: :path, type: :string, required: true
+
+ response '200', 'payment method found' do
+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }
+
+ run_test! do |response|
+ data = JSON.parse(response.body)
+ expect(data['id']).to eq(payment_method.prefixed_id)
+ end
+ end
+ end
+ end
+end
diff --git a/spree/api/spec/integration/spree/api/v3/admin/tags_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/tags_spec.rb
new file mode 100644
index 0000000000..1865aa3afe
--- /dev/null
+++ b/spree/api/spec/integration/spree/api/v3/admin/tags_spec.rb
@@ -0,0 +1,53 @@
+# frozen_string_literal: true
+
+require 'swagger_helper'
+
+RSpec.describe 'Admin Tags API', type: :request, swagger_doc: 'api-reference/admin.yaml' do
+ include_context 'API v3 Admin'
+
+ let(:Authorization) { "Bearer #{admin_jwt_token}" }
+
+ path '/api/v3/admin/tags' do
+ get 'List tags' do
+ tags 'Tags'
+ produces 'application/json'
+ security [api_key: [], bearer_auth: []]
+ description 'Returns tag names for a given taggable type. Used for autocomplete in tag inputs on products, orders, and customers.'
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :Authorization, in: :header, type: :string, required: true
+ parameter name: :taggable_type, in: :query, type: :string, required: true,
+ description: 'Taggable type (`Spree::Product`, `Spree::Order`, or `Spree::User`)'
+ parameter name: :q, in: :query, type: :string, required: false,
+ description: 'Optional case-insensitive substring filter'
+
+ response '200', 'tags found' do
+ let(:taggable_type) { Spree.user_class.to_s }
+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }
+
+ before do
+ user = create(:user)
+ user.tag_list.add('vip', 'wholesale')
+ user.save!
+ end
+
+ run_test! do |response|
+ data = JSON.parse(response.body)
+ expect(data['data']).to be_an(Array)
+ names = data['data'].map { |t| t['name'] }
+ expect(names).to include('vip', 'wholesale')
+ end
+ end
+
+ response '422', 'invalid taggable type' do
+ let(:taggable_type) { 'Spree::Foo' }
+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }
+
+ run_test! do |response|
+ data = JSON.parse(response.body)
+ expect(data['error']['code']).to eq('invalid_taggable_type')
+ end
+ end
+ end
+ end
+end
diff --git a/spree/api/spec/integration/spree/api/v3/store/addresses_spec.rb b/spree/api/spec/integration/spree/api/v3/store/addresses_spec.rb
index ab423332f4..443bb26950 100644
--- a/spree/api/spec/integration/spree/api/v3/store/addresses_spec.rb
+++ b/spree/api/spec/integration/spree/api/v3/store/addresses_spec.rb
@@ -5,9 +5,9 @@ require 'swagger_helper'
RSpec.describe 'Addresses API', type: :request, swagger_doc: 'api-reference/store.yaml' do
include_context 'API v3 Store'
- let!(:country) { create(:country, states_required: true) }
- let!(:state) { create(:state, country: country) }
- let!(:address) { create(:address, user: user, country: country, state: state) }
+ let!(:address) { create(:address, user: user) }
+ let(:country) { address.country }
+ let(:state) { address.state }
path '/api/v3/store/customers/me/addresses' do
get 'List customer addresses' do
diff --git a/spree/api/spec/swagger_helper.rb b/spree/api/spec/swagger_helper.rb
index 46e2dfc0af..dc35ead24f 100644
--- a/spree/api/spec/swagger_helper.rb
+++ b/spree/api/spec/swagger_helper.rb
@@ -173,13 +173,21 @@ RSpec.configure do |config|
{ name: 'Refunds', description: 'Order refund management' },
{ name: 'Fulfillments', description: 'Order fulfillment management — ship, cancel, split' },
{ name: 'Order Gift Cards', description: 'Apply / remove gift cards on an order' },
- { name: 'Order Store Credits', description: 'Apply / remove customer store credit on an order' }
+ { name: 'Order Store Credits', description: 'Apply / remove customer store credit on an order' },
+ { name: 'Customers', description: 'Customer management — profile, tags, marketing consent, notes' },
+ { name: 'Customer Addresses', description: "Saved address book per customer with default billing/shipping flags" },
+ { name: 'Customer Store Credits', description: "Per-customer store credit balances issued by admin" },
+ { name: 'Customer Credit Cards', description: "Customer's saved credit cards (read-only)" },
+ { name: 'Payment Methods', description: 'Store-configured payment methods (read-only)' },
+ { name: 'Tags', description: 'Tag autocomplete for product/order/customer tag inputs' }
],
'x-tagGroups': [
{ name: 'Authentication', tags: ['Authentication'] },
{ name: 'Catalog', tags: %w[Products Variants Prices] },
{ name: 'Options', tags: ['Option Types'] },
- { name: 'Orders', tags: ['Orders', 'Payments', 'Refunds', 'Fulfillments', 'Order Gift Cards', 'Order Store Credits'] }
+ { name: 'Orders', tags: ['Orders', 'Payments', 'Refunds', 'Fulfillments', 'Order Gift Cards', 'Order Store Credits'] },
+ { name: 'Customers', tags: ['Customers', 'Customer Addresses', 'Customer Store Credits', 'Customer Credit Cards'] },
+ { name: 'Configuration', tags: ['Payment Methods', 'Tags'] }
],
components: {
securitySchemes: {
diff --git a/spree/core/app/models/concerns/spree/user_methods.rb b/spree/core/app/models/concerns/spree/user_methods.rb
index f23c96b4d2..e50337d13e 100644
--- a/spree/core/app/models/concerns/spree/user_methods.rb
+++ b/spree/core/app/models/concerns/spree/user_methods.rb
@@ -36,6 +36,10 @@ module Spree
normalizes :email, :first_name, :last_name, with: ->(value) { value&.to_s&.squish&.presence }
acts_as_taggable_on :tags
+ def tags=(tags)
+ self.tag_list = tags
+ end
+
#
# Associations
#
@@ -96,9 +100,36 @@ module Spree
# Backward compatibility alias — remove in Spree 6.0
def self.multi_search(query) = search(query)
- self.whitelisted_ransackable_associations = %w[bill_address ship_address addresses tags spree_roles]
- self.whitelisted_ransackable_attributes = %w[id email first_name last_name accepts_email_marketing]
- self.whitelisted_ransackable_scopes = %w[search multi_search]
+ self.whitelisted_ransackable_associations = %w[bill_address ship_address addresses tags spree_roles orders]
+ self.whitelisted_ransackable_attributes = %w[id email first_name last_name phone accepts_email_marketing
+ created_at updated_at last_sign_in_at]
+ self.whitelisted_ransackable_scopes = %w[search multi_search with_min_total_spent]
+
+ scope :with_min_total_spent, ->(amount) {
+ joins(:orders).where(spree_orders: { state: 'complete' }).
+ group("#{table_name}.id").
+ having('SUM(spree_orders.total) >= ?', amount.to_d)
+ }
+
+ # Precomputes orders_count, total_spent, and last_order_completed_at via a
+ # single aggregate join so list endpoints avoid 4 queries per user. The
+ # values land on the user as virtual attributes.
+ scope :with_order_aggregates, -> {
+ order_table = Spree::Order.table_name
+ select(
+ "#{table_name}.*, " \
+ "COALESCE(orders_agg.orders_count, 0) AS orders_count, " \
+ "COALESCE(orders_agg.total_spent, 0) AS total_spent, " \
+ "orders_agg.last_order_completed_at AS last_order_completed_at"
+ ).joins(
+ "LEFT JOIN (" \
+ "SELECT user_id, COUNT(*) AS orders_count, SUM(total) AS total_spent, MAX(completed_at) AS last_order_completed_at " \
+ "FROM #{order_table} " \
+ "WHERE state = 'complete' AND user_id IS NOT NULL " \
+ "GROUP BY user_id" \
+ ") orders_agg ON orders_agg.user_id = #{table_name}.id"
+ )
+ }
def self.with_email(query)
where("#{table_name}.email LIKE ?", "%#{query}%")
diff --git a/spree/core/app/models/spree/order.rb b/spree/core/app/models/spree/order.rb
index bc23c33f52..514a16f575 100644
--- a/spree/core/app/models/spree/order.rb
+++ b/spree/core/app/models/spree/order.rb
@@ -131,6 +131,10 @@ module Spree
acts_as_taggable_on :tags
acts_as_taggable_tenant :store_id
+ def tags=(tags)
+ self.tag_list = tags
+ end
+
ASSOCIATED_USER_ATTRIBUTES = [:user_id, :email, :bill_address_id, :ship_address_id]
# 6.0 forward-compat: User→Customer rename. Column stays user_id in 5.x.
diff --git a/spree/core/app/services/spree/imports/row_processors/customer.rb b/spree/core/app/services/spree/imports/row_processors/customer.rb
index 2b9833fbbc..48ae2fee0d 100644
--- a/spree/core/app/services/spree/imports/row_processors/customer.rb
+++ b/spree/core/app/services/spree/imports/row_processors/customer.rb
@@ -34,7 +34,10 @@ module Spree
end
def assign_address(user)
- address = user.bill_address || user.build_bill_address
+ # Save user first so the address can FK to it via user_id (has_many :addresses).
+ user.save! if user.new_record?
+
+ address = user.bill_address || user.addresses.build
address.firstname = attributes['first_name'].presence || user.first_name
address.lastname = attributes['last_name'].presence || user.last_name
address.company = attributes['company'].strip if attributes['company'].present?
diff --git a/spree/core/app/services/spree/orders/create.rb b/spree/core/app/services/spree/orders/create.rb
index cb4ad58da9..8996f02a1f 100644
--- a/spree/core/app/services/spree/orders/create.rb
+++ b/spree/core/app/services/spree/orders/create.rb
@@ -29,6 +29,7 @@ module Spree
ApplicationRecord.transaction do
order = build_order
assign_addresses(order)
+ order.tags = @params[:tags] if @params[:tags]
order.save!
add_items(order) if @params[:items].present?
diff --git a/spree/core/db/sample_data/orders.rb b/spree/core/db/sample_data/orders.rb
index 2805da20fb..348c78a272 100644
--- a/spree/core/db/sample_data/orders.rb
+++ b/spree/core/db/sample_data/orders.rb
@@ -78,7 +78,7 @@ end
orders.each(&:create_proposed_shipments)
-Spree::Order.where(id: orders.map(&:id)).update_all(state: :complete, completed_at: Time.current - 1.day)
+Spree::Order.where(id: orders.map(&:id)).update_all(state: :complete, status: 'placed', completed_at: Time.current - 1.day)
# Adjustments (tax)
tax_rate = Spree::TaxRate.find_by(name: 'California')
diff --git a/spree/core/lib/spree/testing_support/factories/address_factory.rb b/spree/core/lib/spree/testing_support/factories/address_factory.rb
index 0da9eee165..0fa8c9a6f6 100644
--- a/spree/core/lib/spree/testing_support/factories/address_factory.rb
+++ b/spree/core/lib/spree/testing_support/factories/address_factory.rb
@@ -5,19 +5,26 @@ FactoryBot.define do
company { 'Company' }
sequence(:address1) { |n| "#{n} Lovely Street" }
address2 { 'Northwest' }
- city { 'Herndon' }
- zipcode { '35005' }
+ city { 'New York' }
+ zipcode { '10118' }
phone { '555-555-0199' }
alternative_phone { '555-555-0199' }
- state { |address| address.association(:state) || Spree::State.last }
-
- country do |address|
- if address.state
- address.state.country
- else
- address.association(:country)
+ # Default to a real US/NY pair (cached via find_or_create_by) so generated
+ # OpenAPI examples carry plausible country/state fields. Tests that need a
+ # different state/country pass them explicitly.
+ country do
+ Spree::Country.find_or_create_by!(iso: 'US') do |c|
+ c.iso3 = 'USA'
+ c.name = 'United States of America'
+ c.iso_name = 'UNITED STATES'
+ c.numcode = 840
+ c.states_required = true
end
end
+
+ state do |address|
+ (address.country || Spree::Country.find_by(iso: 'US'))&.states&.find_or_create_by!(abbr: 'NY') { |s| s.name = 'New York' }
+ end
end
end
diff --git a/spree/core/spec/services/spree/imports/row_processors/customer_spec.rb b/spree/core/spec/services/spree/imports/row_processors/customer_spec.rb
index d513d5fbbd..07be00521b 100644
--- a/spree/core/spec/services/spree/imports/row_processors/customer_spec.rb
+++ b/spree/core/spec/services/spree/imports/row_processors/customer_spec.rb
@@ -73,6 +73,14 @@ RSpec.describe Spree::Imports::RowProcessors::Customer, type: :service do
expect(user.ship_address).to eq user.bill_address
end
+ it 'links the address back to the user via user_id' do
+ user = subject.process!
+
+ address = user.bill_address
+ expect(address.user_id).to eq user.id
+ expect(user.addresses.reload).to include(address)
+ end
+
it 'generates a random password for new users' do
user = subject.process!