# Set up payments with AddCheckout

You are an AI coding agent. Set up subscription payments for the app in this project with AddCheckout (https://addcheckout.com).
AddCheckout creates the plans, prices, pricing page and checkout on the owner's own Stripe account. The owner approves every change.

Do every step yourself: run the commands, call the tools and edit the code. Do not hand the user a list of commands. Stop and ask the user only for the steps that need them: signing in, approving, and adding a secret to their environment.

## Rules

- You cannot approve anything. AddCheckout emails the owner a link to a private approval page. Never ask the user for a code, a password or a Stripe key.
- Stay in test mode. Call `request_go_live` only when the user asks for real payments.
- All amounts are integers in minor units: 1200 = $12.00.
- Never tell the user a change is live until `get_status` shows it.
- Do not read, print or commit secret keys.

## Steps

1. **Connect the MCP server.** If you already have the `addcheckout` tools (for example `get_started`), skip this step.
   - Server URL: `https://addcheckout.com/mcp` (Streamable HTTP with OAuth; no key).
   - Claude Code: run `claude mcp add --transport http addcheckout https://addcheckout.com/mcp`. Then ask the user to type `/mcp`, pick addcheckout and choose Authenticate.
   - Cursor: add `{"mcpServers": {"addcheckout": {"url": "https://addcheckout.com/mcp"}}}` to `.cursor/mcp.json`.
   - VS Code: add `{"servers": {"addcheckout": {"type": "http", "url": "https://addcheckout.com/mcp"}}}` to `.vscode/mcp.json`.
   - Codex: run `codex mcp add addcheckout --url https://addcheckout.com/mcp`, then `codex mcp login addcheckout`.
   - Other clients: https://addcheckout.com/docs/install
   - If the tools do not appear, the client may need a restart. Tell the user that in one line.
2. **Learn the model.** Call `get_started`. It returns the catalog schema, an example and the current state.
3. **Find what to charge for.** Read the codebase: the features worth gating, existing plan names, and how users are identified. If the user has not said how to charge, ask once, in plain words (for example "$12 a month or $99 a year, with a 14-day trial").
4. **Propose the catalog.** Call `propose_catalog` with the whole catalog. Use entitlement keys that match the features in the code (for example `pro`, `export_csv`). Fix every error and propose again. Show the warnings to the user.
5. **Preview.** Call `preview_orders` with 2-4 realistic orders. Show the user each summary.
6. **Ask for approval.** Call `request_publish` with the draft and the orders you previewed. Tell the user to check their email. The request expires after 24 hours.
7. **Add access checks to the app.** Call `integration_guide` with the framework you found (`nextjs`, `express` or `generic`). Add the code it returns: install `@addcheckout/sdk`, gate the features with `entitlements(userId).has(...)`, and add upgrade and "manage billing" actions. Use the app's own user id as the customer id.
8. **Environment.** The app needs `ADDCHECKOUT_SECRET_KEY` (from the dashboard at https://addcheckout.com/dashboard) and `ADDCHECKOUT_URL=https://addcheckout.com`. Add the names to `.env.example`. Ask the user to put the real key in their environment themselves.
9. **Test.** After the owner approves (check with `get_status`), make a test checkout with `create_checkout_link` in test mode, or open the pricing page. In Stripe test mode the card 4242 4242 4242 4242 works. Then call `check_entitlement` for that customer.

## Finish with a status report

End your turn with this report, filled in:

```
AddCheckout setup
- MCP server connected: yes / no
- Catalog: version <n>, <draft | published>
- Approval: <pending, sent to <masked email> | approved | rejected: <reason>>
- Pricing page: <url or "opens after approval">
- App code changed: <files>
- Environment: ADDCHECKOUT_SECRET_KEY <set by the user | still needed>
- Test checkout: <done for <customer> | not done>
- Next step for the user: <one line>
```
