Walk through the basics of applying coupons to Subscriptions using Ruby and Sinatra
- Ruby v2.4.5+
- Stripe CLI
- Create a stripe account
- Stripe API Keys
- Install dependencies in the
/server/
folder
bundle install --path vendor/bundle
- Configure your keys
Update the example .env
file with your Stripe API keys.
- Create a recurring Plan and a Coupon (in test mode)
Enter the Plan ID and Coupon name and ID in server.rb
file
plan_id = "plan_123"
COUPON_MAP = {
name_of_coupon: "id_of_coupon",
}
- Run the application
ruby server.rb
- Go to
localhost:4242
in your browser to see the demo