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

# Setup a payment method

> Creates a Stripe SetupIntent for adding payment methods to a subscription. Returns the necessary Stripe credentials to initialize the payment form. Supports card, bank account, and SEPA direct debit payment methods.



## OpenAPI

````yaml https://api.salesbricks.com/api/v2/openapi.yaml post /customers/{customer_id}/payment-methods
openapi: 3.0.3
info:
  title: Salesbricks REST API
  version: 2.0.0
  description: API reference for external integrations
servers:
  - url: https://api.salesbricks.com/api/v2
    description: Production
  - url: https://api.staging.salesbricks.com/api/v2
    description: Staging
security:
  - ApiKeyAuth: []
tags:
  - name: Subscriptions
    description: >-
      Operations related to subscription management, including creation,
      updates, and retrieving subscription details. Subscriptions can be
      upgraded to add / remove add-ons by using the POST
      /subscriptions/{subscription_id}/upgrade endpoint and can be recasted for
      replacing the current agreement using the POST
      /subscriptions/{subscription_id}/recast endpoint
  - name: Customers
    description: >-
      Operations related to customer management, including creation, updates,
      and managing customer person objects.
  - name: Invoices
    description: Operations related to subscription's invoicing details.
  - name: Plans
    description: >-
      Operations related to listing and getting plan details including bricks in
      the plan.
  - name: Payment Methods
    description: Operations related to subscription's payment method.
paths:
  /customers/{customer_id}/payment-methods:
    post:
      tags:
        - Payment Methods
      summary: Setup a payment method
      description: >-
        Creates a Stripe SetupIntent for adding payment methods to a
        subscription. Returns the necessary Stripe credentials to initialize the
        payment form. Supports card, bank account, and SEPA direct debit payment
        methods.
      operationId: setupPaymentMethod
      parameters:
        - in: path
          name: customer_id
          schema:
            type: string
            pattern: ^([a-zA-Z\d\-]+)$
          required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentMethodSetup'
              examples:
                SampleSetupResponse:
                  value:
                    stripe_account_id: acct_1ABC123def456789
                    client_secret: seti_1ABC123def456789_secret_xyz789
                    publishable_key: pk_test_ABC123def456789xyz
                    customer_session_client_secret: cuss_1ABC123def456789_secret_xyz789
                  summary: Sample Setup Response
          description: ''
components:
  schemas:
    PaymentMethodSetup:
      type: object
      description: >-
        Serializer for the payment method setup response containing Stripe
        credentials

        needed to initialize payment forms.
      properties:
        stripe_account_id:
          type: string
          description: The tenant's connected Stripe account ID
        client_secret:
          type: string
          description: Client secret for creating a payment intent within Stripe Elements
        publishable_key:
          type: string
          description: Salesbricks' platform public key for Stripe
        customer_session_client_secret:
          type: string
          description: >-
            Client secret for the customer session to enable payment element
            features
      required:
        - client_secret
        - customer_session_client_secret
        - publishable_key
        - stripe_account_id
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-SALESBRICKS-KEY
      description: API key for authentication

````

## Related topics

- [Setup](/integrations/stripe/setup.md)
- [Private Integration Setup](/integrations/okta/private-integration.md)
- [Your email notifications](/documentation/your-email-notifications.md)
