#corn-subscription-installments

1 messages · Page 1 of 1 (latest)

wind nebulaBOT
radiant saffron
#

corn-subscription-installments

graceful dove
#

would the "iterations" field be the one that tells the subscription how long it lasts?

radiant saffron
#

yes

graceful dove
#

im using checkout session on my backend to generate the stripe session for the customer is this still possible

#

is there a field for iterations in the checkout session

radiant saffron
#

no that is impossible with Checkout sorry. You can work around it by updating the Subscription after the payment but that isn't a good experience. Today we recommend not using Checkout for that use-case sorry

graceful dove
#

so whats the best way to do this then

#

use webhook?

radiant saffron
#

But otherwise yes a webhook would work fine and then you update that Subscription to become a SubscriptionSchedule with a number of iterations. Just not supported on Checkout on its own

graceful dove
#

any guidance on how I would update a subscription to become a subscription schedule?

#

i see

stripe.SubscriptionSchedule.create(
  customer='{{CUSTOMER_ID}}',
  start_date="now",
  end_behavior="cancel",
  phases=[{"items": [{"price": '{{PRICE_ID}}', "quantity": 1}], "iterations": 6}],
)
#

but wouldnt i have to remove the subscription that got created

radiant saffron
#

@graceful dove you're just guessing right now and the best option is to carefully read those docs and then try it in Test mode to understand how it works

graceful dove
#

okay so if i understand then, when the checkout session is successfully created and i get the webhook response, i would create a subscriptioneSchedule linked to the subscription

stripe.SubscriptionSchedule.create(from_subscription='{{SUBSCRIPTION_ID}}')

And then i would do

stripe.SubscriptionSchedule.modify

Does this sound right

radiant saffron
#

yes

graceful dove
#

okay thanks