# Stripe

> Take a payment or start a subscription with a hosted checkout page you can share as a link.

Web page: https://buildladder.com/tools/stripe

If you’re selling seats at a pottery workshop, a whole shopping cart may be more than you need. In Stripe you can create a product for the class, set its price, and get a link to a checkout page.

Try the link in test mode first. Complete a sample purchase and look for it in your Stripe dashboard. Compare the product, currency, and amount with the workshop listing before sharing a live payment link.

- Made by: Stripe
- Official site: https://stripe.com
- Cost: No setup or monthly fees. In the US, 2.9% + 30¢ per card payment, plus 1.5% for cards from other countries. Checked 9 Nov 2026.
- What you need first: A Stripe account. To take real payments, you add your business and bank details.
- Who it helps: When you want people to pay you, once or every month, including for physical goods or services.
- When to skip it: If you want sales tax handled for you, or you sell inside a phone app. With Stripe, sales tax is your job, though Stripe Tax can work it out for a fee. Phone app sales come with Apple and Google store rules, so read them first.
- Updated: 2026-11-10

## Take payments with Stripe

Add a Stripe checkout so people can pay you for one product. You practice in a sandbox with fake cards first, then switch to real payments when it works.

What you’ll end up with: A Buy button on your site that opens Stripe’s checkout, takes a test payment, and tells your site when someone has paid.

### You’ll need

