Spree Commerce Payment Methods API

Configured payment providers and their available types

OpenAPI Specification

spree-payment-methods-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Admin Account / Address Payment Methods 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: Payment Methods
  description: Configured payment providers and their available types
paths:
  /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.


        **Required scope:** `read_settings` (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: paymentMethods } = await client.paymentMethods.list()"
      parameters:
      - name: x-spree-api-key
        in: header
        required: true
        schema:
          type: string
      - name: Authorization
        in: header
        required: true
        schema:
          type: string
      - name: expand
        in: query
        required: false
        description: Comma-separated associations to expand. Use dot notation for nested expand (max 4 levels).
        schema:
          type: string
      - name: fields
        in: query
        required: false
        description: Comma-separated list of fields to include (e.g., name,type,active). id is always included.
        schema:
          type: string
      responses:
        '200':
          description: payment methods found
          content:
            application/json:
              example:
                data:
                - id: pm_UkLWZg9DAJ
                  name: Check
                  description: null
                  type: check
                  session_required: false
                  source_required: false
                  metadata: {}
                  active: true
                  auto_capture: null
                  storefront_visible: true
                  position: 1
                  created_at: '2026-06-12T17:24:51.507Z'
                  updated_at: '2026-06-12T17:24:51.509Z'
                  preferences: {}
                  preference_schema: []
                meta:
                  page: 1
                  limit: 25
                  count: 1
                  pages: 1
                  from: 1
                  to: 1
                  in: 1
                  previous: null
                  next: null
  /api/v3/admin/payment_methods/types:
    get:
      summary: List available payment provider types
      tags:
      - Payment Methods
      security:
      - api_key: []
        bearer_auth: []
      description: 'Returns the registered Spree::PaymentMethod subclasses that can be used to create new payment methods. Useful for populating a "Provider" dropdown in admin UIs.


        **Required scope:** `read_settings` (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: types } = await client.paymentMethods.types()"
      parameters:
      - name: x-spree-api-key
        in: header
        required: true
        schema:
          type: string
      - name: Authorization
        in: header
        required: true
        schema:
          type: string
      responses:
        '200':
          description: provider types found
          content:
            application/json:
              example:
                data:
                - type: bogus
                  label: Bogus
                  description: null
                  preference_schema:
                  - key: dummy_secret_key
                    type: password
                    default: null
                  - key: dummy_key
                    type: string
                    default: PUBLICKEY123
                - type: custom_payment_source_method
                  label: Custom Payment Source Method
                  description: null
                  preference_schema: []
  /api/v3/admin/payment_methods/{id}:
    get:
      summary: Show a payment method
      tags:
      - Payment Methods
      security:
      - api_key: []
        bearer_auth: []
      description: 'Returns a payment method by ID.


        **Required scope:** `read_settings` (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 paymentMethod = await client.paymentMethods.get('pm_UkLWZg9DAJ')"
      parameters:
      - name: x-spree-api-key
        in: header
        required: true
        schema:
          type: string
      - name: Authorization
        in: header
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: expand
        in: query
        required: false
        description: Comma-separated associations to expand. Use dot notation for nested expand (max 4 levels).
        schema:
          type: string
      - name: fields
        in: query
        required: false
        description: Comma-separated list of fields to include (e.g., name,type,active). id is always included.
        schema:
          type: string
      responses:
        '200':
          description: payment method found
          content:
            application/json:
              example:
                id: pm_UkLWZg9DAJ
                name: Check
                description: null
                type: check
                session_required: false
                source_required: false
                metadata: {}
                active: true
                auto_capture: null
                storefront_visible: true
                position: 1
                created_at: '2026-06-12T17:24:52.124Z'
                updated_at: '2026-06-12T17:24:52.126Z'
                preferences: {}
                preference_schema: []
  /api/v2/platform/payment_methods:
    get:
      summary: Return a list of Payment Methods
      tags:
      - Payment Methods
      security:
      - bearer_auth: []
      description: Returns a list of Payment Methods
      operationId: payment-methods-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: <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
        example: stores
        schema:
          type: string
      - name: filter[name]
        in: query
        description: ''
        example: Stripe
        schema:
          type: string
      responses:
        '200':
          description: Records returned
          content:
            application/vnd.api+json:
              examples:
                Example:
                  value:
                    data:
                    - id: '12'
                      type: payment_method
                      attributes:
                        name: Test
                        type: Spree::PaymentMethod
                        description: null
                        active: true
                        display_on: both
                        auto_capture: null
                        position: 1
                        created_at: '2022-11-08T19:34:47.914Z'
                        updated_at: '2022-11-08T19:34:47.916Z'
                        deleted_at: null
                        public_metadata: {}
                        private_metadata: {}
                        preferences: {}
                      relationships:
                        stores:
                          data:
                          - id: '287'
                            type: store
                    - id: '13'
                      type: payment_method
                      attributes:
                        name: Test
                        type: Spree::PaymentMethod
                        description: null
                        active: true
                        display_on: both
                        auto_capture: null
                        position: 2
                        created_at: '2022-11-08T19:34:47.923Z'
                        updated_at: '2022-11-08T19:34:47.924Z'
                        deleted_at: null
                        public_metadata: {}
                        private_metadata: {}
                        preferences: {}
                      relationships:
                        stores:
                          data:
                          - id: '287'
                            type: store
                    - id: '14'
                      type: payment_method
                      attributes:
                        name: Test
                        type: Spree::PaymentMethod
                        description: null
                        active: true
                        display_on: both
                        auto_capture: null
                        position: 3
                        created_at: '2022-11-08T19:34:47.929Z'
                        updated_at: '2022-11-08T19:34:47.930Z'
                        deleted_at: null
                        public_metadata: {}
                        private_metadata: {}
                        preferences: {}
                      relationships:
                        stores:
                          data:
                          - id: '287'
                            type: store
                    - id: '15'
                      type: payment_method
                      attributes:
                        name: Credit Card
                        type: Spree::Gateway::Bogus
                        description: null
                        active: true
                        display_on: both
                        auto_capture: null
                        position: 4
                        created_at: '2022-11-08T19:34:47.935Z'
                        updated_at: '2022-11-08T19:34:47.937Z'
                        deleted_at: null
                        public_metadata: {}
                        private_metadata: {}
                        preferences:
                          dummy_key: PUBLICKEY123
                          test_mode: true
                          server: test
                      relationships:
                        stores:
                          data:
                          - id: '287'
                            type: store
                    - id: '16'
                      type: payment_method
                      attributes:
                        name: Credit Card
                        type: Spree::Gateway::Bogus
                        description: null
                        active: true
                        display_on: both
                        auto_capture: null
                        position: 5
                        created_at: '2022-11-08T19:34:47.941Z'
                        updated_at: '2022-11-08T19:34:47.943Z'
                        deleted_at: null
                        public_metadata: {}
                        private_metadata: {}
                        preferences:
                          dummy_key: PUBLICKEY123
                          test_mode: true
                          server: test
                      relationships:
                        stores:
                          data:
                          - id: '287'
                            type: store
                    meta:
                      count: 5
                      total_count: 5
                      total_pages: 1
                    links:
                      self: http://www.example.com/api/v2/platform/payment_methods?page=1&per_page=&include=&filter[name]=
                      next: http://www.example.com/api/v2/platform/payment_methods?filter%5Bname%5D=&include=&page=1&per_page=
                      prev: http://www.example.com/api/v2/platform/payment_methods?filter%5Bname%5D=&include=&page=1&per_page=
                      last: http://www.example.com/api/v2/platform/payment_methods?filter%5Bname%5D=&include=&page=1&per_page=
                      first: http://www.example.com/api/v2/platform/payment_methods?filter%5Bname%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'
    post:
      summary: Create a Payment Method
      tags:
      - Payment Methods
      security:
      - bearer_auth: []
      description: Creates a Payment Method
      operationId: create-payment-method
      parameters:
      - name: include
        in: query
        description: 'Select which associated resources you would like to fetch, see: <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
        example: stores
        schema:
          type: string
      responses:
        '201':
          description: Record created
          content:
            application/vnd.api+json:
              examples:
                Example:
                  value:
                    data:
                      id: '24'
                      type: payment_method
                      attributes:
                        name: API Bogus
                        type: Spree::Gateway::Bogus
                        description: null
                        active: true
                        display_on: both
                        auto_capture: null
                        position: 3
                        created_at: '2022-11-08T19:34:48.527Z'
                        updated_at: '2022-11-08T19:34:48.530Z'
                        deleted_at: null
                        public_metadata: {}
                        private_metadata: {}
                        preferences:
                          dummy_key: PUBLICKEY123
                          test_mode: true
                          server: test
                      relationships:
                        stores:
                          data:
                          - id: '291'
                            type: store
                          - id: '292'
                            type: store
              schema:
                $ref: '#/components/schemas/resource'
        '422':
          description: Invalid request
          content:
            application/vnd.api+json:
              examples:
                Example:
                  value:
                    error: Name can't be blank
                    errors:
                      name:
                      - can't be blank
              schema:
                $ref: '#/components/schemas/validation_errors'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/create_payment_method_params'
  /api/v2/platform/payment_methods/{id}:
    get:
      summary: Return a Payment Method
      tags:
      - Payment Methods
      security:
      - bearer_auth: []
      description: Returns a Payment Method
      operationId: show-payment-method
      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: <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
        example: stores
        schema:
          type: string
      responses:
        '200':
          description: Record found
          content:
            application/vnd.api+json:
              examples:
                Example:
                  value:
                    data:
                      id: '30'
                      type: payment_method
                      attributes:
                        name: Credit Card
                        type: Spree::Gateway::Bogus
                        description: null
                        active: true
                        display_on: both
                        auto_capture: null
                        position: 4
                        created_at: '2022-11-08T19:34:48.855Z'
                        updated_at: '2022-11-08T19:34:48.857Z'
                        deleted_at: null
                        public_metadata: {}
                        private_metadata: {}
                        preferences:
                          dummy_key: PUBLICKEY123
                          test_mode: true
                          server: test
                      relationships:
                        stores:
                          data:
                          - id: '295'
                            type: store
              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'
    patch:
      summary: Update a Payment Method
      tags:
      - Payment Methods
      security:
      - bearer_auth: []
      description: Updates a Payment Method
      operationId: update-payment-method
      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: <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
        example: stores
        schema:
          type: string
      responses:
        '200':
          description: Record updated
          content:
            application/vnd.api+json:
              examples:
                Example:
                  value:
                    data:
                      id: '40'
                      type: payment_method
                      attributes:
                        name: Credit Card
                        type: Spree::Gateway::Bogus
                        description: null
                        active: true
                        display_on: both
                        auto_capture: null
                        position: 3
                        created_at: '2022-11-08T19:34:49.452Z'
                        updated_at: '2022-11-08T19:34:49.687Z'
                        deleted_at: null
                        public_metadata: {}
                        private_metadata: {}
                        preferences:
                          dummy_key: UPDATED-DUMMY-KEY-123
                          test_mode: false
                          server: production
                      relationships:
                        stores:
                          data:
                          - id: '301'
                            type: store
              schema:
                $ref: '#/components/schemas/resource'
        '422':
          description: Invalid request
          content:
            application/vnd.api+json:
              examples:
                Example:
                  value:
                    error: Name can't be blank
                    errors:
                      name:
                      - can't be blank
              schema:
                $ref: '#/components/schemas/validation_errors'
        '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'
      requestBody:
        content:
          application/json:
            schema:
              oneOf:
              - $ref: '#/components/schemas/update_payment_method_params'
              - $ref: '#/components/schemas/update_payment_method_params_bogus_gateway'
    delete:
      summary: Delete a Payment Method
      tags:
      - Payment Methods
      security:
      - bearer_auth: []
      description: Deletes a Payment Method
      operationId: delete-payment-method
      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:
    create_payment_method_params:
      type: object
      properties:
        payment_method:
          type: object
          required:
          - name
          properties:
            name:
              type: string
              example: Test Payment Method
            active:
              type: boolean
            auto_capture:
              type: boolean
            description:
              type: string
              example: This is a test payment method
            type:
              type: string
              example: Spree::Gateway::Bogus
              enum:
              - Spree::Gateway::Bogus
              - Spree::PaymentMethod::Check
            display_on:
              type: string
              example: both
              enum:
              - both
              - back_end
              - front_end
            store_ids:
              type: array
              items:
                allOf:
                - type: string
                  example: '2'
            public_metadata:
              type: object
            private_metadata:
              type: object
      required:
      - payment_method
      x-internal: false
    resource_properties:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
        attributes:
          type: object
        relationships:
          type: object
      required:
      - id
      - type
      - attributes
      x-internal: false
    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
    update_payment_method_params:
      type: object
      properties:
        payment_method:
          type: object
          properties:
            name:
              type: string
              example: Test Payment Method
            active:
              type: boolean
            auto_capture:
              type: boolean
            description:
              type: string
              example: This is a test payment method
            type:
              type: string
              example: Spree::Gateway::Bogus
              enum:
              - Spree::Gateway::Bogus
              - Spree::PaymentMethod::Check
            display_on:
              type: string
              example: both
              enum:
              - both
              - back_end
              - front_end
            store_ids:
              type: array
              items:
                allOf:
                - type: string
                  example: '2'
            public_metadata:
              type: object
            private_metadata:
              type: object
      required:
      - payment_method
      x-internal: false
      title: Update Payment Method
    update_payment_method_params_bogus_gateway:
      type: object
      properties:
        payment_method:
          type: object
          properties:
            preferred_dummy_key:
              type: string
              example: UPDATED-DUMMY-KEY-123
            preferred_server:
              type: string
              example: production
            preferred_test_mode:
              type: boolean
      required:
      - payment_method
      x-internal: false
      title: Update Bogus Gateway
    resource:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/resource_properties'
      required:
      - data
      x-internal: false
    validation_errors:
      type: object
      properties:
        error:
          type: string
        errors:
          type: object
      required:
      - error
      - errors
      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