skills/algorand-x402-typescript/SKILL.md
Builds x402 HTTP-native payment applications on Algorand using TypeScript. Covers clients (fetch, axios), servers (Express, Hono), facilitators, paywalls, Next.js integration, and the @x402-avm core library. Use when implementing x402 payment flows in TypeScript, creating payment-gated APIs, building x402 facilitators or paywalls, or integrating @x402-avm packages.
npx skillsauth add algorand-devrel/algorand-agent-skills algorand-x402-typescriptInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Build x402 HTTP-native payment applications on Algorand with TypeScript. Use the reference files below for detailed guidance on each component.
# Core + AVM mechanism
npm install @x402-avm/core @x402-avm/avm algosdk
# Server middleware (pick one)
npm install @x402-avm/express # Express.js
npm install @x402-avm/hono # Hono
npm install @x402-avm/next # Next.js
# Client (pick one)
npm install @x402-avm/fetch # Fetch API
npm install @x402-avm/axios # Axios
Every component registers the AVM exact scheme unconditionally — no environment variable guards:
// Client
import { registerExactAvmScheme } from "@x402-avm/avm/exact/client";
registerExactAvmScheme(client, { signer });
// Server
import { registerExactAvmScheme } from "@x402-avm/avm/exact/server";
registerExactAvmScheme(server);
// Facilitator
import { registerExactAvmScheme } from "@x402-avm/avm/exact/facilitator";
registerExactAvmScheme(facilitator, { signer, networks: ALGORAND_TESTNET_CAIP2 });
TypeScript algosdk works with raw Uint8Array directly — no conversion needed. This matches the @txnlab/use-wallet ecosystem standard. Encoding/decoding to/from base64 happens only at protocol boundaries (PAYMENT-SIGNATURE header serialization).
Navigate to the appropriate reference based on your task. Each topic has three files:
{name}.md — Step-by-step implementation guide{name}-reference.md — API details and type signatures{name}-examples.md — Complete, runnable code samplesUnderstand @x402-avm/* TypeScript package structure, signer interfaces (ClientAvmSigner, FacilitatorAvmSigner), registration patterns, builder patterns, constants, and utilities.
Build HTTP clients with Fetch or Axios that automatically handle 402 payments. Covers wrapFetchWithPayment, wrapAxiosWithPayment, ClientAvmSigner for browser wallets or Node.js private keys.
Build payment-protected servers with Express.js or Hono middleware. Covers route pricing, multi-network support (AVM+EVM+SVM), 402 responses, and dynamic pricing.
Build fullstack Next.js apps with x402 payment protection using paymentProxy and withX402. Covers App Router integration, middleware-level protection, and per-endpoint control.
Build facilitator services that verify and settle Algorand payments on-chain. Covers FacilitatorAvmSigner, Express.js facilitator servers, and Bazaar discovery extension for API cataloging (bazaarResourceServerExtension, withBazaar, declare_discovery_extension on servers).
Build browser paywall UIs with server-side middleware and client-side wallet integration (Pera, Defly, Lute). Covers PaywallBuilder, avmPaywall, multi-network paywalls.
Use @x402-avm/core and @x402-avm/avm packages directly for custom integrations. Covers payment policies, AVM signer interfaces, transaction groups, fee abstraction, and low-level primitives.
| Package | Purpose |
| ------- | ------- |
| @x402-avm/fetch | Wrap fetch with automatic 402 payment handling |
| @x402-avm/axios | Wrap axios with automatic 402 payment handling |
| @x402-avm/express | Express.js payment middleware |
| @x402-avm/hono | Hono payment middleware |
| @x402-avm/next | Next.js payment middleware and route wrappers |
| @x402-avm/paywall | Browser paywall UI components |
| @x402-avm/core | Core protocol primitives (client, server, facilitator) |
| @x402-avm/avm | AVM mechanism (signers, transaction builders, constants) |
{name}.md file for step-by-step implementation guidance{name}-reference.md for API details{name}-examples.md for complete, runnable code samplestools
Guide for writing TypeScript code with AlgoKit Utils (`@algorandfoundation/algokit-utils`). Use this skill whenever the user is building on Algorand with TypeScript — client setup, account management, payments, asset operations, atomic transaction groups, smart contract deployment and interaction (AppFactory, AppClient, ARC-56/ARC-32 specs), raw app calls, key registration, network management, testing with algorandFixture, error handling, and the low-level crypto primitives under `@algorandfoundation/algokit-utils/crypto` (Ed25519 keygen/signing/verification, SHA-512/256 `hash`, Peikert xHD BIP44 wallets, wrapped-secret patterns). Trigger on imports from `@algorandfoundation/algokit-utils` (incl. `/crypto`, `/testing`, `/transact` subpaths), references to `AlgorandClient`, `AppFactory`, `AppClient`, `AlgoAmount`, `algorandFixture`, `ed25519Generator`, `peikertXHdWalletGenerator`, `hash`, `WrappedEd25519Seed`, or `RawEd25519Signer`. Also on any TypeScript or JavaScript code that builds on Algorand.
tools
Guide for writing Python code with AlgoKit Utils (`algokit-utils`). Use this skill whenever the user is building on Algorand with Python — client setup, account management, payments, ASA operations, atomic transaction groups, smart contract deployment and interaction (AppFactory, AppClient, ARC-56/ARC-32 specs), raw app calls, TEAL compilation, key registration, network management, error handling, and the low-level crypto primitives in `algokit_crypto` (Ed25519 keygen/signing/verification, Peikert xHD BIP44 wallets, wrapped-secret patterns) and `algokit_common` (`sha512_256`). Trigger on imports from `algokit_utils` or `algokit_crypto`, references to `AlgorandClient`, `AppFactory`, `AppClient`, `AlgoAmount`, `ed25519_generator`, `peikert_hd_wallet_generator`, `sha512_256`, `WrappedEd25519Seed`, or `RawEd25519Signer`, or any Python code that builds on Algorand.
tools
Builds x402 HTTP-native payment applications on Algorand using Python. Covers clients (httpx, requests), servers (FastAPI, Flask), facilitators, Bazaar discovery, and the x402-avm core library. Use when implementing x402 payment flows in Python, creating payment-gated APIs, building x402 facilitators, or integrating x402-avm packages.
tools
--- name: algorand-typescript description: Develops Algorand smart contracts in TypeScript using Algorand TypeScript (PuyaTs). Covers contract syntax, AVM types, storage patterns, transactions, ABI methods, testing, deployment, and AlgoKit Utils. Use when: (1) writing or modifying .algo.ts smart contracts, (2) using uint64, bytes, GlobalState, BoxMap, LocalState, itxn, gtxn in contracts, (3) testing contracts with algorandFixture/Vitest, (4) deploying or calling contracts with typed clients, (5)