#mustapha-checkout
1 messages · Page 1 of 1 (latest)
Hi! If I understand correctly, you want to create a Checkout Session with multiple recurring price and different billing periods?
yes thats what i want, i created multiple subscriptions and each subscription gives me client_secret and stripe element accept just one client_secret i don't know how to pass multiple client_secret to stripe element
If you are using Payment Elements then you are not using Stripe Checkout. So y are creating the subscriptions directly with this: https://stripe.com/docs/api/subscriptions/create ?
yes you are right
Well you have a few options:
- Create one subscription with multiple prices in the
itemparameter, however the prices need to be in the same currency and same billing period for this to work. https://stripe.com/docs/api/subscriptions/create#create_subscription-items - Or create a SetupIntent to collect the payment information once, and then use the resulting PaymentMethod to create multiple Subscriptions. https://stripe.com/docs/api/setup_intents
In this scenario, would you create the customer, attach the paymentMethod and then setup 2 subscriptions?
What about if the customer also needed o make a one off payment?
During the setup of the 2 subscriptions?
i create a customer without paymentmethod and If he chooses more than one subscription, he must pay all subscriptions
hmm ok. So first, are you sure you need multiple subscriptions specifically?
the option 1 not work for me because i have different billing period for each subscription
would one subscription with multiple products work for you?
ok then, no
then really what I would do is :
- write code to calculate the initial cost of all the subscriptions you intend to create
- create a standalone PaymentIntent for that amount
- process that payment
- when that succeeds, create all the subscriptions through the API. Use
trial_endso that trial periods are added to skip the first payment of each subscription(to avoid them charging again since you just did the first payment already).
In my case it is the customer who chooses the duration for each subscription
but how can i charge the customer for all subscriptions after the payment succeed ??
what do you mean by 'charge the customer'?
in my example you already charged them
i.e you are creating two subscriptions, one for $50 a month and one for $100 a year. You create a PaymentIntent for $150 and charge that upfront now, which "activates" those subscriptions. You then create the two actual subscription objects in Stripe, and use trial periods on each of them to skip the first month, and year, respectively.
i understand now thank you so much for your help