No-CodeIntermediate

How to Add Stripe Payments to a No-Code App

Add a working Stripe Checkout flow to a Lovable or Bolt app so you can charge for a product or subscription.

11 minIntermediate

Once your app does something useful, you may want to charge for it. Stripe Checkout is the safest path because Stripe hosts the payment page, so your no-code app never handles raw card data. This guide connects Stripe to a generated app and gets a test payment working end to end.

What you need

  • A Stripe account in test mode
  • A Lovable or Bolt project with a backend (Supabase Edge Functions or a Node server)
  • Your Stripe secret key and publishable key from the Stripe dashboard
  • About 25 minutes

Step 1: Create a product and price in Stripe

In the Stripe dashboard, open Products, add your product, and create a price. Copy the price ID (it starts with price_). You will pass this ID to Checkout so Stripe knows what to charge.

dashboard.stripe.com - product
Products > Pro Plan
------------------------------------------
Pricing
$12.00 / month recurring
Price ID: price_1QabcDEfGhIjKlMn
[ Copy price ID ] [ Edit ]
Grab the price ID after creating a price.

Step 2: Store your secret key safely

Never paste your Stripe secret key into front-end code. Put it in your backend environment, for example a Supabase Edge Function secret. In Lovable, ask it to create a secure server function and store the key there.

zsh - set Supabase secret
Store the Stripe secret key as a server-side secret
$supabase secrets set STRIPE_SECRET_KEY=sk_test_xxx
Finished supabase secrets set.
$

Step 3: Ask the tool to create a Checkout session

Prompt your no-code tool to add a server function that creates a Stripe Checkout session and a button that calls it. Give it the price ID so it wires the right product.

chat prompt
Add a 'Subscribe' button that calls a secure server function. The function should use the STRIPE_SECRET_KEY secret to create a Stripe Checkout session for price price_1QabcDEfGhIjKlMn and redirect the user to the Checkout URL.

Step 4: Verify the generated server function

Open the generated function and confirm it reads the key from the environment, not from a hardcoded string, and that it sets a success and cancel URL back to your app.

supabase/functions/checkout/index.ts
import Stripe from "npm:stripe";

const stripe = new Stripe(Deno.env.get("STRIPE_SECRET_KEY")!);

const session = await stripe.checkout.sessions.create({
  mode: "subscription",
  line_items: [{ price: "price_1QabcDEfGhIjKlMn", quantity: 1 }],
  success_url: `${origin}/success`,
  cancel_url: `${origin}/pricing`,
});

return new Response(JSON.stringify({ url: session.url }));
Use Stripe test cards
While in test mode, pay with card number 4242 4242 4242 4242, any future expiry, and any CVC. Stripe records the payment without charging real money, so you can confirm the full flow safely.

Step 5: Test the full flow

Click Subscribe in the preview, complete the hosted Checkout with the test card, and confirm you land on the success page. Check the Stripe dashboard to see the test payment recorded.

Result

Your app can now take payments through Stripe's hosted Checkout, with the secret key safely on the server. When you are ready to charge real money, swap the test keys for live keys and create live-mode products.

Watch related tutorials

Tags
#stripe#payments#checkout#lovable#bolt