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

# Create a payment method

> Turns a succeeded payment method session into a payment method your server can charge. When the session named a customer, the card or bank account is verified with the processor and saved on their file (`usage: saved`), a bank account together with the standing ACH authorization its holder accepted; otherwise it can be charged once, soon (`usage: one_time`). The tokenized details never appear in the response.



## OpenAPI

````yaml /api-reference/openapi-v1.json post /payment-methods
openapi: 3.1.0
info:
  title: Payra API
  version: v1
  description: >-
    The Payra API. Authenticate with a secret key: `Authorization: Bearer
    sk_test_...`. The two payment method session endpoints Payra Elements calls
    also take a publishable key with the session's `client_secret`.
servers:
  - url: https://api-dashboard.payra.com/v1
    description: 'Sandbox and live: the key decides which'
security: []
paths:
  /payment-methods:
    post:
      tags:
        - Payment methods
      summary: Create a payment method
      description: >-
        Turns a succeeded payment method session into a payment method your
        server can charge. When the session named a customer, the card or bank
        account is verified with the processor and saved on their file (`usage:
        saved`), a bank account together with the standing ACH authorization its
        holder accepted; otherwise it can be charged once, soon (`usage:
        one_time`). The tokenized details never appear in the response.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                session:
                  type: string
                  minLength: 1
                  maxLength: 64
                  example: pms_test_7Hs2kQ9mL1pXv4cR8tWzAbCd
                  description: >-
                    A session of yours that has succeeded. Each session creates
                    one payment method.
                account_holder_authorization:
                  type: boolean
                  example: true
                  description: >-
                    Required, and `true`, when a card session named a customer:
                    your attestation that the cardholder agreed to keep the card
                    on file. Not used for a bank account: the account holder
                    accepted the ACH authorization in Payra Elements.
              required:
                - session
      responses:
        '201':
          description: The payment method
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentMethod'
        '400':
          description: >-
            Invalid parameters, a session that has not succeeded or already
            created a method, an expired card, or the payment method type not
            configured
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Missing, invalid or revoked API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '402':
          description: The processor refused to verify the card or the bank account
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: The API is not enabled for the workspace, or the key lacks the scope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Rate limit exceeded; see Retry-After
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  schemas:
    PaymentMethod:
      type: object
      properties:
        object:
          type: string
          enum:
            - payment_method
        id:
          type: string
          example: pm_test_9kQ2mL7Hs1pXv4cR8tWzAbCdEf
        type:
          type: string
          enum:
            - card
            - us_bank_account
          example: card
        usage:
          type: string
          enum:
            - one_time
            - saved
          example: saved
          description: >-
            `saved` when the session named a customer: the instrument is vaulted
            and stays on their file. `one_time` otherwise: chargeable once,
            before `expires_at`.
        status:
          type: string
          enum:
            - active
            - consumed
            - expired
            - detached
          example: active
        customer:
          type:
            - string
            - 'null'
          format: uuid
          example: null
        session:
          type: string
          example: pms_test_7Hs2kQ9mL1pXv4cR8tWzAbCd
          description: The session the card was collected in.
        card:
          $ref: '#/components/schemas/PaymentMethodCard'
        us_bank_account:
          $ref: '#/components/schemas/PaymentMethodBankAccount'
        billing_details:
          $ref: '#/components/schemas/PaymentMethodBillingDetails'
        livemode:
          type: boolean
          example: false
        expires_at:
          type:
            - string
            - 'null'
          format: date-time
          example: null
          description: Set on a one-time method.
        created_at:
          type: string
          format: date-time
          example: '2026-09-18T14:00:00.000Z'
      required:
        - object
        - id
        - type
        - usage
        - status
        - customer
        - session
        - card
        - us_bank_account
        - billing_details
        - livemode
        - expires_at
        - created_at
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            type:
              type: string
              enum:
                - invalid_request_error
                - authentication_error
                - permission_error
                - rate_limit_error
                - idempotency_error
                - card_error
                - api_error
            code:
              type: string
            message:
              type: string
            param:
              type: string
            request_id:
              type: string
          required:
            - type
            - code
            - message
            - request_id
          additionalProperties:
            type: string
      required:
        - error
    PaymentMethodCard:
      type:
        - object
        - 'null'
      properties:
        brand:
          type:
            - string
            - 'null'
          example: visa
        last4:
          type: string
          example: '4242'
        exp_month:
          type: integer
          example: 12
        exp_year:
          type: integer
          example: 2030
        funding:
          type:
            - string
            - 'null'
          enum:
            - credit
            - debit
          example: credit
          description: Known once the card is saved; null on a one-time method.
      required:
        - brand
        - last4
        - exp_month
        - exp_year
        - funding
      description: Set when `type` is `card`.
    PaymentMethodBankAccount:
      type:
        - object
        - 'null'
      properties:
        last4:
          type: string
          example: '6789'
        account_type:
          type: string
          enum:
            - checking
            - savings
          example: checking
        account_holder_type:
          type: string
          enum:
            - individual
            - company
          example: individual
      required:
        - last4
        - account_type
        - account_holder_type
      description: Set when `type` is `us_bank_account`.
      example: null
    PaymentMethodBillingDetails:
      type: object
      properties:
        name:
          type: string
          example: Ada Lovelace
          description: The name on the card or the account.
        postal_code:
          type:
            - string
            - 'null'
          example: '94110'
      required:
        - name
        - postal_code
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        A secret key, `sk_test_...` or `sk_live_...`; a publishable key
        (`pk_...`) on the browser routes only

````