#corn-subscription-installments
1 messages · Page 1 of 1 (latest)
corn-subscription-installments
We support this with our SubscriptionSchedules API: https://stripe.com/docs/billing/subscriptions/subscription-schedules
would the "iterations" field be the one that tells the subscription how long it lasts?
yes
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
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
You can use PaymentElement https://stripe.com/docs/payments/payment-element to build you own payment form where you can clearly say how much per week/month and for how long.
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
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
@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
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
yes
okay thanks