Recap of the Previous Post
In Part 5, we covered Cloudflare Workers and wrangler. This time, we're talking about Stripe CLI — the tool for working with "money."
What Is Stripe — A Quick Overview
Stripe = an online payment service.
It provides the infrastructure for accepting credit card payments on websites. The Kagemusha system uses Stripe to manage its ¥500/month subscription (recurring billing).
Why You Need It — Easy Webhook Testing
In Stripe, a mechanism called "Webhooks" is essential.
When someone completes a payment, Stripe sends a notification (Webhook) to your server saying "this person just paid." You receive this notification and then activate their account, send an email, and so on.
The problem is that testing these Webhooks during development is a hassle. Normally, you'd need a server that's publicly accessible on the internet.
This is where Stripe CLI comes in.
What Is Stripe CLI
Stripe CLI = a tool that lets you perform Stripe operations and test Webhooks from the command line.
The most powerful feature is the stripe listen command. It lets you receive Stripe Webhooks right on your local machine.
Installation
Download Stripe CLI from the official site.
https://stripe.com/docs/stripe-cli
On Windows, download and extract the zip file. Place it in a directory that's in your PATH. For the first run, log in with your Stripe account:
stripe login
# A browser window will open — authorize with your Stripe account
How I Use It — listen --forward-to Is a Game-Changer
The command I use most is this:
stripe listen --forward-to localhost:8787/webhook
Here's what happens:
- Stripe CLI creates a tunnel between Stripe and your local machine
- When a payment occurs in test mode, the Webhook is delivered to your machine
- Your local development server (localhost:8787) receives it
In other words, you can fully test the entire payment flow on your local machine.
Using the test card number 4242 4242 4242 4242, no real money is charged no matter how many times you run a payment. The expiration date can be any future date, and the CVC can be any three digits.
・Whether subscription creation, update, and cancellation notifications are processed properly
・Whether duplicate processing prevention is working
The biggest advantage is that you can test all of this with zero impact on production.
For the Kagemusha system, we tested the entire flow — landing page purchase → Stripe payment → Webhook received → account activation → setup email sent — dozens of times. Without Stripe CLI, this testing would have been incredibly difficult.
Next Time
Next up: Python and its handy libraries. We'll answer the question "Why Python when you already have Node.js?" and showcase scenarios where Python really shines, like speech synthesis and image processing.
Part 2: Node.js & npm
Part 3: Git
Part 4: Google Apps Script & clasp
Part 5: Cloudflare Workers & wrangler
Part 6: Stripe CLI
Part 7: Python & Handy Libraries
Part 8: Wrap-Up — The Big Picture & How to Choose
Still managing tutor attendance manually?
Discover Kagemusha System