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

# Save a Payment Method

> Create a $0 card-on-file checkout session for an account. Stripe `setup` mode saves a payment method without charging anything or starting a subscription; the saved card becomes the account's default and is what credit purchases and auto top-up charge. The card is saved on the account's Stripe customer that already holds a default card, or the newest tagged customer; a customer is created (and tagged with the account id) if none exists yet. Returns a hosted checkout URL that the client should redirect to. `id` may be the authenticated account or an organization the caller belongs to.



## OpenAPI

````yaml api-reference/openapi/accounts.json POST /api/accounts/{id}/payment-method
openapi: 3.1.0
info:
  title: Recoup API - Accounts
  description: >-
    API documentation for the Recoup platform - an AI agent platform for the
    music industry
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.recoupable.dev
security: []
paths:
  /api/accounts/{id}/payment-method:
    post:
      description: >-
        Create a $0 card-on-file checkout session for an account. Stripe `setup`
        mode saves a payment method without charging anything or starting a
        subscription; the saved card becomes the account's default and is what
        credit purchases and auto top-up charge. The card is saved on the
        account's Stripe customer that already holds a default card, or the
        newest tagged customer; a customer is created (and tagged with the
        account id) if none exists yet. Returns a hosted checkout URL that the
        client should redirect to. `id` may be the authenticated account or an
        organization the caller belongs to.
      parameters:
        - name: id
          in: path
          description: >-
            The unique identifier (UUID) of the account. Must be the
            authenticated account or another accessible via organization
            membership.
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        description: Card-on-file session parameters
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCardOnFileSessionRequest'
      responses:
        '200':
          description: Card-on-file session created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateSubscriptionSessionResponse'
        '400':
          description: Bad request - missing or invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountPaymentMethodErrorResponse'
              example:
                error: successUrl must be a valid URL
        '401':
          description: Unauthorized - invalid or missing authentication
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountPaymentMethodErrorResponse'
              example:
                error: Unauthorized
        '403':
          description: >-
            Forbidden - the account is not the caller's and not an organization
            they belong to (an unknown id also returns 403, never 404)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountPaymentMethodErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountPaymentMethodErrorResponse'
              example:
                error: Internal server error
      security:
        - apiKeyAuth: []
        - bearerAuth: []
components:
  schemas:
    CreateCardOnFileSessionRequest:
      type: object
      required:
        - successUrl
      properties:
        successUrl:
          type: string
          format: uri
          description: The URL Stripe redirects to after the card is saved.
          example: https://chat.recoupable.dev?card=saved
    CreateSubscriptionSessionResponse:
      type: object
      required:
        - id
        - url
      properties:
        id:
          type: string
          description: The checkout session ID.
          example: cs_test_a1b2c3d4e5f6g7h8i9j0
        url:
          type: string
          format: uri
          description: The hosted checkout URL. Redirect to this URL to complete Checkout.
          example: https://checkout.stripe.com/pay/cs_test_a1b2c3d4e5f6g7h8i9j0
    AccountPaymentMethodErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Human-readable error message.
          example: Unauthorized
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Your Recoup API key. [Learn more](/quickstart#api-keys).
    bearerAuth:
      type: http
      scheme: bearer

````