#Monkey

1 messages · Page 1 of 1 (latest)

worn falconBOT
outer notch
#

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
barren swan
#

So I create one product for each Plan

outer notch
#

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

barren swan
#

Thanks! Good to know.

#

What about Add Ons

#

Same product but for example:
+$10 one-time payment for something

outer notch
#

In this case, you can create an one time pricing under the same product

barren swan
#

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

outer notch
#

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

barren swan
#

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?

outer notch
#

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)

barren swan
outer notch
barren swan
#

Ok.
I am going to repeat what I understood

#

#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?

outer notch
#

#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

barren swan
#

Is there a way to jump on a call instead of texting?

outer notch
barren swan
#

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?

outer notch
#

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

barren swan
#

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?

outer notch
#

If the Stripe ID is not created in advance, then it won't exist

barren swan
#

So I do have to create a PRICE ID for every product?

#

What if I have 500 products?

outer notch
barren swan
#

Ok. Thank you very much for all your help!

#

I'll read more.