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

# Execute cross-chain relay payment

> HTTPayer relay service for x402 cross-chain payments.

**Flow:**
1. **First call (no X-Payment header)**: Returns 402 with payment instructions
2. **Second call (with X-Payment header)**: Executes relay payment flow

**Supports:**
- Cross-chain payments (EVM ↔ Solana)
- Same-chain payments (EVM → EVM, Solana → Solana)
- Automatic network selection based on target API (mainnet/testnet)

**Fee Structure:**
- HTTPayer charges a flat 3% relay fee on top of the target API's requested payment amount.
- Example: For a \$0.10 target payment, fee = \$0.003, total = \$0.103  
- Daily limits: \$100 per wallet, \$1000 system-wide




## OpenAPI

````yaml post /relay
openapi: 3.0.0
info:
  title: HTTPayer Proxy API
  version: 1.0.0
  description: >-
    HTTPayer is a payment router for 402 response codes and the x402 Protocol.
    Users can access APIs that use the x402 standard through the HTTPayer proxy.
  contact:
    name: HTTPayer Team
    url: https://httpayer.com
servers:
  - url: https://api.httpayer.com
    description: Production server
security: []
tags:
  - name: Relay
    description: Cross-chain payment relay endpoints
  - name: Account
    description: Account balance and limits endpoints
  - name: Webhooks
    description: Async task status and webhooks
  - name: LLM
    description: OpenAI-powered endpoints for translation and chat
  - name: Health
    description: Health check endpoints
paths:
  /relay:
    post:
      tags:
        - Relay
      summary: Execute cross-chain relay payment
      description: >
        HTTPayer relay service for x402 cross-chain payments.


        **Flow:**

        1. **First call (no X-Payment header)**: Returns 402 with payment
        instructions

        2. **Second call (with X-Payment header)**: Executes relay payment flow


        **Supports:**

        - Cross-chain payments (EVM ↔ Solana)

        - Same-chain payments (EVM → EVM, Solana → Solana)

        - Automatic network selection based on target API (mainnet/testnet)


        **Fee Structure:**

        - HTTPayer charges a flat 3% relay fee on top of the target API's
        requested payment amount.

        - Example: For a \$0.10 target payment, fee = \$0.003, total = \$0.103  

        - Daily limits: \$100 per wallet, \$1000 system-wide
      parameters:
        - in: header
          name: X-PAYMENT
          schema:
            type: string
          description: >-
            x402 payment header (include on second call after getting payment
            instructions)
          required: false
        - in: header
          name: X-TIMEOUT
          schema:
            type: number
          description: Client timeout in milliseconds
          required: false
        - in: query
          name: format
          schema:
            type: string
            enum:
              - json
              - text
            default: text
          description: >-
            Response mode. When set to "json", wraps the proxied response as
            JSON; otherwise returns the raw proxied response as text.
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RelayRequest'
      responses:
        '200':
          description: >
            Relay payment successful. Response headers (included only when
            applicable):

            - X-Client-Payment: Transaction hash of the user's payment to
            HTTPayer after settlement (e.g., 0x123...)

            - X-HTTPayer-Webhook: Webhook ID to track async operation status
            (payment verification or refund)

            - X-Payment-Response: Details of HTTPayer's payment to the target
            API (v1, base64-encoded JSON)
          content:
            application/json:
              schema:
                type: object
                description: Response from target API
            text/plain:
              schema:
                type: string
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '402':
          description: X-PAYMENT header is required - Returns x402 payment instructions
          content:
            application/json:
              schema:
                type: object
                properties:
                  x402Version:
                    type: number
                    example: 1
                  accepts:
                    type: array
                    items:
                      $ref: '#/components/schemas/PaymentRequirements'
        '429':
          description: >-
            Too Many Requests - Daily spending limit exceeded OR server at
            capacity
          headers:
            Retry-After:
              description: Seconds to wait before retrying (only for rate limiting)
              schema:
                type: integer
                example: 5
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    description: Rate limiting response (server at capacity)
                    properties:
                      error:
                        type: string
                        example: Too Many Requests
                      message:
                        type: string
                        example: >-
                          Server is currently processing the maximum number of
                          concurrent requests. Please try again in a moment.
                      details:
                        type: string
                        example: 'Active requests: 50/50'
                      retryAfter:
                        type: integer
                        example: 5
                  - type: object
                    description: Daily spending limit response
                    properties:
                      error:
                        type: string
                        example: Daily wallet spending limit exceeded
                      details:
                        type: string
                      currentSpend:
                        type: number
                      limit:
                        type: number
                      requestedAmount:
                        type: number
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: >-
            Bad gateway — target API returned an error or refused payment after
            retries
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: Bad Gateway
                  message:
                    type: string
                    example: Upstream API refused payment after 3 attempts
                  webhook_id:
                    type: string
                    description: >-
                      Present when background blockchain polling is active. Use
                      GET /webhooks/:id to track settlement.
                    example: 550e8400-e29b-41d4-a716-446655440000
components:
  schemas:
    RelayRequest:
      type: object
      properties:
        api_url:
          type: string
          description: The target API URL to call via the relay
          example: https://demo.httpayer.com/base-weather
        method:
          type: string
          enum:
            - GET
            - POST
            - PUT
            - DELETE
            - PATCH
          description: HTTP method for the target API
          example: GET
        json:
          type: object
          description: >-
            JSON body — serialized with Content-Type: application/json. Mirrors
            Python requests(json=...).
        data:
          description: >-
            Form-encoded body (object) or raw string body (string). Mirrors
            Python requests(data=...).
          oneOf:
            - type: object
            - type: string
        body:
          type: string
          description: >-
            Pre-serialized body string passed through unchanged — Content-Type
            is NOT set automatically. If you pass an object it will be
            JSON-stringified, but you must set Content-Type: application/json
            via headers yourself. Use json instead for automatic Content-Type
            handling.
        payload:
          type: object
          description: Deprecated alias for json. Use json instead.
        params:
          type: object
          description: Query parameters appended to the target URL
        headers:
          type: object
          description: Custom headers forwarded to the target API
          example:
            X-API-KEY: your-target-api-key
            Authorization: Bearer token123
        auth:
          type: object
          description: >-
            Basic auth shorthand — converted to Authorization: Basic <base64>.
            Mirrors Python requests(auth=(...)).
          properties:
            username:
              type: string
            password:
              type: string
        cookies:
          type: object
          description: >-
            Cookie shorthand — merged into the Cookie header. Mirrors Python
            requests(cookies={...}).
          example:
            session: abc123
        network:
          type: string
          enum:
            - base
            - base-sepolia
            - skale-base
            - skale-base-sepolia
            - solana
            - solana-mainnet-beta
            - solana-devnet
          description: Blockchain network to use for payment
          example: base
      required:
        - api_url
        - method
    Error:
      type: object
      properties:
        error:
          type: string
          description: Error message
        details:
          type: string
          description: Additional error details
    PaymentRequirements:
      type: object
      properties:
        scheme:
          type: string
          example: exact
        network:
          type: string
          example: base
        payTo:
          type: string
          description: Recipient address
        asset:
          type: string
          description: Token contract address
        maxAmountRequired:
          type: string
          description: Amount in microUSDC
        resource:
          type: string
          description: Resource URL
        description:
          type: string
        mimeType:
          type: string
          example: application/json
        maxTimeoutSeconds:
          type: number
          example: 180

````