Skip to content
Developer
Sign inSign up

AI agents

Set up with Claude Code, Codex or any coding agent: one prompt, every page as Markdown, and rules for your repository.

Ask AI about this page

Set up with a coding agent

Set up 402pay for me, follow the instructions on developer.402pay.co/quickstart

It points the agent at the quickstart, which takes it from a new account to a fulfilled order. Every page here has its own prompt under its title, for the part you're building.

Give your agent the docs

Every page here is also plain Markdown, which agents read best. Point an agent at the index and it finds the rest on its own.

WhereWhat it holds
llms.txtEvery page, a line about each, linked to its Markdown. Start here.
llms-full.txtEvery page's Markdown in one file, for an agent that reads it all at once.
Any page + .mdOne page as Markdown: add .md to its URL, or /index.md for the overview.

Above each page's title, Copy page copies its Markdown for a prompt or a ticket, and Ask AI opens ChatGPT, Claude or Perplexity already told to read it.

Add rules to your repository

Coding agents read standing instructions from a file in your repository, such as AGENTS.md or CLAUDE.md. Add this section to yours, so every session follows the rules that keep keys and payments safe. llms.txt carries the same rules.

AGENTS.mdMarkdown
## 402pay - Read developer.402pay.co/llms.txt for the index of the 402pay docs. Any docs page is Markdown at its URL plus `.md`.- Keep the secret key on the server, in the `PAY402_SECRET_KEY` environment variable. Never put it in browser or mobile code, logs or the repository.- Authenticate with `Authorization: Bearer <secret key>`. Every path in the docs is relative to the base URL, `https://api.402pay.co/api/v1`.- There is no test mode: every payment is real and moves real money, so use small amounts while building.- Create payments on the server with `POST /payments` and send the customer to the `url` it returns.- Send amounts as decimal strings in the payment's currency, such as `"49.00"`. A JSON number is refused.- Pass your order's ID as `reference`, so a retried create returns the same payment instead of making a second one.- Fulfill orders on the `payment.succeeded` webhook, never on the redirect to `success_url`: a customer can close the tab before it loads.- Verify every webhook's signature on the raw body before parsing it (Standard Webhooks: `webhook-id`, `webhook-timestamp`, `webhook-signature`), and refuse deliveries more than five minutes old.- Send an `Idempotency-Key` header where an endpoint requires one, such as `POST /checkouts`, and retry with the same key.- An agent that calls the API itself gets a restricted key with only the access it needs, never the business's full key.

Check what it built

Before you ship what an agent wrote, check the parts that move money.

0 of 5 done

  • It's read from PAY402_SECRET_KEY and appears nowhere in browser code, mobile code or the repository. Search for 402s_live_ to be sure.
  • Nothing ships on the redirect to success_url alone; the payment.succeeded handler does the work.
  • The handler checks the signature on the raw body and refuses old deliveries.
  • Each create passes the order's ID as reference, so a retry returns the payment that already exists.
  • There is no test mode, so pay a small amount end to end and see the delivery under Developers, then Webhooks.

Let an agent use the API

Any agent that can make HTTP requests can work with 402pay directly. Create a restricted secret key with only the access the agent needs, such as write on links and read on payments, give it to the agent through its environment, and point it at these docs.

Create a link
curl -X POST "https://api.402pay.co/api/v1/links" \  -H "Authorization: Bearer $PAY402_SECRET_KEY" \  -H "Content-Type: application/json" \  -d '{    "name": "Pro plan",    "amount": "49.00",    "currency": "USD"  }'

What to ask

  • "Create a $49 payment link for the Pro plan."
  • "Which payments are underpaid right now?"
  • "What's my USDC balance on Solana?"
Money never moves on an API key. An agent can read your wallet's balances, but sends happen only in the dashboard, signed in your browser with your encryption password.
An agent with a key acts as your business within that key's access. Only give keys to agents you trust, and revoke the key when you stop using it.

MCP server

An MCP server is coming soon. When it's ready, any client that speaks the Model Context Protocol will be able to create payment links and check payments through 402pay. It isn't available yet, so there's nothing to connect today; the API and these docs are how agents work with 402pay now.