Lock In Lab Intern, rank 1 of 9

BU-1featureFirst of 3 Builder tickets

Charge €1 with Stripe, in test mode

Takes
60 min in 5 steps
Checked
19 Nov 2026
min

Your estimate is optional. Your review compares it with how long it took; nothing is scored.

The product owner wants a "Buy a coffee" button: one euro, test mode only. Nobody should be able to mark a payment as paid by calling your endpoint by hand, and no secret key may end up in the browser, the repo or the chat.

The checkout is the easy half. Agents get the webhook wrong more often than anything else in this ticket.

You'll need A free Stripe account (test mode costs nothing). A deployed app with a server side: any framework with API routes. The Stripe CLI for testing webhooks. Prices checked this month are on Tools.

Spec the money flow

Step 1 of 5, about 10 min

Write it in SPEC.md before any prompt: button → server creates a Checkout Session → Stripe page → success page that says "thanks, we'll confirm shortly" → Stripe calls your webhook → webhook verifies the signature → order marked paid. The success page never marks anything paid.

The part of a video worth watching for this step

YouTube, Claude. Published Sep 2026.Checked 19 Nov 2026

Optional. The step counts when you've done it, whether or not you watch. Minutes from the creator's chapters; our notes on this video.

Keys in .env, .env in .gitignore

Step 2 of 5, about 5 min

Copy the test secret key from the Stripe dashboard into .env as STRIPE_SECRET_KEY. Check .gitignore has .env before you create it. Don't paste the key into the chat; tell the agent the variable name.

The part of a video worth watching for this step

YouTube, AI Engineer. Published Nov 2026.Checked 19 Nov 2026

Optional. The step counts when you've done it, whether or not you watch. Minutes from the creator's chapters; our notes on this video.

the usual mistake

Keys pasted into the chat or committed once 'just to test'. Rotating them is the only real fix. It happened to us in INC-14, "Secrets in git, across dozens of repos".

Checkout session and success page

Step 3 of 5, about 15 min

Pay with 4242 4242 4242 4242, any future date, any CVC. You should land on the success page. No order is paid yet; that's correct.

Paste this to your agent
Add a Stripe Checkout session for a single €1 item, reading the key from STRIPE_SECRET_KEY on the server. Success and cancel pages. Don't touch the webhook yet. Plan first.

The part of a video worth watching for this step

YouTube, Tech With Tim. Published Jul 2026.Checked 19 Nov 2026

Optional. The step counts when you've done it, whether or not you watch. Minutes from the creator's chapters; our notes on this video.

Webhook that checks the signature

Step 4 of 5, about 20 min

Run stripe listen --forward-to localhost:3000/api/webhook (your own port and path if they differ) and put the whsec_ it prints into .env. Pay again and watch the event arrive.

Paste this to your agent
Add a webhook endpoint for checkout.session.completed. Verify the Stripe signature using the raw request body and STRIPE_WEBHOOK_SECRET. Only then mark the order paid. Answer 400 if verification fails.

The part of a video worth watching for this step

YouTube, Jason Lee. Published May 2026.Checked 19 Nov 2026

Optional. The step counts when you've done it, whether or not you watch. Minutes from the creator's chapters; our notes on this video.

the usual mistake

Parsing the body as JSON before verifying. Signature checks need the raw body; frameworks that parse it first make every real event fail, and the 'fix' agents suggest is to skip the check. It happened to us in INC-01, "The bot that graded its own homework".

Try to fake a payment

Step 5 of 5, about 10 min

Send a fake event to your webhook without a signature. It must answer 400 and leave orders alone. Then search what the browser gets for your key: grep -r sk_test dist/ (or your build folder) must find nothing.

The part of a video worth watching for this step

YouTube, AI Engineer. Published Nov 2026.Checked 19 Nov 2026

Optional. The step counts when you've done it, whether or not you watch. Minutes from the creator's chapters; our notes on this video.

Check and ship

The whole ticket
With your app running locally:
stripe trigger checkout.session.completed
curl -s -o /dev/null -w '%{http_code}\n' -X POST localhost:3000/api/webhook -H 'content-type: application/json' -d '{"type":"checkout.session.completed"}'

It passes when The first reaches your webhook and gets a 200 (see the stripe listen output). The second prints 400 and changes nothing. For a paid order of your own, pay once with 4242 4242 4242 4242.

  • A test card payment (4242 4242 4242 4242) creates an order with status paid.
  • A request to the webhook without a valid Stripe signature gets a 400 and changes nothing.
  • The order is marked paid by the webhook, not by the success page.
  • sk_test_ appears in no committed file and in no file served to the browser.

No server checks your work in this version: you mark it, and your review says "Checked by you". Graded checks are planned for Plus.

Next: BU-2 Tests the agent can't skip

What do you see?

Pick the closest one. Each goes to what to try first and the incident it looks like.