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

# Settle a payment

> Settles an x402 payment using the quote ID and a signed payment authorization. The payment signature can be provided via the `PAYMENT-SIGNATURE` header or the `payment_signature` body parameter. Settlement is idempotent — submitting the same quote ID multiple times returns the existing transaction.



## OpenAPI

````yaml /openapi/source/external/payment/x402-transactions.json post /v2/x402/credit_account
openapi: 3.0.0
info:
  version: 2.0.0
  title: x402 Payment Transactions API
  contact:
    email: mission.control.squad@telnyx.com
servers:
  - url: https://api.telnyx.com
security:
  - bearerAuth: []
tags:
  - name: x402 Payment Transactions
    description: >-
      Operations for x402 cryptocurrency payment transactions. Fund your Telnyx
      account using USDC stablecoin payments via the x402 protocol.
paths:
  /v2/x402/credit_account:
    post:
      tags:
        - x402 Payment Transactions
      summary: Settle a payment
      description: >-
        Settles an x402 payment using the quote ID and a signed payment
        authorization. The payment signature can be provided via the
        `PAYMENT-SIGNATURE` header or the `payment_signature` body parameter.
        Settlement is idempotent — submitting the same quote ID multiple times
        returns the existing transaction.
      operationId: settleX402Payment
      parameters:
        - name: PAYMENT-SIGNATURE
          in: header
          description: >-
            Signed payment authorization for the quote. Alternative to providing
            `payment_signature` in the request body.
          required: false
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/X402SettleRequest'
            example:
              id: quote_abc123
              payment_signature: 0xabc123...
      responses:
        '200':
          description: Payment already settled (idempotent response)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/X402TransactionResponse'
        '201':
          description: Payment settled successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/X402TransactionResponse'
              example:
                data:
                  id: de06811a-2e43-4561-af5a-7d0a26e20aaa
                  record_type: x402_transaction
                  amount: '50.00'
                  currency: USD
                  status: settled
                  quote_id: quote_abc123
                  tx_hash: 0xabc123def456...
                  created_at: '2026-03-13T15:00:00Z'
        '400':
          description: >-
            Bad request — invalid signature, expired authorization, invalid
            nonce, or malformed payment payload
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/X402SettlementErrorResponse'
              examples:
                invalid_signature:
                  summary: Invalid payment signature
                  value:
                    errors:
                      - code: invalid_signature
                        title: Payment Failed
                        detail: >-
                          Payment failed: the payment signature is invalid.
                          Please sign a new payment authorization.
                expired_authorization:
                  summary: Expired payment authorization
                  value:
                    errors:
                      - code: expired_authorization
                        title: Payment Failed
                        detail: >-
                          Payment failed: the payment authorization has expired.
                          Please request a new quote and try again.
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errors:
                  - code: '10009'
                    title: Authentication failed
                    detail: >-
                      The required authentication headers were either invalid or
                      not included in the request.
        '403':
          description: >-
            Forbidden — x402 payments not enabled, account tier ineligible, or
            account suspended
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errors:
                  - code: '10010'
                    title: Authorization failed
                    detail: >-
                      You do not have permission to perform the requested action
                      on the specified resource or resources.
        '422':
          description: >-
            Unprocessable entity — missing required parameters or insufficient
            funds/allowance
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/X402SettlementErrorResponse'
              examples:
                validation_error:
                  summary: Missing required parameter
                  value:
                    errors:
                      - code: unknown
                        title: Invalid request
                        detail: id is required
                insufficient_balance:
                  summary: Insufficient wallet balance
                  value:
                    errors:
                      - code: insufficient_balance
                        title: Payment Failed
                        detail: >-
                          Payment failed: your wallet does not have enough USDC
                          to complete this transaction. Please add funds and try
                          again.
        '500':
          description: >-
            Internal server error — facilitator unavailable, transaction failed
            on-chain, or unknown error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/X402SettlementErrorResponse'
              example:
                errors:
                  - code: transaction_failed
                    title: Payment Failed
                    detail: >-
                      Payment transaction failed on-chain. Your funds have not
                      been transferred. Please try again or contact support.
        '502':
          description: Bad gateway — upstream settlement service error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errors:
                  - code: '10007'
                    title: Unexpected error
                    detail: An unexpected error occured.
        '503':
          description: Service unavailable — facilitator or settlement timeout
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/X402SettlementErrorResponse'
              example:
                errors:
                  - code: facilitator_timeout
                    title: Payment Failed
                    detail: >-
                      Payment processing timed out. Your funds have not been
                      transferred. Please try again.
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Telnyx from 'telnyx';

            const client = new Telnyx({
              apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
            });

            const response = await client.x402.creditAccount.settle({
              id: 'quote_abc123',
              payment_signature: '0xabc123...',
            });

            console.log(response.data);
        - lang: Python
          source: |
            import os
            from telnyx import Telnyx

            client = Telnyx(
                api_key=os.environ.get("TELNYX_API_KEY"),  # This is the default and can be omitted
            )
            response = client.x402.credit_account.settle(
                id="quote_abc123",
                payment_signature="0xabc123...",
            )
            print(response.data)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/team-telnyx/telnyx-go\"\n\t\"github.com/team-telnyx/telnyx-go/option\"\n)\n\nfunc main() {\n\tclient := telnyx.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.X402.CreditAccount.Settle(context.TODO(), telnyx.X402CreditAccountSettleParams{\n\t\tID:               \"quote_abc123\",\n\t\tPaymentSignature: telnyx.String(\"0xabc123...\"),\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Data)\n}\n"
        - lang: Java
          source: >-
            package com.telnyx.sdk.example;


            import com.telnyx.sdk.client.TelnyxClient;

            import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;

            import
            com.telnyx.sdk.models.x402.creditaccount.CreditAccountSettleParams;

            import
            com.telnyx.sdk.models.x402.creditaccount.CreditAccountSettleResponse;


            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    TelnyxClient client = TelnyxOkHttpClient.fromEnv();

                    CreditAccountSettleParams params = CreditAccountSettleParams.builder()
                        .id("quote_abc123")
                        .build();
                    CreditAccountSettleResponse response = client.x402().creditAccount().settle(params);
                }
            }
        - lang: Ruby
          source: |-
            require "telnyx"

            telnyx = Telnyx::Client.new(api_key: "My API Key")

            response = telnyx.x402.credit_account.settle(id: "quote_abc123")

            puts(response)
        - lang: PHP
          source: >-
            <?php


            require_once dirname(__DIR__) . '/vendor/autoload.php';


            use Telnyx\Client;

            use Telnyx\Core\Exceptions\APIException;


            $client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API
            Key');


            try {
              $response = $client->x402->creditAccount->settle(
                id: 'quote_abc123',
                paymentSignature: '0xabc123...',
                headerPaymentSignature: 'PAYMENT-SIGNATURE',
              );

              var_dump($response);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            telnyx x402:credit-account settle \
              --api-key 'My API Key' \
              --id quote_abc123
components:
  schemas:
    X402SettleRequest:
      type: object
      required:
        - id
      properties:
        id:
          type: string
          description: The quote ID to settle.
        payment_signature:
          type: string
          description: >-
            Base64-encoded signed payment authorization (x402 PaymentPayload).
            Can alternatively be provided via the PAYMENT-SIGNATURE header.
    X402TransactionResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            id:
              type: string
              description: Unique transaction identifier.
            record_type:
              type: string
              enum:
                - x402_transaction
            amount:
              type: string
              description: The transaction amount in the specified currency.
            currency:
              type: string
              description: The currency of the transaction amount (e.g. USD).
            status:
              type: string
              description: The settlement status of the transaction.
              enum:
                - settled
            quote_id:
              type: string
              description: The original quote ID associated with this transaction.
            tx_hash:
              type: string
              nullable: true
              description: The on-chain transaction hash, if available.
            created_at:
              type: string
              format: date-time
              description: ISO 8601 timestamp when the transaction was created.
    X402SettlementErrorResponse:
      type: object
      description: >-
        Error response for x402 settlement failures. Uses string error codes
        from the x402 error handling system.
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
                description: Machine-readable error code.
                enum:
                  - invalid_signature
                  - expired_authorization
                  - invalid_nonce
                  - insufficient_balance
                  - insufficient_funds
                  - insufficient_allowance
                  - facilitator_unavailable
                  - facilitator_timeout
                  - settlement_timeout
                  - transaction_failed
                  - unknown
              title:
                type: string
                description: Short error title (e.g. "Payment Failed").
              detail:
                type: string
                description: Human-readable error description with guidance.
    ErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
              title:
                type: string
              detail:
                type: string
              meta:
                type: object
                properties:
                  url:
                    type: string
              source:
                type: object
                properties:
                  pointer:
                    type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````