openapi: 3.0.3
info:
title: Admin Account / Address Payments API
contact:
name: Spree Commerce
url: https://spreecommerce.org
email: hello@spreecommerce.org
description: "Spree Admin API v3 - Administrative API for managing products, orders, and store settings.\n\n## Authentication\n\nThe Admin API requires a secret API key passed in the `x-spree-api-key` header.\nSecret API keys can be generated in the Spree admin dashboard.\n\n## Response Format\n\nAll responses are JSON. List endpoints return paginated responses with `data` and `meta` keys.\nSingle resource endpoints return a flat JSON object.\n\n## Resource IDs\n\nEvery resource is identified by an opaque string ID (e.g. `prod_86Rf07xd4z`,\n`variant_k5nR8xLq`, `or_UkLWZg9DAJ`). Use these IDs everywhere — URL paths,\nrequest bodies, and Ransack filters all accept them directly.\n\n## Error Handling\n\nErrors return a consistent format:\n```json\n{\n \"error\": {\n \"code\": \"validation_error\",\n \"message\": \"Validation failed\",\n \"details\": { \"name\": [\"can't be blank\"] }\n }\n}\n```\n"
version: v3
servers:
- url: http://{defaultHost}
variables:
defaultHost:
default: localhost:3000
tags:
- name: Payments
description: Order payments — list, capture, void
paths:
/api/v3/admin/orders/{order_id}/payments:
get:
summary: List payments
tags:
- Payments
security:
- api_key: []
bearer_auth: []
description: 'Returns all payments for an order.
**Required scope:** `read_payments` (for API-key authentication).'
x-codeSamples:
- lang: javascript
label: Spree Admin SDK
source: "import { createAdminClient } from '@spree/admin-sdk'\n\nconst client = createAdminClient({\n baseUrl: 'https://your-store.com',\n secretKey: 'sk_xxx',\n})\n\nconst { data: payments } = await client.orders.payments.list('or_UkLWZg9DAJ')"
parameters:
- name: x-spree-api-key
in: header
required: true
schema:
type: string
- name: Authorization
in: header
required: true
description: Bearer token for admin authentication
schema:
type: string
- name: order_id
in: path
required: true
description: Order ID
schema:
type: string
- name: expand
in: query
required: false
description: Comma-separated associations to expand (e.g., payment_method, source). Use dot notation for nested expand (max 4 levels).
schema:
type: string
- name: fields
in: query
required: false
description: Comma-separated list of fields to include (e.g., amount,status,number,response_code). id is always included.
schema:
type: string
responses:
'200':
description: payments found
content:
application/json:
example:
data:
- id: py_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
response_code: BGS-666a0970d255
number: PST3ZPXJ
amount: '110.0'
display_amount: $110.00
status: completed
source_type: credit_card
source_id: card_UkLWZg9DAJ
source:
id: card_UkLWZg9DAJ
brand: visa
last4: '1111'
month: 12
year: 2027
name: Spree Commerce
default: false
gateway_payment_profile_id: null
customer_id: null
payment_method_id: pm_gbHJdmfrXB
metadata: {}
created_at: '2026-06-12T17:24:35.003Z'
updated_at: '2026-06-12T17:24:35.006Z'
metadata: {}
avs_response: null
cvv_response_code: null
cvv_response_message: null
created_at: '2026-06-12T17:24:35.005Z'
updated_at: '2026-06-12T17:24:35.005Z'
captured_amount: '0.0'
order_id: or_UkLWZg9DAJ
meta:
page: 1
limit: 25
count: 1
pages: 1
from: 1
to: 1
in: 1
previous: null
next: null
post:
summary: Create a payment
tags:
- Payments
security:
- api_key: []
bearer_auth: []
description: 'Creates a new payment for the order.
**Required scope:** `write_payments` (for API-key authentication).'
x-codeSamples:
- lang: javascript
label: Spree Admin SDK
source: "import { createAdminClient } from '@spree/admin-sdk'\n\nconst client = createAdminClient({\n baseUrl: 'https://your-store.com',\n secretKey: 'sk_xxx',\n})\n\nconst payment = await client.orders.payments.create('or_UkLWZg9DAJ', {\n payment_method_id: 'pm_UkLWZg9DAJ',\n amount: 99.99,\n source_id: 'cc_UkLWZg9DAJ',\n})"
parameters:
- name: x-spree-api-key
in: header
required: true
schema:
type: string
- name: Authorization
in: header
required: true
description: Bearer token for admin authentication
schema:
type: string
- name: order_id
in: path
required: true
description: Order ID
schema:
type: string
responses:
'201':
description: payment created
content:
application/json:
example:
id: py_gbHJdmfrXB
payment_method_id: pm_EfhxLZ9ck8
response_code: null
number: PRZAZQJ8
amount: '110.0'
display_amount: $110.00
status: checkout
source_type: null
source_id: null
source: null
metadata: {}
avs_response: null
cvv_response_code: null
cvv_response_message: null
created_at: '2026-06-12T17:24:36.354Z'
updated_at: '2026-06-12T17:24:36.354Z'
captured_amount: '0.0'
order_id: or_gbHJdmfrXB
requestBody:
content:
application/json:
schema:
type: object
required:
- payment_method_id
properties:
payment_method_id:
type: string
description: Payment method ID
amount:
type: number
example: 99.99
source_id:
type: string
description: Payment source ID
/api/v3/admin/orders/{order_id}/payments/{id}:
get:
summary: Show a payment
tags:
- Payments
security:
- api_key: []
bearer_auth: []
description: 'Returns details of a specific payment.
**Required scope:** `read_payments` (for API-key authentication).'
x-codeSamples:
- lang: javascript
label: Spree Admin SDK
source: "import { createAdminClient } from '@spree/admin-sdk'\n\nconst client = createAdminClient({\n baseUrl: 'https://your-store.com',\n secretKey: 'sk_xxx',\n})\n\nconst payment = await client.orders.payments.get('or_UkLWZg9DAJ', 'pay_UkLWZg9DAJ')"
parameters:
- name: x-spree-api-key
in: header
required: true
schema:
type: string
- name: Authorization
in: header
required: true
description: Bearer token for admin authentication
schema:
type: string
- name: order_id
in: path
required: true
description: Order ID
schema:
type: string
- name: id
in: path
required: true
description: Payment ID
schema:
type: string
- name: expand
in: query
required: false
description: Comma-separated associations to expand (e.g., payment_method, source). Use dot notation for nested expand (max 4 levels).
schema:
type: string
- name: fields
in: query
required: false
description: Comma-separated list of fields to include (e.g., amount,status,number,response_code). id is always included.
schema:
type: string
responses:
'200':
description: payment found
content:
application/json:
example:
id: py_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
response_code: BGS-67d8bd9175fb
number: PFKTQFMQ
amount: '110.0'
display_amount: $110.00
status: completed
source_type: credit_card
source_id: card_UkLWZg9DAJ
source:
id: card_UkLWZg9DAJ
brand: visa
last4: '1111'
month: 12
year: 2027
name: Spree Commerce
default: false
gateway_payment_profile_id: null
customer_id: null
payment_method_id: pm_gbHJdmfrXB
metadata: {}
created_at: '2026-06-12T17:24:36.816Z'
updated_at: '2026-06-12T17:24:36.820Z'
metadata: {}
avs_response: null
cvv_response_code: null
cvv_response_message: null
created_at: '2026-06-12T17:24:36.819Z'
updated_at: '2026-06-12T17:24:36.819Z'
captured_amount: '0.0'
order_id: or_UkLWZg9DAJ
/api/v3/admin/orders/{order_id}/payments/{id}/capture:
patch:
summary: Capture a payment
tags:
- Payments
security:
- api_key: []
bearer_auth: []
description: 'Captures a pending payment.
**Required scope:** `write_payments` (for API-key authentication).'
x-codeSamples:
- lang: javascript
label: Spree Admin SDK
source: "import { createAdminClient } from '@spree/admin-sdk'\n\nconst client = createAdminClient({\n baseUrl: 'https://your-store.com',\n secretKey: 'sk_xxx',\n})\n\nconst payment = await client.orders.payments.capture('or_UkLWZg9DAJ', 'pay_UkLWZg9DAJ')"
parameters:
- name: x-spree-api-key
in: header
required: true
schema:
type: string
- name: Authorization
in: header
required: true
description: Bearer token for admin authentication
schema:
type: string
- name: order_id
in: path
required: true
description: Order ID
schema:
type: string
- name: id
in: path
required: true
description: Payment ID
schema:
type: string
responses:
'200':
description: payment captured
content:
application/json:
example:
id: py_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
response_code: BGS-b63164b5fd08
number: PV70TAWA
amount: '110.0'
display_amount: $110.00
status: completed
source_type: credit_card
source_id: card_UkLWZg9DAJ
source:
id: card_UkLWZg9DAJ
brand: visa
last4: '1111'
month: 12
year: 2027
name: Spree Commerce
default: false
gateway_payment_profile_id: null
customer_id: null
payment_method_id: pm_gbHJdmfrXB
metadata: {}
created_at: '2026-06-12T17:24:37.491Z'
updated_at: '2026-06-12T17:24:37.494Z'
metadata: {}
avs_response: null
cvv_response_code: null
cvv_response_message: null
created_at: '2026-06-12T17:24:37.493Z'
updated_at: '2026-06-12T17:24:37.844Z'
captured_amount: '110.0'
order_id: or_UkLWZg9DAJ
'422':
description: capture failed
content:
application/json:
example:
error:
code: processing_error
message: 'Bogus Gateway: Forced failure'
schema:
$ref: '#/components/schemas/ErrorResponse'
/api/v3/admin/orders/{order_id}/payments/{id}/void:
patch:
summary: Void a payment
tags:
- Payments
security:
- api_key: []
bearer_auth: []
description: 'Voids a payment.
**Required scope:** `write_payments` (for API-key authentication).'
x-codeSamples:
- lang: javascript
label: Spree Admin SDK
source: "import { createAdminClient } from '@spree/admin-sdk'\n\nconst client = createAdminClient({\n baseUrl: 'https://your-store.com',\n secretKey: 'sk_xxx',\n})\n\nconst payment = await client.orders.payments.void('or_UkLWZg9DAJ', 'pay_UkLWZg9DAJ')"
parameters:
- name: x-spree-api-key
in: header
required: true
schema:
type: string
- name: Authorization
in: header
required: true
description: Bearer token for admin authentication
schema:
type: string
- name: order_id
in: path
required: true
description: Order ID
schema:
type: string
- name: id
in: path
required: true
description: Payment ID
schema:
type: string
responses:
'200':
description: payment voided
content:
application/json:
example:
id: py_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
response_code: void-BGS-2993d99c08c2
number: PJKLS93Y
amount: '110.0'
display_amount: $110.00
status: void
source_type: credit_card
source_id: card_UkLWZg9DAJ
source:
id: card_UkLWZg9DAJ
brand: visa
last4: '1111'
month: 12
year: 2027
name: Spree Commerce
default: false
gateway_payment_profile_id: null
customer_id: null
payment_method_id: pm_gbHJdmfrXB
metadata: {}
created_at: '2026-06-12T17:24:38.988Z'
updated_at: '2026-06-12T17:24:38.991Z'
metadata: {}
avs_response: null
cvv_response_code: null
cvv_response_message: null
created_at: '2026-06-12T17:24:38.990Z'
updated_at: '2026-06-12T17:24:39.301Z'
captured_amount: '0.0'
order_id: or_UkLWZg9DAJ
/api/v2/platform/payments:
get:
summary: Return a list of Payments
tags:
- Payments
security:
- bearer_auth: []
description: Returns a list of Payments
operationId: payments-list
parameters:
- name: page
in: query
example: 1
schema:
type: integer
- name: per_page
in: query
example: 50
schema:
type: integer
- name: include
in: query
description: 'Select which associated resources you would like to fetch, see: https://jsonapi.org/format/#fetching-includes'
example: payment_method,order,source
schema:
type: string
- name: filter[payment_method_id_eq]
in: query
description: ''
example: '1'
schema:
type: string
- name: filter[amount_gteq]
in: query
description: ''
example: '99.90'
schema:
type: string
responses:
'200':
description: Records returned
content:
application/vnd.api+json:
examples:
Example:
value:
data:
- id: '6'
type: payment
attributes:
amount: '45.75'
source_type: Spree::CreditCard
state: invalid
response_code: '12345'
avs_response: null
created_at: '2022-11-08T19:34:50.932Z'
updated_at: '2022-11-08T19:34:50.951Z'
number: PPC5V5ZL
cvv_response_code: null
cvv_response_message: null
public_metadata: {}
private_metadata: {}
display_amount: $45.75
relationships:
order:
data:
id: '72'
type: order
payment_method:
data:
id: '60'
type: payment_method
source:
data:
id: '5'
type: credit_card
log_entries:
data: []
state_changes:
data:
- id: '15'
type: state_change
payment_capture_events:
data: []
refunds:
data: []
- id: '7'
type: payment
attributes:
amount: '45.75'
source_type: Spree::CreditCard
state: checkout
response_code: '12345'
avs_response: null
created_at: '2022-11-08T19:34:50.949Z'
updated_at: '2022-11-08T19:34:50.949Z'
number: PB59CC7E
cvv_response_code: null
cvv_response_message: null
public_metadata: {}
private_metadata: {}
display_amount: $45.75
relationships:
order:
data:
id: '72'
type: order
payment_method:
data:
id: '60'
type: payment_method
source:
data:
id: '6'
type: credit_card
log_entries:
data: []
state_changes:
data: []
payment_capture_events:
data: []
refunds:
data: []
meta:
count: 2
total_count: 2
total_pages: 1
links:
self: http://www.example.com/api/v2/platform/payments?page=1&per_page=&include=&filter[payment_method_id_eq]=&filter[amount_gteq]=
next: http://www.example.com/api/v2/platform/payments?filter%5Bamount_gteq%5D=&filter%5Bpayment_method_id_eq%5D=&include=&page=1&per_page=
prev: http://www.example.com/api/v2/platform/payments?filter%5Bamount_gteq%5D=&filter%5Bpayment_method_id_eq%5D=&include=&page=1&per_page=
last: http://www.example.com/api/v2/platform/payments?filter%5Bamount_gteq%5D=&filter%5Bpayment_method_id_eq%5D=&include=&page=1&per_page=
first: http://www.example.com/api/v2/platform/payments?filter%5Bamount_gteq%5D=&filter%5Bpayment_method_id_eq%5D=&include=&page=1&per_page=
schema:
$ref: '#/components/schemas/resources_list'
'401':
description: Authentication Failed
content:
application/vnd.api+json:
examples:
Example:
value:
error: The access token is invalid
schema:
$ref: '#/components/schemas/error'
/api/v2/platform/payments/{id}:
get:
summary: Return a Payment
tags:
- Payments
security:
- bearer_auth: []
description: Returns a Payment
operationId: show-payment
parameters:
- name: id
in: path
required: true
schema:
type: string
- name: include
in: query
description: 'Select which associated resources you would like to fetch, see: https://jsonapi.org/format/#fetching-includes'
example: payment_method,order,source
schema:
type: string
responses:
'200':
description: Record found
content:
application/vnd.api+json:
examples:
Example:
value:
data:
id: '10'
type: payment
attributes:
amount: '45.75'
source_type: Spree::CreditCard
state: checkout
response_code: '12345'
avs_response: null
created_at: '2022-11-08T19:34:51.349Z'
updated_at: '2022-11-08T19:34:51.349Z'
number: PROYB91V
cvv_response_code: null
cvv_response_message: null
public_metadata: {}
private_metadata: {}
display_amount: $45.75
relationships:
order:
data:
id: '74'
type: order
payment_method:
data:
id: '66'
type: payment_method
source:
data:
id: '9'
type: credit_card
log_entries:
data: []
state_changes:
data: []
payment_capture_events:
data: []
refunds:
data: []
schema:
$ref: '#/components/schemas/resource'
'404':
description: Record not found
content:
application/vnd.api+json:
examples:
Example:
value:
error: The resource you were looking for could not be found.
schema:
$ref: '#/components/schemas/error'
'401':
description: Authentication Failed
content:
application/vnd.api+json:
examples:
Example:
value:
error: The access token is invalid
schema:
$ref: '#/components/schemas/error'
delete:
summary: Delete a Payment
tags:
- Payments
security:
- bearer_auth: []
description: Deletes a Payment
operationId: delete-payment
parameters:
- name: id
in: path
required: true
schema:
type: string
responses:
'204':
description: Record deleted
'404':
description: Record not found
content:
application/vnd.api+json:
examples:
Example:
value:
error: The resource you were looking for could not be found.
schema:
$ref: '#/components/schemas/error'
'401':
description: Authentication Failed
content:
application/vnd.api+json:
examples:
Example:
value:
error: The access token is invalid
schema:
$ref: '#/components/schemas/error'
components:
schemas:
error:
type: object
properties:
error:
type: string
required:
- error
x-internal: false
resources_list:
type: object
properties:
data:
type: array
items:
allOf:
- $ref: '#/components/schemas/resource_properties'
meta:
type: object
properties:
count:
type: integer
total_count:
type: integer
total_pages:
type: integer
required:
- count
- total_count
- total_pages
links:
type: object
properties:
self:
type: string
next:
type: string
prev:
type: string
last:
type: string
first:
type: string
required:
- self
- next
- prev
- last
- first
required:
- data
- meta
- links
x-internal: false
resource:
type: object
properties:
data:
$ref: '#/components/schemas/resource_properties'
required:
- data
x-internal: false
ErrorResponse:
type: object
properties:
error:
type: object
properties:
code:
type: string
example: record_not_found
message:
type: string
example: Record not found
details:
type: object
description: Field-specific validation errors
nullable: true
example:
name:
- is too short
- is required
email:
- is invalid
required:
- code
- message
required:
- error
example:
error:
code: validation_error
message: Validation failed
details:
name:
- is too short
email:
- is invalid
resource_properties:
type: object
properties:
id:
type: string
type:
type: string
attributes:
type: object
relationships:
type: object
required:
- id
- type
- attributes
x-internal: false
securitySchemes:
api_key:
type: apiKey
name: x-spree-api-key
in: header
description: Secret API key for admin access
bearer_auth:
type: http
scheme: bearer
bearerFormat: JWT
description: JWT token for admin user authentication
x-tagGroups:
- name: Authentication
tags:
- Authentication
- name: Products & Catalog
tags:
- Products
- Variants
- Option Types
- Custom Fields
- Channels
- name: Pricing
tags:
- Pricing
- Markets
- name: Orders & Fulfillment
tags:
- Orders
- Payments
- Fulfillments
- Refunds
- name: Customers
tags:
- Customers
- Customer Groups
- name: Promotions & Gift Cards
tags:
- Promotions
- Gift Cards
- name: Data
tags:
- Exports
- name: Configuration
tags:
- Settings
- Stock Locations
- Payment Methods
- Staff
- API Keys
- Allowed Origins
- Webhooks