Infrastructure
Stripe: Accepting Payments
How to charge money for your product — from test mode to real payments
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 catalog → Add product
- Enter a name, description, and price
- Click Create payment link
- Copy the link and share it — anyone who clicks it can pay you
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
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
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
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.