# Create Stripe Product for allmetrics Stripe uses to create plans for user subscriptions. I assume that the stripe account has been created. If it's for developing mode, select "viewing test data" on the sidebar menu. ## Create Product We need to create products for the plans. Go to "Products", then add product. ### For the free plan Please follow the image instruction ![](https://i.imgur.com/VYVvegU.png) Click Save Product to finish the process and Go to the product's detail to add a new price. We need to create a Monthly or Annual price. Monthly ![](https://i.imgur.com/KvbCEDN.png) Annual ![](https://i.imgur.com/BWmfH2R.png) Create Metadata price as the feature plan on the user subscriptions page. Metadata is also used to limit the user based on the feature plan. ### Default Price ID on .env ![](https://i.imgur.com/7xHrcQI.png) We use free plan as the default price id for user registration. Click on the copy icon and copy the API ID for each price. Open .env and set the default price id for an example: ``` DEFAULT_PRICE_ID_YEARLY=price_1IFH7KJbyakvW8WRfyco7qvN DEFAULT_PRICE_ID_MONTHLY=price_1IFH7LJbyakvW8WRT3ateERo ``` ### Metadata Free Plan ![](https://i.imgur.com/413QGti.png) Please follow the image carefully because the code will use the metadata as conditional on the statement. Note: the value of 0 (zero) is defined as unlimited no limit. ### For the Unlimited Plan Please follow the image instruction. ![](https://i.imgur.com/SPH057v.png) Click Save Product to finish the process and Go to the product's detail to add a new price. We need to create a Monthly or Annual price. Create monthly price ![](https://i.imgur.com/SE0eIo2.png) Create annual price ![](https://i.imgur.com/Aw4vOiu.png) The result is in the image below. ![](https://i.imgur.com/7DjcNXw.png) ### Metadata Create Metadata price as the feature plan on the user subscriptions page. Metadata is also used to limit the user based on the feature plan. ![](https://i.imgur.com/ijULdO7.png) Please follow the image carefully because the code will use the metadata as conditional on the statement. Note: the value of 0 (zero) is defined as unlimited no limit. ## Public and secret key To get the public and secret API key goes to the sidebar menu Developer -> API Key. Click Reveal Key for the secret key and copy both of the keys then open .env and paste on these settings below: For production or live site: ``` STRIPE_LIVE_PUBLIC_KEY= STRIPE_LIVE_SECRET_KEY= ``` For development or test site: ``` STRIPE_TEST_PUBLIC_KEY= STRIPE_TEST_SECRET_KEY= ``` ## WEBHOOK The currently project not use webhook. So we just set the webhook settings to: ``` DJSTRIPE_WEBHOOK_SECRET=whsec_x ```