> ## Documentation Index
> Fetch the complete documentation index at: https://spreecommerce.org/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a Payment Method

> Creates a Payment Method



## OpenAPI

````yaml /api-reference/platform.yaml post /api/v2/platform/payment_methods
openapi: 3.0.3
info:
  title: Platform API
  contact:
    name: Vendo Connect Inc.
    url: https://getvendo.com
    email: sales@getvendo.com
  description: Spree Platform API
  version: v2
servers:
  - url: http://{defaultHost}
    variables:
      defaultHost:
        default: localhost:3000
security: []
tags:
  - name: Addresses
  - name: Adjustments
  - name: Classifications
  - name: Countries
  - name: CMS Pages
  - name: CMS Sections
  - name: Digital Assets
  - name: Digital Links
  - name: Line Items
  - name: Menus
  - name: Menu Items
  - name: Option Types
  - name: Option Values
  - name: Orders
  - name: Payments
  - name: Payment Methods
  - name: Products
  - name: Promotions
  - name: Promotion Actions
  - name: Promotion Categories
  - name: Promotion Rules
  - name: Roles
  - name: Shipments
  - name: Shipping Categories
  - name: Shipping Methods
  - name: States
  - name: Stock Items
  - name: Stock Locations
  - name: Store Credit Categories
  - name: Store Credit Types
  - name: Store Credits
  - name: Tax Categories
  - name: Tax Rates
  - name: Taxons
  - name: Taxonomies
  - name: Users
  - name: Variants
  - name: Vendors
  - name: Webhook Events
  - name: Webhook Subscribers
  - name: Wishlists
  - name: Wished Items
  - name: Zones
paths:
  /api/v2/platform/payment_methods:
    post:
      tags:
        - Payment Methods
      summary: Create a Payment Method
      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
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/create_payment_method_params'
      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'
      security:
        - bearer_auth: []
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:
      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
    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:
    bearer_auth:
      type: http
      scheme: bearer

````