Skip to main content
Tutorials

How to Add Stripe Payments to an AI Generated App

GenMB injects a billing SDK into any generated app that needs payments. Take your first $500 without touching Stripe onboarding, then connect your own Stripe account and keep 95% of every charge.

Ambuj Agrawal

Ambuj Agrawal

Founder

7 min read

Most AI app builders stop at the buy button. You get a nice-looking pricing section, and then you find out the payment part is homework: create a Stripe account, get keys, write a checkout endpoint, handle webhooks, reconcile the ledger.

GenMB does that part. Any generated app can charge real money through window.genmb.billing, and the first $500 of revenue per workspace runs without you signing up for anything.

What the billing SDK gives a generated app

When the capability detector picks up payment intent in your prompt (a paywall, a buy button, a donation, a subscription tier), GenMB injects the Billing SDK into the app. No API keys in your code, no Stripe.js script tag, no server route to write. The methods available at window.genmb.billing:

  • ready() - wait for SDK init, called once at app start
  • checkout({ amount, currency, productName, successUrl?, cancelUrl?, endUserEmail? }) - open Stripe Checkout for a one-time payment
  • subscribe({ amount, currency, interval, productName }) - create a monthly or yearly subscription
  • openPortal({ returnUrl }) - open the Stripe Customer Portal so your customer can change a card or cancel
  • reportUsage({ subscriptionItemId, quantity }) - record metered usage
  • verifySession(sessionId) - confirm server-side that a Checkout Session actually paid
  • getCustomer() and onCustomerChange(cb) - read and subscribe to end-user billing state

Amounts are in major units: 9.99 means $9.99. The SDK converts to cents before it hits the backend.

verifySession matters more than it looks. A successUrl redirect is a URL a customer can type by hand. Call verifySession(sessionId) when the app comes back from Stripe, and only then hand over the thing they paid for.

Managed mode: the first $500

New workspaces start in managed mode. Charges run on GenMB's platform Stripe account, capped at $500 lifetime per workspace. That exists for one reason: so you can ship a paid feature and watch a real card go through before anyone asks you for a business address and a bank account.

What managed mode does and does not do:

  • One-time payments only. Subscriptions require Stripe Connect, because an indefinite recurring liability on a platform account cannot be bounded by a lifetime cap.
  • Your business name does not appear on customer statements yet. Charges show GenMB's descriptor.
  • Refunds are manual, through support.
  • Revenue sits in GenMB's Stripe account until you connect, and settlement is manual. Connect before you launch publicly.

The cap is enforced by a reserve-then-settle lock, not a count after the fact. A reservation is taken when the Checkout Session is created and confirmed by the charge.succeeded webhook, released on payment failure, and swept every 15 minutes if the customer abandons the tab. Two concurrent checkouts cannot push a workspace past the cap between them.

Past the cap, the SDK throws CONNECT_REQUIRED with an onboardUrl on the error object, so your app can show the right message instead of a generic failure.

Connected mode: Stripe Connect Express and the 5% fee

When you connect, GenMB creates a Stripe Connect Express account for the workspace and Stripe runs the KYC. After that, every charge becomes a Direct Charge on your account with a 5% application_fee_amount attached. The remaining 95% is yours, and Stripe pays it out to your bank on whatever schedule you configure.

Connected mode is what turns the app into a business:

  • Recurring subscriptions, monthly or yearly
  • The Stripe Customer Portal for your end-users
  • Metered subscriptions billed at period end
  • Refunds, disputes and payouts handled in your own Stripe dashboard
  • Your business name, descriptor and dispute contact on customer statements

GenMB does not hold or settle funds in connected mode. Stripe does.

The exact steps in the editor

  1. Open your app and go to the Billing tab in the GenMB Cloud panel. Billing is workspace-scoped, so the tab shows the status for the workspace the app belongs to.
  2. Ask GenMB in chat to build the paid feature. "Add a $5 paid PDF download" or "Make the Pro tier $9 a month" is enough for the detector to inject the SDK.
  3. Flip on test mode if you want to rehearse. Test mode runs checkouts on the platform test key with Stripe test cards, forces managed mode, skips the cap reservation entirely, and never counts as revenue. Subscriptions are blocked while test mode is on, since they would run against your real connected account.
  4. Take a real payment. The cap meter on the Billing tab shows how much managed capacity you have left.
  5. Click Connect Stripe and complete Express onboarding. The panel then shows two status lights, Charges and Payouts, both of which Stripe flips on when it is satisfied with your account.

What is Pro-gated

App Billing is Pro and above, and the server enforces it: a checkout or subscribe call from an app whose owner is on the free plan returns BILLING_DISABLED. On the free plan, an app owner opening the Billing tab sees an "Upgrade to enable App Billing" card with Pro and Business buttons instead of the Connect Stripe action.

Everything else in your app stays where it was. Billing is a workspace setting, not an app rewrite.

