#MYoussef-subscription

1 messages · Page 1 of 1 (latest)

tribal heart
#

Hello. Sounds a bit complex. Why that way?

woven tree
#

i have a special case where the customer can create many subscription with same plan id, i contacted stripe support and they told me that i should create a checkout session with setup mode then passing the payment method id to create subscriptions in backend (but i found that this may be make a problem for example what if the customer credit is enough only for 2 subscription although he bought 3 subscriptions, at this time i should refund him the money of 2 subscriptions because he should pay for the 3 subscriptions or not)

#

i think in another solution to create a checkout session in payment mode to collect the whole amount of subscriptions then create subscriptions in backend with first year (paid) and passing the payment method id to use it for auto-renewal

#

is it valid ? kindly advise

tribal heart
#

Why can you not just a create a single Checkout Session with multiple line items for the same Price?

woven tree
#

if i make that it gave me an error that you can not create two subscriptions with the same plan/price id

tribal heart
#

Well it would be a single subscription, so I guess that's the issue

#

What you want to do will work, sure

woven tree
#

how to achieve that ?

tribal heart
#
  • Create a Checkout Session for the required amount of 3x subscription totals for the 1st year.
  • You will want to pass payment_intent_data.setup_future_usage: 'off_session' so that the payment details are correctly saved for future recurring payments.
  • On success (via checkout.session.completed) create the Subscriptions accordingly. I guess you'd initiate a year trial to 'skip' the first billing cycle (or use a schedule).
  • Use the saved Payment Method from the Checkout Session (it'll be on the Customer object) and set as default PM for the Subscriptions.
woven tree
#

if i created a subscription and set session.DefaultPaymentMethod = payment method if (from checkout session) and make the first year is trial (is this mean the customer will not be charged at first year and in the second year he will be charged from payment method that i passed ? )

tribal heart
#

Yes, exactly

woven tree
#

and if the customer uncheck auto renewal then i will create a subscription with trial_period_days= 365 and set cancel_at_period_end = true

#

?

tribal heart
#

Why would you want to cancel at period end?

#

Are you subscribing to yearly interval prices?

woven tree
#

because some times the customer can buy a subscription for only one year and he did not want auto renewal

woven tree
tribal heart
#

But generally you'd provide a UI for your customer to cancel if they wish (or use the customer portal)

woven tree
#

i provide a UI

#
  • Create checkout session with payment mode for the required 3x subscriptions

  • set payment_intent_data.setup_future_usage: 'off_session'

  • on success ( create 3x subscriptions and set DefaultPaymentMethod = pyament method Id from checkout session and set trial_period_days = 365 (because the customer paid for 1st year from checkout session).

  • if the customer uncheck auto renewal then i will set cancel_at_period_end = true (which is mean that the subscription will be cancelled automatically after the 1st tiral period)

#

is that valid ?

tribal heart
#

Yup, sounds good to me!

#

Although the payment method from Checkout isn't directly available on the Checkout Session object

woven tree
#

even if i used expand object ?

tribal heart
#

I guess you could expand payment_intent, yes

woven tree
#

i want to make sure that if i created a subscription with trial_days =365 and cancel_at_end = true then the customer will not be charged (because i charged the customer from checkout session)

tribal heart
#

There would be no subsequent renewal payments after the trial period, no

woven tree
#

do you have any advise that i should consider in my case ?

tribal heart
#

I think we've covered everything! Do you have a specific concern?

woven tree
#

no, thanks

tribal heart
#

Perfect!