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

# Pay an invoice

> Starts or completes payment, depending on `method`:

- `credit` — converts the total to GBP at the current rate, deducts it from the credit balance, records the payment and
  settles the invoice immediately. 400 if the balance is short; 503 if no exchange rate is available.
- `stripe` (default when cards are on) — creates a Stripe Checkout session and a pending payment; redirect to `url`.
  409 when card payments are switched off.
- `crypto` (`nowpayments`, `heleket`, `paykilla` accepted as aliases) — creates an inline payment on the active gateway for
  the coin in `toCurrency` and a pending payment row. 400 if no gateway is configured or `toCurrency` is missing.

With cards off and no `method`, returns 400 listing `availableMethods`. Paid → 400; cancelled/refunded or inside an open
combined invoice → 409. Drafts return 404. Requires a complete billing address (428). An invalid JSON body is treated as
empty. Unexpected failures return 500 with the underlying error message.



## OpenAPI

````yaml /api-reference/openapi.yaml post /v1/client/invoices/{id}/pay
openapi: 3.1.0
info:
  title: Server.Express API
  version: 1.0.0
  description: >-
    The customer-facing Server.Express API: auth, billing, tickets, cloud and
    dedicated servers, hosting, reselling and account management. Every response
    uses the `{ success, data | error }` envelope.
  contact:
    name: Server.Express
    url: https://server.express
servers:
  - url: https://my.server.express/api
    description: Production
security:
  - bearerAuth: []
  - apiToken: []
tags:
  - name: API Tokens
  - name: Account
  - name: Auth
  - name: Cloud
  - name: Coupons
  - name: Credits
  - name: Dashboard
  - name: Dedicated
  - name: Health
  - name: Hosting
  - name: Integrations
  - name: Invoices
  - name: Livechat
  - name: Notifications
  - name: Passkeys
  - name: Payments
  - name: Products
  - name: Public
  - name: Public Invoices
  - name: Public Tools
  - name: Reseller
  - name: SSH Keys
  - name: Services
  - name: Tasks
  - name: Teams
  - name: Tickets
  - name: Web Hosting
  - name: Webhooks
paths:
  /v1/client/invoices/{id}/pay:
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          format: uuid
    post:
      tags:
        - Invoices
      summary: Pay an invoice
      description: >-
        Starts or completes payment, depending on `method`:


        - `credit` — converts the total to GBP at the current rate, deducts it
        from the credit balance, records the payment and
          settles the invoice immediately. 400 if the balance is short; 503 if no exchange rate is available.
        - `stripe` (default when cards are on) — creates a Stripe Checkout
        session and a pending payment; redirect to `url`.
          409 when card payments are switched off.
        - `crypto` (`nowpayments`, `heleket`, `paykilla` accepted as aliases) —
        creates an inline payment on the active gateway for
          the coin in `toCurrency` and a pending payment row. 400 if no gateway is configured or `toCurrency` is missing.

        With cards off and no `method`, returns 400 listing `availableMethods`.
        Paid → 400; cancelled/refunded or inside an open

        combined invoice → 409. Drafts return 404. Requires a complete billing
        address (428). An invalid JSON body is treated as

        empty. Unexpected failures return 500 with the underlying error message.
      operationId: publicClientPayInvoice
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                method:
                  type: string
                  enum:
                    - stripe
                    - credit
                    - crypto
                    - nowpayments
                    - heleket
                    - paykilla
                toCurrency:
                  type: string
                  description: >-
                    Required for crypto. NowPayments-style ticker, e.g. btc or
                    usdttrc20.
                network:
                  type: string
                  description: Accepted but currently unused.
      responses:
        '200':
          description: Payment started (stripe, crypto) or completed (credit).
          content:
            application/json:
              schema:
                type: object
                required:
                  - success
                  - data
                properties:
                  success:
                    type: boolean
                    const: true
                  data:
                    oneOf:
                      - type: object
                        required:
                          - method
                          - paid
                          - deductedGbp
                        properties:
                          method:
                            type: string
                            const: credit
                          paid:
                            type: boolean
                            const: true
                          deductedGbp:
                            type: integer
                            description: Credit taken, GBP minor units.
                      - type: object
                        required:
                          - method
                          - url
                        properties:
                          method:
                            type: string
                            const: stripe
                          url:
                            type:
                              - string
                              - 'null'
                            format: uri
                            description: Stripe Checkout URL.
                      - $ref: '#/components/schemas/PublicClientCryptoPayment'
        '400':
          description: >-
            Already paid, short of credit, no crypto gateway, no coin chosen,
            unsupported method, or no method while cards are off.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ErrorResponse'
                  - type: object
                    properties:
                      data:
                        type: object
                        properties:
                          availableMethods:
                            type: array
                            items:
                              type: string
                              enum:
                                - credit
                                - crypto
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: >-
            Invoice is closed or covered by a combined invoice, or card payments
            are switched off.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicClientInvoiceBlockedError'
        '428':
          description: The account has no complete billing address yet.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicClientBillingDetailsRequired'
        '500':
          $ref: '#/components/responses/ServerError'
        '503':
          description: >-
            No exchange rate to convert GBP credit into the invoice currency
            right now.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearerAuth: []
        - apiToken: []
