Tenzro
Tutorial — Payments

Pay with x402

x402 is Coinbase's stateless HTTP 402 protocol. The SDK's payX402 entry point fetches the challenge, signs the EIP-3009 transferWithAuthorization via the bound EVM wallet, and replays the request through the Coinbase CDP facilitator.
Level
Intermediate
Time
~20 min
Prerequisites
EVM wallet with USDC
Stack
TypeScript · EVM
01

Server returns a 402 with x402 fields

The challenge includes the amount, asset, recipient, and a 32-byte nonce.

HTTP/1.1 402 Payment Required
Payment-Protocol: x402
x402-Asset: USDC
x402-Amount: 0.50
x402-Recipient: 0xabc...
02

Pay via the node

The SDK takes the resource URL and the payer DID; the node signs the EIP-3009 authorization and submits through the facilitator.

import { TenzroClient } from "tenzro-sdk";
const client = new TenzroClient({ endpoint: "https://rpc.tenzro.network" });

const receipt = await client.payment.payX402(
  "https://api.example.com/data",
  "did:tenzro:machine:agent-1",
);
console.log("settled:", receipt);
03

List the supported x402 schemes

The node ships tenzro-hybrid, exact-eip3009, permit2, and erc7710 schemes — server-side PaymentRequirement.extra.scheme selects between them.

const schemes = await client.payment.listX402Schemes();
console.log(schemes);
04

Inspect the on-chain transfer

The returned receipt carries the settlement transaction hash. Resolve it on the EVM chain to confirm USDC has moved.

const tx = await client.getTransaction(receipt.tx_hash);
console.log(tx);
Related
← All tutorials