Currency support, and why it is a specific list

The SDK sends a currency code from the browser, so the backend validates it against an allowlist (BILLING_ALLOWED_CURRENCIES in api/config/constants.py). The list is every presentment currency Stripe supports, minus three groups that break the amount math:

  • Zero-decimal currencies (jpy, krw, vnd, xof, clp and eleven others) have no minor unit. The SDK multiplies your major amount by 100, so Stripe would read that integer as whole units and charge 100 times too much. jpy sat on an older hand-picked list with exactly that fault until it was removed in September 2026.
  • Three-decimal currencies (bhd, jod, kwd, omr, tnd) would charge ten times under.
  • Whole-unit currencies (huf, isk, twd) require amounts divisible by 100 minor units, which a 9.99 style price violates.

Everything else Stripe supports is accepted: usd, eur, gbp, inr, aud, cad, brl, mxn, zar, sgd and roughly 105 more. A code outside the list fails fast with CURRENCY_UNSUPPORTED, and the error message names what is allowed. Show that error to the seller. Do not silently retry in another currency.

Error codes worth handling

Catch these on error.code:

CodeWhat happened
CONNECT_REQUIREDManaged cap reached; the owner must onboard Stripe. error.onboardUrl is set.
OVER_CAPThis single amount alone exceeds the remaining cap.
BILLING_DISABLEDThe owner turned billing off for the workspace, or the owner is on the free plan.
AUTH_REQUIREDsubscribe or openPortal called without a signed-in end-user.
AMOUNT_INVALIDUnder Stripe's 50-cent minimum, or not a number.
CURRENCY_UNSUPPORTEDCurrency not on the allowlist.
SESSION_NOT_FOUNDverifySession could not find that session for this app.

Limits to design around

  • Managed-mode lifetime cap: $500 per workspace.
  • Application fee on connected charges: 5%.
  • Minimum charge: $0.50, which is Stripe's floor, not ours.
  • Per-app rate limit: 30 checkout attempts per minute.
  • Credit cost to the app owner: a tenth of a credit per checkout or subscribe call. The portal and usage reporting are free.
  • Subscriptions and the portal require a signed-in end-user through window.genmb.auth, so GenMB can attach a stable customer record.

The upgrade path

Build the paid feature on free. Ask for the paywall, watch the SDK get injected, and lay out the buy button and the post-payment screen. What free does not do is take the payment: checkout and subscribe both return BILLING_DISABLED until the workspace owner is on a paid plan, and that includes test mode.

Then upgrade to Pro at $19 a month, connect Stripe, and the same app starts paying out to your bank with your name on the statement. Pro also brings the pieces a paid app usually needs next: a real database, a custom domain, and no "Built with GenMB" badge on the page your customers are paying on.

See pricing or read the App Billing docs. If you are charging for products rather than access, the Ecommerce SDKs handle catalog, cart and orders around the payment.

Share this post

Frequently Asked Questions

Do I need my own Stripe account to take a payment from a GenMB app?
Not for the first $500. Managed mode runs one-time charges on GenMB’s platform Stripe account up to a $500 lifetime cap per workspace, so you can validate a paid feature before doing any Stripe onboarding. Past the cap, or for subscriptions and payouts, you connect a Stripe Connect Express account.
What fee does GenMB take on payments?
Once you connect your own Stripe account, GenMB attaches a 5% application fee to each Direct Charge and the remaining 95% lands in your account. Stripe pays out to your bank on the schedule you configure. In managed mode the whole payment sits in GenMB’s account and settlement is manual, which is why connecting before launch is the recommended path.
Which currencies can a generated app charge in?
Every presentment currency Stripe supports except zero-decimal ones (jpy, krw, vnd and similar), three-decimal ones (bhd, jod, kwd, omr, tnd) and whole-unit ones (huf, isk, twd). Those are excluded because the SDK converts major units to cents by multiplying by 100, which would over- or under-charge in those currencies. An unsupported code returns CURRENCY_UNSUPPORTED and names what is allowed.
Can I test payments without charging a real card?
Yes. The workspace owner can flip test mode on the Billing tab. Test checkouts run on the platform test key with Stripe test cards, are forced into managed mode, skip the cap reservation so they never eat your $500, and are never counted as revenue. Subscriptions are blocked while test mode is on because they would run against your real connected account.
What plan do I need for app billing?
App Billing is a Pro and above feature, enforced on the server. A free-plan owner sees an upgrade card on the Billing tab instead of the Connect Stripe button, and checkout calls from a free workspace's app return BILLING_DISABLED. Pro is $19 a month or $15 a month billed yearly.
Ambuj Agrawal

Ambuj Agrawal

Founder

Award-winning AI author and speaker. Building the future of app development at GenMB.

Follow on LinkedIn

Ready to start building?

Turn your ideas into reality with GenMB's AI-powered app builder.