name: payment-flow
description: Pay for and call APIs using the x402 stablecoin payment protocol
version: "1.0"
author: GateFlow
tags: [payment, x402, usdc, stablecoin]

instructions: |
  The x402 payment flow works in 3 steps:
  1. Call the API endpoint — receive 402 Payment Required with payment options
  2. Send USDC on-chain to the treasury address (Base is cheapest at ~$0.001 gas)
  3. Retry the request with X-Payment-Hash, X-Payment-Chain, X-Agent-Wallet headers

  No SDK required — any HTTP client works. Free trial calls available (3 per endpoint).

tools:
  - name: call_api
    description: Call a GateFlow API endpoint. First call returns 402 with payment instructions.
    endpoint: /v1/{slug}
    method: GET
    headers:
      - name: X-Payment-Hash
        description: Transaction hash proving on-chain payment (after paying)
      - name: X-Payment-Chain
        description: Chain used for payment (base, arbitrum, optimism, solana, etc.)
      - name: X-Agent-Wallet
        description: Your wallet address (for attribution and reputation)

  - name: check_health
    description: Check if the proxy is healthy before sending payments
    endpoint: /health
    method: GET

payment_networks:
  - chain: base
    gas_estimate: "$0.001"
    recommended: true
  - chain: arbitrum
    gas_estimate: "$0.001"
  - chain: optimism
    gas_estimate: "$0.001"
  - chain: solana
    gas_estimate: "$0.0005"
  - chain: polygon
    gas_estimate: "$0.005"
  - chain: ethereum
    gas_estimate: "$2.00"
    note: "Expensive — use L2s instead"
