> ## 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.

# Pay an invoice

> Processes a payment for a specific invoice using a Stripe payment method.



## OpenAPI

````yaml https://api.salesbricks.com/api/v2/openapi.yaml post /invoices/{invoice_id}/pay
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:
  /invoices/{invoice_id}/pay:
    post:
      tags:
        - Invoices
      summary: Pay an invoice
      description: >-
        Processes a payment for a specific invoice using a Stripe payment
        method.
      operationId: payInvoice
      parameters:
        - in: path
          name: invoice_id
          schema:
            type: string
            pattern: ^([a-zA-Z\d\-]+)$
          required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PayInvoiceRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/PayInvoiceRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/PayInvoiceRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Payment'
          description: ''
        '202':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayInvoiceRequires3DSResponse'
          description: ''
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: ''
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                NotFoundResponse:
                  value:
                    error:
                      code: ERR_NOT_FOUND
                      message: >-
                        Not found — the resource you are looking for does not
                        exist.
                  summary: Not Found Response
          description: ''
components:
  schemas:
    PayInvoiceRequest:
      type: object
      properties:
        payment_method_id:
          type: string
          description: The Stripe payment method ID to use for this payment
        auto_pay_invoices:
          type: boolean
          nullable: true
          description: Whether to enable auto-pay for future invoices
      required:
        - payment_method_id
    Payment:
      type: object
      properties:
        payment_id:
          type: string
          format: uuid
          readOnly: true
          description: Unique identifier for the payment
        invoice_number:
          type: string
          nullable: true
          readOnly: true
          description: >-
            The invoice number this payment was made against, snapshotted from
            the invoice version current when the payment was recorded — it does
            not change when the invoice is later regenerated, so it may differ
            from the invoice's top-level `invoice_number`. Falls back to the
            invoice's current number when no version is linked. Join payments to
            invoices by ID, not by number.
        invoice_version_id:
          type: string
          format: uuid
          readOnly: true
          nullable: true
          description: >-
            Identifier of the invoice version this payment was made against —
            the version current when the payment was recorded. Null only when
            the invoice has no versions (it was never generated).
        paid_amount:
          type: integer
          readOnly: true
          nullable: true
          description: The amount paid
        paid_at:
          type: string
          format: date-time
          readOnly: true
          nullable: true
          description: the date at which this payment was paid
        currency:
          type: string
          readOnly: true
          description: The currency in which the payment is denominated (e.g., USD, EUR)
        error:
          type: string
          readOnly: true
          nullable: true
          description: Any errors that occured during this payment processing
      required:
        - currency
        - error
        - invoice_number
        - invoice_version_id
        - paid_amount
        - paid_at
        - payment_id
    PayInvoiceRequires3DSResponse:
      type: object
      properties:
        status:
          enum:
            - requires_action
          type: string
          x-spec-enum-id: 7e535ed5c5cd74af
          description: >-
            Payment status — 'requires_action' indicates 3DS authentication is
            needed


            * `requires_action` - Requires Action
        stripe_payment_intent_client_secret:
          type: string
          description: Stripe PaymentIntent client secret for completing 3DS authentication
        stripe_account_id:
          type: string
          description: Stripe connected account ID
      required:
        - status
        - stripe_account_id
        - stripe_payment_intent_client_secret
    ErrorResponse:
      type: object
      description: >-
        Standardizes API error responses with a consistent structure containing
        error code and message.
      properties:
        error:
          $ref: '#/components/schemas/Error'
      required:
        - error
    Error:
      type: object
      description: >-
        Represents individual error details with a standardized code and
        descriptive message.
      properties:
        code:
          enum:
            - ERR_NOT_FOUND
            - ERR_BAD_REQUEST
            - ERR_SERVER_ERROR
          type: string
          x-spec-enum-id: dc5a5d6feae1b697
          description: >-
            Error code indicating the type of error: NOT_FOUND for missing
            resources, BAD_REQUEST for invalid input, SERVER_ERROR for internal
            server issues


            * `ERR_NOT_FOUND` - ERR_NOT_FOUND

            * `ERR_BAD_REQUEST` - ERR_BAD_REQUEST

            * `ERR_SERVER_ERROR` - ERR_SERVER_ERROR
        message:
          type: string
        error_id:
          type: string
          format: uuid
          description: >-
            Correlation handle for SERVER_ERROR responses — quote this when
            contacting support; it joins to the structured server log line for
            the failure. Not present on 4xx responses.
      required:
        - code
        - message
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-SALESBRICKS-KEY
      description: API key for authentication

````

## Related topics

- [invoice.payment.failed](/api-reference/webhooks/invoice/payment/failed.md)
- [invoice.payment.succeeded](/api-reference/webhooks/invoice/payment/succeeded.md)
- [Invoice Webhook Payload](/api-reference/webhooks/invoice/payload.md)
