generate_x402_challenge
Generate HTTP 402 Payment Required responses to gate resources with on-chain crypto payments. Creates payment challenges for Algorand, VOI, Hedera, and Stellar networks.
Instructions
Generate an x402 (spec v1) 402 Payment Required response for gating a resource. Returns the X-Payment-Required header value and full payload. The client must pay on-chain and re-send with X-Payment: , then verify with verify_x402_proof.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| resource | Yes | Resource URL or identifier being gated. | |
| amount_microunits | Yes | Amount in asset micro-units (1 USDC = 1_000_000). | |
| network | No | Network to accept. Defaults to algorand_mainnet. | |
| expires_in_seconds | No | Challenge TTL in seconds; default 300. | |
| description | No | Optional human-readable description shown in the payment prompt. |