From 8e13767c6438dead772df3e9f1843fe7520b8d56 Mon Sep 17 00:00:00 2001 From: Erasmus Cedernaes Date: Wed, 10 Jan 2024 21:59:31 +0100 Subject: [PATCH] Document commands for setting up Stripe --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.md b/README.md index b185529d9..7922cafc1 100644 --- a/README.md +++ b/README.md @@ -184,6 +184,8 @@ These subscriptions will automatically be turned into makeradmin products so tha Note: You should _not_ modify these products in makeradmin. They will be reset whenever the docker container restarts anyway (when the registration page is visited). +#### Needed Stripe configuration + The configuration needed on stripe is: - Create a **product** for base membership. Add the metadata "subscription_type"="membership" to the **product** item @@ -193,6 +195,24 @@ The configuration needed on stripe is: - Add a **price** for N months, where N is the binding period as specified in `stripe_subscriptions.py->BINDING_PERIOD`. The price should be N times the recurring price. Add the metadata "price_type"="binding_period" - Create a **coupon** for low income discount. It should be with percentage discount. Add the metadata "makerspace_price_level" = "low_income_discount" +You can achieve all of this using the Stripe CLI: + +```bash +# Create a yearly membership product with a price +stripe products create -d 'metadata[subscription_type]=membership' --name='Base membership' +# -> This gives a product ID `prod_MEMBERSHIP` that you need to substitute below +stripe prices create --unit-amount=20000 --currency=sek -d "recurring[interval]"=year --product="prod_MEMBERSHIP" -d "recurring[interval_count]"=1 -d 'metadata[price_type]=recurring' + +# Create a makerspace access product with prices +stripe products create -d 'metadata[subscription_type]=labaccess' --name='Makerspace access' +# -> This gives a product ID `prod_LABACCESS` that you need to substitute below +stripe prices create --unit-amount=30000 --currency=sek -d "recurring[interval]"=month --product="prod_LABACCESS" -d "recurring[interval_count]"=1 -d 'metadata[price_type]=recurring' +stripe prices create --unit-amount=60000 --currency=sek -d "recurring[interval]"=month --product="prod_LABACCESS" -d "recurring[interval_count]"=2 -d 'metadata[price_type]=binding_period' + +# Create a coupon +stripe coupons create --name='Low income discount' --percent-off=50 -d 'metadata[makerspace_price_level]=low_income_discount' +``` + If you try to access any page which needs these products (e.g. the registration page, or the member page), makeradmin will fetch them from stripe and do a bunch of validation checks. ### Setting up required products in makeradmin