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

# Payment Methods

> Retrieve all available payment gateways with their configuration hints

<Warning>
  This endpoint is currently shown as a preview of what's currently in development and is subject to change.
</Warning>


## OpenAPI

````yaml api-reference/pre-release/openapi-spec-preview.yaml get /checkout/payment-methods
openapi: 3.0.3
info:
  title: CoCart Preview API
  description: >
    CoCart Preview provides enhanced REST API endpoints for WooCommerce headless
    e-commerce solutions.

    This API extends CoCart with additional functionality for checkout, customer
    account management, and order handling.


    ## Authentication


    The API supports multiple authentication methods:

    - **Cart Key**: For guest customers, pass the cart key via `Cart-Key` header
    or `cart_key` parameter

    - **Basic Auth**: For registered customers using username/password

    - **JWT**: For registered customers using JWT tokens (requires JWT plugin)

    - **Session**: For logged-in WordPress users


    ## Base URL


    All API endpoints are prefixed with `/wp-json/cocart/preview/`


    ## Response Format


    All responses follow the CoCart standard format with consistent error
    handling and data structure.
  termsOfService: http://cocartapi.com/terms-of-conditions-polar/
  contact:
    email: support@cocartapi.com
  license:
    name: GNU General Public License v3.0
    url: http://www.gnu.org/licenses/gpl-3.0.html
  version: 0.0.1
servers:
  - url: '{protocol}://{host}/wp-json/cocart/preview'
    description: API Preview
    variables:
      protocol:
        enum:
          - http
          - https
        default: https
      host:
        default: example-store.com
        description: Your store domain
security: []
tags:
  - name: Checkout
    description: Complete checkout process including payment and order creation
  - name: My Account
    description: Customer account information and profile management
  - name: My Orders
    description: Customer order history and details
  - name: My Downloads
    description: Customer digital downloads
  - name: My Subscriptions
    description: Customer subscription management
externalDocs:
  description: Find out more about CoCart API
  url: https://docs.cocartapi.com
paths:
  /checkout/payment-methods:
    get:
      tags:
        - Checkout
      summary: Get available payment methods
      description: Retrieve all available payment gateways with their configuration hints
      operationId: getPaymentMethods
      responses:
        '200':
          description: Payment methods retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentMethods'
              examples:
                paymentMethods:
                  $ref: '#/components/examples/PaymentMethodsExample'
        '401':
          description: Unauthorized - authentication required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    PaymentMethods:
      type: object
      additionalProperties:
        $ref: '#/components/schemas/PaymentMethod'
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Error code identifier
        message:
          type: string
          description: Human-readable error message
        data:
          type: object
          description: Additional error data
          properties:
            status:
              type: integer
              description: HTTP status code
    PaymentMethod:
      type: object
      properties:
        id:
          type: string
          description: Payment method ID
        title:
          type: string
          description: Payment method title
        description:
          type: string
          description: Payment method description
        supports:
          type: array
          items:
            type: string
          description: Supported features
        has_fields:
          type: boolean
          description: Whether method has input fields
        order_button_text:
          type: string
          description: Order button text
        method_title:
          type: string
          description: Method title
        method_description:
          type: string
          description: Method description
        saved_tokens:
          type: array
          items:
            $ref: '#/components/schemas/PaymentToken'
          description: Customer's saved payment tokens for this gateway
        supports_save_payment:
          type: boolean
          description: Whether this gateway supports saving payment methods
        config:
          $ref: '#/components/schemas/PaymentMethodConfig'
    PaymentToken:
      type: object
      properties:
        id:
          type: integer
          description: Payment token ID
        token:
          type: string
          description: Token display name (e.g., "Visa ending in 4242")
        type:
          type: string
          enum:
            - cc
            - echeck
          description: Token type
        gateway_id:
          type: string
          description: Payment gateway ID
        is_default:
          type: boolean
          description: Whether this is the default payment method
        expires:
          type: string
          nullable: true
          description: Expiration date (MM/YYYY format)
          example: 12/2025
    PaymentMethodConfig:
      type: object
      properties:
        test_mode:
          type: boolean
          description: Whether gateway is in test mode
        is_connected:
          type: boolean
          description: Whether gateway is properly configured
        supports_tokenization:
          type: boolean
          description: Whether gateway supports tokenization
        supports_refunds:
          type: boolean
          description: Whether gateway supports refunds
        supports_subscriptions:
          type: boolean
          description: Whether gateway supports subscriptions
        requires_billing_address:
          type: boolean
          description: Whether gateway requires billing address
  examples:
    PaymentMethodsExample:
      value:
        stripe:
          id: stripe
          title: Credit Card (Stripe)
          description: Pay securely with your credit card
          supports:
            - products
            - refunds
            - subscriptions
          has_fields: true
          order_button_text: Pay Now
          method_title: Stripe
          method_description: Accept credit card payments via Stripe
          config:
            test_mode: true
            is_connected: true
            supports_tokenization: true
            supports_refunds: true
            supports_subscriptions: true
            requires_billing_address: true
        paypal:
          id: paypal
          title: PayPal
          description: Pay via PayPal
          supports:
            - products
            - refunds
          has_fields: false
          order_button_text: Proceed to PayPal
          method_title: PayPal
          method_description: Accept payments via PayPal
          config:
            test_mode: false
            is_connected: true
            supports_tokenization: false
            supports_refunds: true
            supports_subscriptions: false
            requires_billing_address: false

````