The app the AI helped you build has users, and now you want to charge. The agent usually proposes wiring Stripe directly: products, checkout, a webhook endpoint, subscription state in your database, a check on every screen. It works, but those pieces have to agree with each other. And the classic mistake of an app built in a hurry is hiding the paid button in the frontend while the server route stays open.
This is the path with Payments, from the Infrastructure line (by Ciro Cesar Maciel, who writes this).
The pieces, in one sentence
A project holds gateways; each gateway holds plans; a customer subscribes to a plan and gets the features linked to it. The app never asks "which plan is this user on?". It asks "does this user have advanced-reports?". Changing what each plan includes needs no code change.
Recurring billing happens in your Stripe account: the money, the invoices and the receipts live there. Payments organizes plans, follows subscriptions through Stripe's events and tells the app who can do what.
Step by step
- Documentation for the agent. Paste
https://myinfrastructure.click/products/payments/llms.txt. No account yet? The agent creates it and the project itself; you only read the e-mail code. - Connect Stripe and create plans. Add your Stripe key as a gateway. Creating a plan in Payments also creates it in Stripe (name, price, currency, monthly or yearly). Then, under Features, create the names the app will check and link them to plans. Careful: a Stripe test key (
sk_test_…) connects, answers everything with success and charges no one. Test connection tells you which environment the gateway is in. - The webhook, which cannot be missing. Without it, Stripe charges and nobody knows: the subscription never shows up, and the app keeps treating the person as unpaid. Configure automatically registers the address in Stripe. The events that matter: checkout completed, invoice paid, payment failed, subscription updated, subscription deleted.
- What the agent writes.
@ciromaciel/payments-react, aPaymentsProviderwith the project's public key, your own stableuserIdand the customer's e-mail. Then<Pricing>for the plans (subscribers change plans through the portal, never a second checkout),<FeatureControl featureId="...">with afallback, and<PortalButton>for card, invoices and cancellation.
The check that actually protects
Anything in the browser can be changed by whoever is in the browser. FeatureControl and useHasFeature are for the interface: hide, show, invite to upgrade. The paid thing itself (the export, the report, the expensive call) must be refused on the server. Before delivering it, your backend asks for the user's permissions at /sdk/v1/permissions, which returns whether there is an active subscription and which features are unlocked.
That one line on the server is the difference between a paywall and a hidden button.
Plan changes
Upgrades apply at once and Stripe charges the prorated difference. Downgrades, or yearly to monthly, apply at the end of the paid period. The new plan arrives by webhook and the permissions follow.
Honest notes
- You need a Stripe account; Payments does not hold the money.
- No MRR or churn, no financial report, no coupons, no trial of its own: those are Stripe's.
- Subscriptions are Stripe only. One-off charges also exist, by card or Pix (Brazil).
- No server SDK: backends call the HTTP API with the project's secret key.
- An MCP server lets an agent read the project, gateways, plans and subscriptions with your browser sign-in.
- The Payments dashboard is in Portuguese for now.
