Cloudflare X402
@sntxrr/cloudflare-x402v2026.10.24.1
01README
Pay for and inspect x402-protected HTTP resources and MCP tools — the Cloudflare agents payment standard — with a local EVM wallet, plus an x402 spend report
02Behaviors
@sntxrr/cloudflare-x402v2026.10.24.1cloudflare_x402.ts
Global Arguments
| Argument | Type | Description |
|---|---|---|
| privateKey | string | EVM wallet private key (0x + 64 hex chars) used to sign x402 payments. Store in a vault, never inline. |
| maxAmountUsdc? | number | Default ceiling, in whole USDC, this wallet will auto-pay for a single request. Per-call `maxAmountUsdc` overrides it. |
| tokenDecimals? | number | Decimals of the settlement token, used to convert the USDC ceiling to base units (USDC = 6). |
| timeoutSeconds? | number | Default time limit, in seconds, for each HTTP request including its response body. Per-call `timeoutSeconds` overrides it. |
fn probe(url: string, method?: enum, headers?: record, timeoutSeconds?: number, requestId?: string)
Inspect an x402 resource's price by reading its 402 challenge, without paying
| Argument | Type | Description |
|---|---|---|
| url | string | |
| method? | enum | |
| headers? | record | |
| timeoutSeconds? | number | Override the model's default per-request time limit for this call. |
| requestId? | string | Instance name for the stored quote (default 'quote', distinct from pay's 'payment' so a probe never becomes the latest version of a payment). Use distinct values to keep separate quotes. Avoid the reserved name 'latest'. |
fn pay(url: string, method?: enum, headers?: record, body?: string, maxAmountUsdc?: number, timeoutSeconds?: number, requestId?: string)
Fetch an x402-protected resource, auto-paying the required USDC via the configured wallet
| Argument | Type | Description |
|---|---|---|
| url | string | |
| method? | enum | |
| headers? | record | Extra request headers (e.g. Content-Type). The payment header (X-PAYMENT for x402 v1, PAYMENT-SIGNATURE for v2) is added automatically. |
| body? | string | Raw request body string sent on both the challenge and paid attempts. |
| maxAmountUsdc? | number | Override the model's default per-request ceiling for this call. |
| timeoutSeconds? | number | Override the model's default per-request time limit for this call. |
| requestId? | string | Instance name for the stored payment record (default 'payment', distinct from probe's 'quote'). Repeated pays on one name are kept as versions and all count toward spend. Avoid the reserved name 'latest'. |
Resources
payment(infinite)— Result of a paid x402 request, including the on-chain settlement receipt
quote(infinite)— Payment requirements advertised by an x402 resource, captured without paying
03Reports
@sntxrr/x402-spendmodel
x402_spend.ts
Summarize x402 spend for a wallet — total USDC, breakdown by network and resource, and settlement rate
paymentsfinopsx402
04Previous Versions
2026.10.14.1MIT(was none)
Declare SPDX license (MIT) in manifest.
2026.09.29.3
2026.09.29.2
2026.09.29.1
2026.07.18.2
2026.07.18.1
2026.07.17.1
05Stats
A
100 / 100
Downloads
38
Archive size
59.6 KB
- Has README or module doc2/2earned
- README has a code example1/1earned
- README is substantive1/1earned
- Most symbols documented1/1earned
- No slow types (deprecated)1/1earned
- Dependencies pass trust audit2/2earned
- Docs keep secrets in a vault1/1earned
- Has description1/1earned
- Platform support declared (or universal)2/2earned
- License2/2earned
- Verified public repository2/2earned
06Platforms
07Labels