M2M Payments Sample App
An open source sample app for machine-to-machine payments on Crossmint wallets.
The M2M Payments Sample App shows how to give an AI agent a wallet it can pay other machines from. A user tops up a non-custodial wallet by card, in "credits" (1 credit = 1 USD), with no KYC. The user approves the agent once. The agent then pays x402 endpoints and MPP endpoints on its own, in the background, and can transfer credits or send transactions when asked.
It is the machine-to-machine twin of the Agent Commerce sample app: the same site, the same five experiences, the same auth, the same package layout. Cards and checkouts are replaced by a wallet, an onramp and two payment protocols. It wraps the Crossmint wallets and onramp APIs and adds the parts Crossmint does not ship: the approval screen, the top-up screen, the agent tooling, and the glue between them.
What do I use?
| You have | You want | Install | Copy |
|---|
| A web app with users | Users fund a wallet and let your agent pay from it | @m2m-payments/core @m2m-payments/server @m2m-payments/ui | the /app screens from apps/web |
| An agent in Claude Code, ChatGPT, or a chat channel | A hosted place where users approve and top up, plus agent tooling | Deploy apps/web. Give agents m2m-payments or the MCP URL | Nothing. Configure and deploy |
| Your own auth (Auth0, Clerk, Supabase) | All of the above with your login | Implement UserAuth from @m2m-payments/auth | packages/auth/src/stytch.ts as a template |
| Your own backend | Only the typed wallet client and the x402 and MPP payers | @m2m-payments/core | Nothing |
| A chat product | Approve access and top up inline in the conversation | @m2m-payments/ui + @m2m-payments/server in process | components/chat and api/chat from apps/web |
| A paid API | An endpoint that charges agents over x402 or MPP | Nothing | api/demo/x402 and api/demo/mpp from apps/web |
Packages
| Package | What it is |
|---|
@m2m-payments/core | Types, the credits token and the shared tool docs. @m2m-payments/core/server: Crossmint wallets and orders client, x402 and MPP payers. |
@m2m-payments/auth | One UserAuth interface. Stytch adapter. Generic JWKS adapter. OAuth PKCE helpers. |
@m2m-payments/server | The HTTP API as Web-standard request handlers. Mounts in one Next.js route file at /api/m2m-payments. |
@m2m-payments/ui | React components: the wallet, approve agent access, top up, activity. |
@m2m-payments/mcp | MCP server exposing the API as tools, with OAuth 2.1. |
@m2m-payments/cli | The CLI, installed as m2m-payments. Same surface as MCP, for terminal agents and humans. |
skills/m2m-payments | A skill that teaches coding agents how to use the CLI. |
plugins/cursor | Cursor plugin: the hosted MCP server, the skill, and a payments rule. Also loads in Grok Bot. |
plugins/claude | Claude Code plugin: the same MCP server and skill. Install with /plugin marketplace add Crossmint/m2m-payments-sample-app. |