Skip to main content
Stripe Checkout hosts the card form, so card numbers never reach your app or floo. Your app creates a Checkout Session and redirects the buyer to Stripe. Stripe sends checkout.session.completed to a webhook route on your app, and the route records the order in Postgres. The examples use Next.js with the App Router and the stripe and pg packages. You need a Stripe account and a Price for the product you sell.

Set up your agent

For Claude Code, also run floo skills install --path .claude/skills/floo. Cursor, Codex, and other agents: Agent setup.

Agent prompt

Paste into your agent. Replace storefront with your app name.

floo.app.toml

floo.app.toml
  • access_mode = "public" on every environment, dev included. Stripe sends webhooks without a floo sign-in, so an environment behind App sign-in never receives them. The webhook route checks Stripe’s signature instead. To keep dev private, see Test webhooks with a private dev.
  • required stops a deploy that is missing a Stripe variable and names it.
  • Dev and prod each get their own Postgres, so test-mode orders never land in prod’s table.

Create the orders table

migrate_command runs once per deploy, before traffic moves, in your runtime image, so the Dockerfile must copy migrate.mjs into it. A row is a paid order; the checkout_session_id primary key records each one once.
migrate.mjs

Start a checkout

app/api/checkout/route.ts
A form with method="post" and action="/api/checkout" sends the buyer to Stripe. Both routes create the Stripe client inside the handler: next build loads route modules without your runtime secrets, and a client created at module load throws there for a missing key. floo sets FLOO_APP_URL to each environment’s URL, including a custom domain once it is active.

Receive the webhook

Stripe signs the exact bytes it sends. Read the body with request.text() and verify it before parsing; a parsed and re-serialized body fails the check. floo passes the body to your app unchanged.
app/api/stripe/webhook/route.ts
checkout.session.completed means the buyer finished Checkout, not that the money arrived. With a delayed payment method, such as a bank debit, the session completes unpaid and checkout.session.async_payment_succeeded follows once the payment clears, so the route records an order only when payment_status is not unpaid. Stripe retries a delivery that fails or times out, so the same event can arrive more than once; ON CONFLICT DO NOTHING records each session once. Answer quickly and move slow work, such as emails or fulfillment calls, to a cron job that reads new rows. A webhook to a service that has scaled to zero waits for a cold start. To keep prod ready, set min_instances = 1 for prod only:
A warm instance bills while it idles; see Scaling and availability.

Go live

Prod uses Stripe live mode. Set the live keys on floo’s prod environment, with your live Price ID in place of price_123:
In the Stripe Dashboard, in live mode, add a webhook endpoint at the prod URL plus /api/stripe/webhook for checkout.session.completed and checkout.session.async_payment_succeeded, then set its signing secret:
Release to prod as in Deploy a customer-facing app: gh release create for your GitHub repository, or floo promote --app storefront for an app floo hosts. A test-mode key never reaches prod, because dev and prod hold separate values.

Test webhooks with a private dev

To keep dev behind App sign-in, set [environments.dev] access_mode = "accounts" and test webhooks on your machine with the Stripe CLI:
stripe listen prints a signing secret for local deliveries. Run the app locally with that secret as STRIPE_WEBHOOK_SECRET. floo run --service web -- npm run dev supplies dev’s DATABASE_URL but withholds secrets, so set STRIPE_SECRET_KEY and STRIPE_WEBHOOK_SECRET in your local shell.

Troubleshooting

Next steps

Deploy a customer-facing app

Custom domain and releases for the app around the checkout.

Cron jobs

Run fulfillment and emails off the webhook path.