{"slug": "how-to-charge-a-subscription-in-an-ai-built-app-and-unlock-features-only-for-who", "title": "How to charge a subscription in an AI-built app and unlock features only for those who paid", "summary": "Ciro Cesar Maciel released Payments, an infrastructure product that lets AI-built apps charge subscriptions through the developer's own Stripe account while gating features by entitlement rather than plan. The system organizes projects, gateways, plans and features so the app checks whether a user has a specific feature such as advanced-reports, with a React SDK (PaymentsProvider, Pricing, FeatureControl, PortalButton) and a server-side /sdk/v1/permissions endpoint that returns active subscription status and unlocked features. Maciel stresses that client-side feature checks only control the interface, and the paid resource itself must be refused on the server: \"That one line on the server is the difference between a paywall and a hidden button.", "body_md": "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.\n\nThis is the path with Payments, from the Infrastructure line (by Ciro Cesar Maciel, who writes this).\n\nA **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.\n\nRecurring 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.\n\n`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.`sk_test_…`) connects, answers everything with success and charges no one. `@ciromaciel/payments-react`, a `PaymentsProvider` with the project's public key, your own stable `userId` and the customer's e-mail. Then `<Pricing>` for the plans (subscribers change plans through the portal, never a second checkout), `<FeatureControl featureId=\"...\">` with a `fallback`, and `<PortalButton>` for card, invoices and cancellation.\nAnything 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.\n\nThat one line on the server is the difference between a paywall and a hidden button.\n\nUpgrades 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.", "url": "https://wpnews.pro/news/how-to-charge-a-subscription-in-an-ai-built-app-and-unlock-features-only-for-who", "canonical_source": "https://dev.to/ciromaciel/how-to-charge-a-subscription-in-an-ai-built-app-and-unlock-features-only-for-those-who-paid-4bf8", "published_at": "2026-11-18 10:09:48+00:00", "updated_at": "2026-11-18 10:13:35.077670+00:00", "lang": "en", "topics": ["ai-tools", "developer-tools", "ai-products"], "entities": ["Ciro Cesar Maciel", "Payments", "Stripe", "@ciromaciel/payments-react", "myinfrastructure.click"], "also_reported_by": [], "takeaway": "Gate paid features by entitlement ID (e.g. advanced-reports) checked server-side via /sdk/v1/permissions, since client-side FeatureControl only hides UI and leaves the route open.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/how-to-charge-a-subscription-in-an-ai-built-app-and-unlock-features-only-for-who", "markdown": "https://wpnews.pro/news/how-to-charge-a-subscription-in-an-ai-built-app-and-unlock-features-only-for-who.md", "text": "https://wpnews.pro/news/how-to-charge-a-subscription-in-an-ai-built-app-and-unlock-features-only-for-who.txt", "jsonld": "https://wpnews.pro/news/how-to-charge-a-subscription-in-an-ai-built-app-and-unlock-features-only-for-who.jsonld"}}