To add Stripe payments to an app you built with AI, decide what you're selling first (a one-off price or a monthly or yearly subscription), create a Stripe account and work in a sandbox, connect your app with test keys, add your plans, and then make sure the app learns about each payment from a Stripe webhook rather than from the "thank you" page. Test with Stripe's test cards, including declines, before you switch to live keys. Most of the work is in the last two steps. A checkout button is quick to add; an app that reliably gives a paying customer access, and takes it away when they cancel, is what takes care.
This guide is for founders and makers who have a working app from an AI app builder and now want to charge for it. It uses Stripe because it's the payment provider most AI builders connect to, and every Stripe detail below comes from Stripe's own documentation, checked on 2 December 2026. Where it shows the steps in Greta.sh, keep in mind that it's our product. The same order of work applies in any builder.
What you need before you start
| You need | Why |
|---|---|
| A working app with sign-in | Payments have to be tied to an account, or you can't tell who has paid |
| A place to store each account's plan and status | Your app checks this on every page that's behind the paywall |
| A Stripe account | Stripe handles the card form, the money and the receipts |
| A clear list of what you sell | Plan names, prices, currency and billing period |
| A deployed app on a stable address | Stripe has to be able to reach your app to send it events |
If your app doesn't have accounts or a database yet, sort that out first. Our explainer on auth, payments and databases for non-coders covers why the three go together.
Step 1: Decide exactly what you're selling
Write your pricing down before you touch Stripe. For each thing you sell, note:
- Plan name, such as "Pro".
- Amount and currency, such as 19 USD.
- Payment type: a one-off payment, or a subscription billed monthly or yearly.
- What it unlocks in your app, in one line. For example: "Pro accounts can create unlimited projects and export to CSV. Free accounts get 3 projects."
That last line matters more than the price. It's the rule your app has to enforce, and the AI builder can only enforce what you describe. A useful format to paste into your project notes:
Plans
- Free: $0. Up to 3 projects. No CSV export.
- Pro monthly: $19/month. Unlimited projects. CSV export.
- Pro yearly: $190/year. Same as Pro monthly.
Rules
- A new account starts on Free.
- An account becomes Pro only after Stripe confirms the payment.
- If a Pro subscription ends, the account goes back to Free. Existing projects stay, but new ones are blocked above 3.
Keep it this small at first. Free trials, coupons, seats and usage-based billing can all come later, once the basic loop works.
Step 2: Create a Stripe account and work in a sandbox
Sign up at Stripe and stay out of live mode for now. Stripe describes a sandbox as "an isolated test environment" you can use to "experiment with new features without affecting your live integration", and payments you make there aren't processed by card networks.
Stripe's API keys page tells the two modes apart by prefix:
- Sandbox keys start with
pk_test_(publishable),rk_test_(restricted) andsk_test_(secret). - Live keys start with
pk_live_,rk_live_andsk_live_.
Two key rules from Stripe's docs are worth knowing before you copy anything:
- The publishable key is safe to expose. Stripe says it can go in front-end code, but it can't create charges or read account data.
- The secret key is not. Stripe describes it as having "unrestricted permissions on all Stripe APIs", and when you create one in live mode, Stripe shows it only once. Stripe also recommends restricted keys, which carry only the permissions you choose, over secret keys for new integrations.
Store keys in your builder's secrets or settings, never in a prompt you'll share, a screenshot, or the page code.
Got an idea? Build it now!
Just start with a simple prompt. No coding required: Greta.sh turns your idea into a working app in minutes.
Step 3: Connect Stripe to your app
How this looks depends on your builder. In Greta.sh, the Stripe integration guide describes four steps:
- After your site is built, pick Stripe from the list of suggested components.
- Enter your Stripe Secret Key in the tab that opens. If you don't have it, the tab has a "How to get it" link.
- Click Add and enter each plan: plan name, amount, currency and payment type. For a subscription, choose monthly or yearly billing, then click Submit.
- The site reloads, and you can preview how the payment options look.
Use your sandbox secret key (sk_test_...) here first. You'll swap it for the live key in Step 8.
If your builder doesn't have a payment component, you can describe the integration in a prompt instead. Be specific about the flow, for example: "Add a Pricing page with the Free, Pro monthly and Pro yearly plans from my notes. The Upgrade button sends signed-in users to a Stripe Checkout page. Read the Stripe keys from project secrets, not from code."
Step 4: Make the app learn about payments from Stripe, not from the success page
This is the step most first integrations get wrong. After checkout, Stripe sends the customer back to a "success" page in your app, and it's tempting to mark the account as paid when that page loads. Stripe's fulfilment guide warns against exactly that: you "can't rely on triggering fulfilment only from your checkout landing page, because it's not guaranteed customers visit that page." A customer can pay and lose their connection before the page loads.
The reliable way is a webhook: an address in your app that Stripe calls whenever something happens to a payment or subscription. Your app then updates the account in the database. Stripe says webhook-based fulfilment is required if you sell subscriptions.
The events that matter for a simple app, per Stripe's docs:
| Event | What Stripe says it means | What your app should do |
|---|---|---|
checkout.session.completed | Created when someone pays you through Checkout | Mark the account as paid, or start its subscription |
invoice.paid | Sent when an invoice is paid; you can provision access when the subscription status is active | Keep the account on its paid plan for the new period |
customer.subscription.deleted | Sent when a customer's subscription ends | Move the account back to Free |
Builders differ in how much of this they set up for you. Greta.sh's Stripe guide covers connecting the key and adding plans, and doesn't describe webhook handling, so check what your generated app does after a payment. If nothing updates the account, ask for it in a prompt, for example:
Add a Stripe webhook endpoint at /api/stripe/webhook.
- Verify every request with the Stripe-Signature header and the webhook signing secret stored in project secrets. Reject anything that fails.
- On checkout.session.completed: find the account by the email or customer ID on the session and set plan = "pro", status = "active".
- On invoice.paid: keep plan = "pro" and record the new period end date.
- On customer.subscription.deleted: set plan = "free", status = "canceled".
- Record each event ID and skip any event ID you've already processed.
- Respond with 200 as soon as the event is verified and recorded.
Each line of that prompt maps to something in Stripe's documentation:
- Verify the signature. Stripe signs each event, and its docs show verifying it with the raw request body, the
Stripe-Signatureheader and the endpoint's signing secret (it starts withwhsec_). Signing secrets are separate from API keys; you find them in the Webhooks section of the Dashboard, under each endpoint. - Expect duplicates. Stripe says endpoints "might occasionally receive the same event more than once" and suggests logging the event IDs you've processed. Its fulfilment guide adds that your fulfilment code may be called "multiple times, possibly concurrently, for the same Checkout Session."
- Answer fast. Stripe recommends returning a successful (2xx) status "before any complex logic that might cause a timeout."
- Retries happen. In live mode, Stripe retries delivery "for up to three days with an exponential backoff". In a sandbox, it retries three times over a few hours.
Our field guide on testing duplicate webhooks before launch goes deeper on that last point.
Step 5: Gate the paid features in the app
The webhook writes the plan to the database. Now every paid feature has to read it. Ask the builder to check the account's plan on the server, not only by hiding buttons in the page, because a hidden button can still be reached by someone who knows the address.
A quick checklist for each paid feature:
- The feature's page or action checks
planandstatusbefore it runs. - A Free account sees a clear message and an Upgrade button instead of an error.
- The limit in your Step 1 notes (for example, 3 projects) is enforced when the record is created, not just shown in the UI.
- An admin can see each account's plan and status, so support questions take a minute rather than a Stripe search.
In Greta.sh, the Database is on the Pro plan, and a per-project Knowledge Base (also on Pro) is a good place to keep your Step 1 pricing rules so later prompts don't contradict them.
Got an idea? Build it now!
Just start with a simple prompt. No coding required: Greta.sh turns your idea into a working app in minutes.
Step 6: Let customers manage their own subscription
People will want to change cards, download receipts and cancel. You don't have to build those screens. Stripe has a customer portal that you can activate in the Dashboard with no code, and its docs cover letting customers cancel or pause subscriptions there. Add a "Manage billing" link on your account page that opens it.
When a customer cancels in the portal, the subscription ending reaches your app as customer.subscription.deleted, which is why that event is in Step 4.
Step 7: Test every path with Stripe's test cards
With sandbox keys still in place, run through each path at least once. Stripe's testing docs say to use a card number such as 4242 4242 4242 4242, "a valid future date, such as 12/34", and any three-digit CVC (four for American Express).
| Test | Card or action | What should happen in your app |
|---|---|---|
| Successful payment | 4242 4242 4242 4242 | Account becomes Pro within seconds; paid features unlock |
| Generic decline | 4000 0000 0000 0002 | Checkout shows the decline; account stays Free |
| Insufficient funds | 4000 0000 0000 9995 | Same as above |
| Card needs authentication | 4000 0025 0000 3155 | Customer sees an authentication step; account upgrades only if it succeeds |
| Customer closes the tab before the success page | Pay with 4242, close the tab immediately | Account still becomes Pro, because the webhook did the work |
| Cancellation | Cancel in the customer portal | Account returns to Free when the subscription ends |
| Duplicate event | Resend the same event from the Dashboard | Nothing changes the second time |
Stripe's Dashboard has a Resend button on each event, which works for up to 15 days after the event was created. It's the easiest way to test the duplicate case.
If something breaks while you test, roll back rather than prompting on top of a broken build. Greta.sh's project rollback restores an earlier version, but note that it's permanent: changes and chat messages after that point are removed.
Step 8: Switch to live mode
When every row in the test table passes:
- Work through Stripe's go-live checklist, then on the API keys page toggle from sandbox mode to live mode.
- Create your live secret key (or a restricted key, if your setup supports one). Copy it when Stripe shows it, because a live secret key is shown only once.
- Check that your plans exist in live mode too, with the same names and prices as in your Step 1 notes.
- Add a live webhook endpoint pointing at your deployed app's address, with the same three events. Copy its new signing secret.
- Replace the test key and test signing secret in your app's settings with the live ones, and redeploy.
- Make one real purchase with your own card and check that the account upgrades, then refund it.
In Greta.sh, deployment and custom domain setup come with the Starter plan, so the webhook can point at your own domain from day one. See how to deploy with Greta.sh if you haven't published yet.
Got an idea? Build it now!
Just start with a simple prompt. No coding required: Greta.sh turns your idea into a working app in minutes.
Common mistakes
- Unlocking access on the success page. The page isn't guaranteed to load. Use the webhook.
- Skipping signature verification. Without it, anyone who finds your webhook address can send a fake "paid" event.
- Pasting a secret key into chat. Keys belong in secrets or settings. If one leaks, rotate it in the Stripe Dashboard.
- Testing only the happy path. Declines, authentication and cancellations are where paying customers get stuck or get free access.
- Mixing test and live. Sandbox and live mode have their own keys and their own webhook endpoints, each with its own signing secret. Switch the key and the signing secret together.
- Changing prices in the app but not in Stripe. Stripe charges what's in Stripe. Keep the two lists in sync, ideally from your Step 1 notes.
- Building billing screens you don't need. The customer portal already handles card updates, receipts and cancellations.
When Stripe Checkout in your app isn't the right first step
If you only want to find out whether anyone will pay, you may not need an integration yet. Stripe's Payment Links let you "accept payments online without writing code": you create a link and share it on social media, in emails or on your website. You'd then upgrade accounts by hand. That's fine for the first few customers and a poor fit for anything beyond that, which is when the steps above pay off.
If you're still choosing how to charge, our guide to making money from an app compares the models, and how to build a SaaS puts billing in the context of the whole build.
FAQ
Can an AI app builder add Stripe payments for me?
Many can connect Stripe and add a pricing page or checkout. In Greta.sh, you pick Stripe from the suggested components, enter your Stripe secret key and add plans with an amount, currency and one-off or monthly/yearly billing. Check separately that the app updates each account from Stripe webhooks, and ask for it in a prompt if it doesn't.
Do I need webhooks if I use Stripe Checkout?
Yes, if you sell subscriptions or need to unlock anything after payment. Stripe's fulfilment guide says you can't rely on the checkout landing page alone, because the customer may never reach it, and that webhook-based fulfilment is required for subscriptions.
Which Stripe test card should I use?
Use 4242 4242 4242 4242 with any future expiry date and any three-digit CVC for a successful payment. Stripe also lists cards for declines, such as 4000 0000 0000 0002 (generic decline) and 4000 0000 0000 9995 (insufficient funds), and 4000 0025 0000 3155 for a payment that requires authentication.
Is it safe to give my Stripe secret key to an app builder?
Only through the builder's secrets or integration settings, never in a chat message or page code. Stripe says the secret key has unrestricted permissions on its APIs and recommends restricted keys for new integrations where your setup allows them. Start with a sandbox key, and rotate any key you think has leaked.
How do customers cancel a subscription?
The simplest way is Stripe's customer portal, which you can activate in the Stripe Dashboard without code. Link to it from your app's account page. When a subscription ends, Stripe sends customer.subscription.deleted, and your app should move the account back to the free plan.
What's the difference between Stripe's sandbox and live mode?
A sandbox is an isolated test environment: payments there aren't processed by card networks, and its keys start with pk_test_, rk_test_ and sk_test_. Live mode takes real payments with keys that start with pk_live_, rk_live_ and sk_live_. Set up a webhook endpoint, with its own signing secret, in each mode.



