#Monkey
1 messages · Page 1 of 1 (latest)
Stripe Subscription requires pricing including product information. You could create pricing for those products individually.
For subscription integration, you can either use Checkout Session (Stripe hosted payment page) or Custom integration (Payment Element embedded in your website) to collect the payment. You may refer to this guide for integration details: https://stripe.com/docs/billing/subscriptions/build-subscriptions
- Low code option: Checkout Session
- Custom code option: Payment Element
So I create one product for each Plan
If they are different products, then yes, If they are the same product, but running on different pricing plan such as monthly or yearly, you can just create one product and set different pricing model under it
Thanks! Good to know.
What about Add Ons
Same product but for example:
+$10 one-time payment for something
In this case, you can create an one time pricing under the same product
I'll look into it.
Can I get the product id directly from the frontend or do I need to go to the backend first?
I mean Frontend (API) → to Stripe
or Frontend (API) → Backend (API) → Stripe
Note: I want custom made design
I see! StripeJS doesn't support retrieving product information. It'll have to go through Stripe API, so it'll be: Frontend (API) → Backend (API) → Stripe
Alternatively, you can save the product and pricing ID in your database once they are created with Stripe. You can retrieve them directly in your database instead of making request to Stripe
That's interesting approach (save in the DB).
Ok and if I have the products and pricing IDs
Do I need to call paymentIntent?
Can you refer me to the code?
No! For subscription integration, you should use Subscription API instead: https://stripe.com/docs/billing/subscriptions/build-subscriptions
For low code, it'll be using Checkout Session API (payment on Stripe hosted page).
For custom code, it'll be using Subscription API (embedded Payment Element in your website)
Is this GitHub code is updated:
https://github.com/stripe-samples/subscription-use-cases/tree/main/fixed-price-subscriptions
The code is slightly outdated. For example in Subscription Creation, the latest integration should include payment_settings: { save_default_payment_method: 'on_subscription' } to save the payment methods on the subscription, but it's missing in the sample code: https://github.com/stripe-samples/subscription-use-cases/blob/main/fixed-price-subscriptions/server/node/server.js#L98-L105
Ok.
I am going to repeat what I understood
#1)
I'll read those docs
https://stripe.com/docs/billing/subscriptions/build-subscriptions
#2) I will save the Product IDs and Prices in the DB
#3) I will then use my FrontEnd checkout to make an API call to Stripe using the PriceID
Is this correct? Do I need an additional API call to the backend?
Or can I call Stripe directly from my checkout page if I have the PriceID?
#1 👍
#2 After the product ID and pricing ID are created with Stripe, you can save them into your DB
#3 If you refer to the doc in #1, the Price ID is used to create the subscription using backend API. It can't be used directly at frontend.
To simply it:
Customer select the price he/she wishes to buy frontend → Send the selected price information to your backend → Backend finds the corresponding Stripe Price ID → Backend creates the subscription with Stripe Price ID and Stripe will return subscription information including Payment Intent → Backend return the response of Payment Intent to complete the payment using Payment Element
The steps I described above are listed in https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements
Is there a way to jump on a call instead of texting?
Sorry! We don't support phone call in discord. If you wish to get phone support, you can have Support team calling you in https://support.stripe.com/contact
I am sorry, I am back.
Regarding "Backend finds the corresponding Stripe Price ID"
Is it mandatory for me to create all the products in advance using Stripe Dashboard?
Not necessary. Creating products and pricing can be done using API as well
As long as the products and prices are created at the time of subscription is created, it will work fine
I see.
Ok I'll go over the documentation one more time.
Final question:
Customer select the price he/she wishes to buy frontend → Send the selected price information to your backend → Backend finds the corresponding Stripe Price ID → Backend creates the subscription with Stripe Price ID and Stripe will return subscription information including Payment Intent → Backend return the response of Payment Intent to complete the payment using Payment Element
"Backend finds the corresponding Stripe Price ID" - So this step based on my last question won't exist?
If the Stripe ID is not created in advance, then it won't exist
Yes! Prices have to be created in order to use Subscriptions.
You can either use Price API to create the Price or create ad-hoc pricing with price_data at the time during subscription creation.
- Price API: https://stripe.com/docs/api/prices/create
- Ad-hoc
items.price_dataon Subscription Creation API: https://stripe.com/docs/api/subscriptions/create#create_subscription-items-price_data