- A website or web app you’re building with your AI tool, running on your computer.
- PLAN.md, with what you want to sell and for how much.
- To take real payments: your site online, plus your business and bank details.
- Stripe account (https://stripe.com): It has no monthly fee and takes a fee from each payment

### Your part

- Create the Stripe account, the sandbox and the product.
- Copy keys into your .env file.
- Pay with Stripe’s test card, then verify your business before you take real payments.

### Step 1 of 6: Create your account and a sandbox

This step is mine to do. Walk me through it, one action at a time:
- Go to stripe.com and create an account.
- In the Dashboard, open the account picker, then Switch to sandbox, then Create sandbox. Enter a Name and click Create sandbox. A banner at the top shows you are inside it.
- Inside the sandbox, go to More, then Product catalog, and click Add product.
- Enter the Name of what you sell. For the price, pick One time or Recurring, then enter the amount.
- Click Add product to save it. Your AI tool will ask for its price ID later, and that ID is safe to share.

It worked when: Your Stripe sandbox holds one product with its price.

If something goes wrong:
- You can’t find Create sandbox. If you already have a sandbox, open the account picker, then Switch to sandbox, then Manage sandboxes, and click Open beside its name. If Switch to sandbox is missing, check your account access against docs.stripe.com/sandboxes/dashboard/manage.
- You’re not sure whether to pick One time or Recurring. Pick One time for a single payment. Pick Recurring for a monthly or yearly plan. Check PLAN.md for what you chose.

### Step 2 of 6: Save your secret key in .env

This step is mine to do. Walk me through it, one action at a time:
- Ask your AI tool: “Which file in this folder should hold secret keys, and is it ignored by Git? Don’t ask me for the key.”
- If that file isn’t ignored by Git yet, ask your AI tool to add it to .gitignore before you go on.
- In your Stripe sandbox, open the API keys page. Check the banner says you are still in the sandbox before you copy anything.
- Copy the Secret key, not the publishable key. The secret key starts with sk_test_, which means it only works in your sandbox.
- Open the file your AI tool named, such as .env. Add a line with STRIPE_SECRET_KEY= followed by your key, then save it.

It worked when: A file that Git ignores holds a line starting STRIPE_SECRET_KEY=sk_test_.

If something goes wrong:
- You pasted the key into your AI tool’s chat by mistake. On the API keys page, open the menu next to the key and rotate it. Then save the new key in your file.
- Your folder has no .env file. That’s normal. Ask your AI tool to create an empty one and add it to .gitignore. Then paste the key in yourself.

### Step 3 of 6: Add a checkout for one product

Read PLAN.md in this folder. It says what I want to sell.

I want to add Stripe payments for one product, in Stripe’s sandbox only. No real money.

Before you write code, check Stripe’s current official docs for Checkout. Then look at my code and tell me:
- whether it has a server part that can keep a secret key safe
- if it doesn’t, the simplest option, such as a Stripe Payment Link, and what adding a server would change

Wait for my answer. Then build the smallest version that works:
- a Buy button on the page where people decide to buy
- a Checkout Session that sends them to Stripe’s hosted checkout page
- a thank-you page they come back to, and a page for when they cancel

Rules:
- Read the secret key from the STRIPE_SECRET_KEY environment variable. Never put a key in code.
- Read the price ID from a STRIPE_PRICE_ID environment variable, because it changes when I take real payments. Tell me where to find it. It’s safe to share.
- Keep everything that already works. Ask before you change something big.

When you’re done, explain in plain words what you changed, and how I can see the Buy button.

It worked when: The Buy button on your site opens Stripe’s checkout page with your product and price.

Before we move on, check with me:
- Does the back link on Stripe’s page return you to your site?

If something goes wrong:
- Your AI tool says your site has no server part. Ask it to compare two choices in plain words: a Stripe Payment Link, or adding a small server. Pick one before it builds.
- You see an error about an API key. Check the key line in your file has no extra spaces. Then ask your AI tool to restart your site and try again.

### Step 4 of 6: Buy it with a test card

This step is mine to do. Walk me through it, one action at a time:
- Open your site and click your Buy button.
- On Stripe’s page, enter the card number 4242 4242 4242 4242.
- Use any future date, such as 12/34, and any three-digit CVC. Fill the other fields with anything.
- Click Pay and wait to come back to your thank-you page.
- Look for your test payment in your sandbox Dashboard.

It worked when: You land on your thank-you page, and your sandbox Dashboard shows a successful test payment.

If something goes wrong:
- Stripe says the card was declined. Check you typed 4242 4242 4242 4242 and a date in the future. Real cards don’t work in a sandbox.
- You don’t come back to your site after paying. Tell your AI tool: “After a test payment, I don’t land on my thank-you page. Please find out why.”

### Step 5 of 6: React when a payment succeeds

The test checkout works. Now I want my site to react when a payment succeeds, using a Stripe webhook.

Check Stripe’s current docs on fulfilling Checkout orders and on webhooks first. Then:
- Add a webhook route that listens for checkout.session.completed.
- Verify every event with Stripe’s official library, using the raw request body and the signing secret from the STRIPE_WEBHOOK_SECRET environment variable.
- When a payment succeeds, do this one thing: (say what should happen, like “email the download link” or “mark the order as paid”).
- Give access from the webhook, not from the thank-you page, because people can close the page before it loads.
- Make it safe if the same event arrives twice.

If my site has no server part, stop and explain my options before you build anything.

To test on my computer, tell me the Stripe CLI command that forwards events to this route. I’ll run it myself in a separate terminal and copy the signing secret it prints into my .env file. Don’t run it for me.

Keep everything that already works. When you’re done, explain what changed and how to check it worked.

It worked when: After a test payment, your site does the one thing you asked, and the terminal running the Stripe CLI shows checkout.session.completed.

If something goes wrong:
- The webhook fails with a signature error. Copy the secret the Stripe CLI printed into your .env file again, then restart your site.
- Nothing happens after a payment. Check the Stripe CLI is still running in its own terminal. Then tell your AI tool what that terminal shows.

### Step 6 of 6: Switch to real payments

This step is mine to do. Walk me through it, one action at a time:
- Complete Stripe’s live-account setup in the Dashboard. Provide the business and product details it asks for. Add a payout account so Stripe can send you the money.
- Open your product in the sandbox and click Copy to live mode. Sandbox products don’t work in live mode.
- Open the API keys page for your live account. Use a key with only the access your server needs. Your AI tool can list the permissions without seeing the key.
- In your host’s settings, set STRIPE_SECRET_KEY to the live key and STRIPE_PRICE_ID to the live price ID.
- In the Dashboard, open Workbench, then Webhooks, and click Create an event destination. Stripe asks you to pick Thin or Snapshot, two formats for the event. Ask your AI tool which one your code expects.
- Pick checkout.session.completed, choose Webhook endpoint, and enter your live site’s webhook address.
- Click Reveal secret, then save it in your host’s settings as STRIPE_WEBHOOK_SECRET.
- Don’t test with your own real card in live mode. Stripe’s rules don’t allow it.

It worked when: Your public site has a live checkout, and the live keys are only in your host’s settings.

Before we move on, check with me:
- After your first real sale, does your live webhook show a successful delivery?

If something goes wrong:
- Stripe asks for more information about your business. That’s part of Stripe’s checks. Answer in the Dashboard. Your AI tool can explain what a question means.
- Live payments fail but test ones worked. Check every setting uses live values: the secret key, the price ID and the webhook secret. Then put your site online again.

Compare Stripe with the other options: https://buildladder.com/concepts/payments.md
