An implementation, in Rust, of the Stripe Checkout Simple Subscription sample
- Login to stripe (with your key and password) and get a pairing code:
stripe login
- Create a basic and a premium product, either using the CLI or the dashboard. If using the CLI:
stripe products create --name="Basic" --description="Basic plan"
stripe products create --name="Premium" --description="Premium plan"
- Create a basic and premium price, either using the CLI or the dashboard. If using the CLI:
stripe prices create --product=prod_XYZ --unit-amount=1200 --currency=usd -d"recurring[interval]=month"
For each product call the command line above but replace prod_XYZ with the product ids you got on 2 and change the price and currency accordingly.
-
Edit change the file
.env.example
name into.env
and change the test keys, prices' ids and webhook id. -
Call
cargo run
and accesshttp://localhost:4242
with a web browser. Because the sample doesn't run on SSL, I recomend using MS Edge. For security reasons, the settings on other browsers will block some components. -
For the customer to be able to access the customer portal and manage billing you'll need to enable it in the Stripe dashboard.