8

Infrastructure

Stripe: Accepting Payments

How to charge money for your product — from test mode to real payments

If you're selling something online — a product, a subscription, a course, or even accepting donations — you need a way to process payments. Stripe is the most popular way to do it. It handles credit card processing, receipts, refunds, and tax calculation so you don't have to. The best part: you can start in test mode (no real money involved) to learn how it all works.

What Stripe does for you

Accepting payments online is surprisingly complicated. You need to handle credit card validation, fraud detection, receipts, different currencies, tax rules, and security regulations. Stripe handles all of this. You tell Stripe what you're selling and how much it costs, and they deal with the rest.

  • Checkout — a beautiful payment page that Stripe builds and hosts for you
  • Subscriptions — recurring monthly/yearly billing, handled automatically
  • Invoices & receipts — sent to customers automatically
  • Refunds — one click in the dashboard

The easiest path: Payment Links

You don't need to write any code to start accepting payments. Stripe's Payment Links let you create a checkout page from the dashboard and share it as a URL.

  • Sign up at stripe.com
  • In the dashboard, go to Product catalogAdd product
  • Enter a name, description, and price
  • Click Create payment link
  • Copy the link and share it — anyone who clicks it can pay you
Payment Links work for selling courses, digital products, donations, consulting sessions — anything with a price. No code needed.

Test mode: Practice without real money

Stripe has a full test mode that simulates real payments without charging anyone. Toggle the "Test mode" switch in the dashboard (top-right). Everything works the same, but no real money moves.

  • Test credit card number: 4242 4242 4242 4242
  • Use any future expiration date and any 3-digit CVC
  • Test payments show up in your dashboard just like real ones
  • Switch to "Live mode" when you're ready for real payments

For developers: Stripe Checkout

If you're building an app and want to integrate payments into your code (rather than sharing a link), Stripe Checkout is the way to go. Your server creates a "Checkout Session" and redirects the user to Stripe's hosted payment page.

  • Install: npm install stripe
  • On your server, create a Checkout Session with your product and price
  • Redirect the user to the session URL — Stripe shows the payment form
  • After payment, the user is sent back to your "success" page
Claude Code can do this for you
Ask Claude Code: "Add Stripe checkout to this project" — it can install the library, create the server-side endpoint, and set up the redirect flow for you.

Webhooks: How to know a payment went through

A webhook is a message Stripe sends to your server when something happens — like a successful payment, a failed charge, or a cancelled subscription. This is how your app "knows" that someone paid.

  • You give Stripe a URL on your server (an endpoint)
  • When a payment succeeds, Stripe sends a message to that URL with the details
  • Your server reads the message and takes action (e.g., unlock a feature, send a confirmation email)
  • Always verify the signature — this confirms the message actually came from Stripe and wasn't faked
Webhooks are the most important concept in Stripe integration. Without them, your app doesn't know that a payment happened. Don't skip this step if you're coding an integration.

What does it cost?

  • Stripe charges 2.9% + 30¢ per transaction (US)
  • No monthly fee — you only pay when you get paid
  • Test mode is completely free
Try this now

Create a Stripe account, switch to test mode, and create a Payment Link for a fake product. "Buy" it yourself using the test card 4242 4242 4242 4242. Watch the payment show up in your dashboard. The whole thing takes 5 minutes.