components:
  schemas:
    PublicClientCryptoPayment:
      type: object
      required:
        - method
        - gateway
        - paymentId
        - address
        - payerAmount
        - payerCurrency
        - network
        - extraId
        - expiresAt
        - paymentStatus
        - checkoutUrl
      properties:
        method:
          type: string
          const: crypto
        gateway:
          type: string
          enum:
            - paykilla
            - nowpayments
        paymentId:
          type: string
          description: Gateway payment id — pass it to GET /pay?paymentId= to poll.
        address:
          type:
            - string
            - 'null'
          description: >-
            Deposit address to pay to. Null when the customer finishes on the
            gateway's page instead.
        payerAmount:
          type:
            - number
            - 'null'
        payerCurrency:
          type:
            - string
            - 'null'
        network:
          type:
            - string
            - 'null'
        extraId:
          type:
            - string
            - 'null'
          description: Memo/tag some chains require alongside the address.
        expiresAt:
          type:
            - string
            - 'null'
          format: date-time
        paymentStatus:
          type: string
          description: NowPayments vocabulary, whichever gateway answered.
        checkoutUrl:
          type:
            - string
            - 'null'
          format: uri
          description: Set when the customer pays on the gateway's own page (PayKilla).
    ErrorResponse:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          const: false
        error:
          type: string
          description: Human-readable error message.
      additionalProperties: true
    PublicClientInvoiceBlockedError:
      type: object
      description: >-
        When the invoice is inside an open combined invoice, `data` names the
        one to pay instead.
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          const: false
        error:
          type: string
        data:
          type: object
          properties:
            payInsteadInvoiceId:
              type: string
              format: uuid
            payInsteadInvoiceNumber:
              type: string
    PublicClientBillingDetailsRequired:
      type: object
      description: >-
        428 Precondition Required — add the listed billing fields before
        ordering or paying.
      required:
        - success
        - error
        - data
      properties:
        success:
          type: boolean
          const: false
        error:
          type: string
        data:
          type: object
          required:
            - billingDetailsRequired
            - missing
          properties:
            billingDetailsRequired:
              type: boolean
              const: true
            missing:
              type: array
              items:
                type: string
                enum:
                  - addressLine1
                  - city
                  - postcode
                  - country
                  - companyName
  responses:
    Unauthorized:
      description: Missing, invalid or expired credentials.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Forbidden:
      description: >-
        Authenticated but not allowed (missing scope, not an admin, or not your
        resource).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFound:
      description: The resource doesn't exist or isn't visible to you.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    ServerError:
      description: Unexpected server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Session access token (JWT) from POST /v1/auth/login or /v1/auth/refresh.
        A session satisfies every API scope.
    apiToken:
      type: http
      scheme: bearer
      bearerFormat: se_live_<prefix>_<secret>
      description: >-
        Personal API token created under Settings → API tokens. Only routes
        guarded by verifyApiAuth accept it, and the token must carry the scope
        named in the operation's x-required-scope.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.