Modelling our product and prices in Stripe
Let's say we have a product called FitDiet which includes customized meal plans and exercises. We want to sell following subscription plans to our customers.
- Monthly standard plan worth $19
- Monthly pro plan worth $39
- Yearly standard plan worth $190
- Yearly pro plan worth $390
To model the above subscription plans in Stripe we will first need to create a product. Because of the way Stripe works we will create a single product called "FitDiet" and this single product will have four pricing plans.
Creating a product
Enter the product details along with
Monthly standard plan pricing details as
shown below and save them: Here we will enter the product name and product
description and we will also provide information about the first pricing plan
which is "Standard pricing" of $19 per month.
Next we will add
Yearly standard plan. To add a new price, click on the
Add another price button.
Enter the pricing details as shown below and save them:
Monthly pro plan and
Year pro plan pricing in the
follow the same steps as mentioned above.
After creating the product and prices successfully in Stripe, store the
price IDs for later use. We can get it by navigating to the
product page in Stripe Dashboard as shown below:
Creating a product and prices via Stripe API
If we want to create products and prices using API then we need Stripe
Secret Key from the
Stripe Dashboard. For our case
API key is
Now, let's see how we can send a
POST request to create a
product with name
1$ curl https://api.stripe.com/v1/products \ 2> -u sk_test_51IUPamDdkrcdQOlhs2b...VV2OQeFjRe1004Oahe9N3: \ 3> -d "name"="FitDiet" \ 4> -d "active"="true"
Once the product is created successfully the response will contain product ID.
For our case the product ID is
prod_JJex2jDvjE1FT5. Now we will create a
Monthly standard plan of price
create price API.
1$ curl https://api.stripe.com/v1/prices \ 2> -u sk_test_51IUPamDdkrcdQOlhs2b...VV2OQeFjRe1004Oahe9N3: \ 3> -d "product"="prod_JJex2jDvjE1FT5" \ 4> -d "unit_amount"=1900 \ 5> -d "currency"="usd" \ 6> -d "recurring[interval]=month"