#deinonychus_subscription-schedules
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1402674542253703271
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
my favourite dinosaur since i was a kid
hell yeah!
the real velociraptor, not the little chicken they inflated for the movies
SO that subscription update event is triggered by this schedule update request: https://dashboard.stripe.com/test/logs/req_hmtCoWSPsQw3Ai
yes, that's how we trigger the upgrade process
In this case, that update will always be applied, and then the invoice/payment attempt happens subsequently
what's the usual way people manage subscription upgrades? are we using an unconventional flow?
No your flow is fine, but you can't do updates conditional on payment success this way
What you want to look at is Pending Updates: https://docs.stripe.com/billing/subscriptions/pending-updates
Our current flow is something like:
User is subscribed to Product A ->
User changes their product in our app ->
We do our checks to know if that's considered an upgrade or a downgrade ->
We create a sub schedule having their current product as phase 0 and new product as phase 1 ->
Whenever it's considered an upgrade, first phase ends immediately, if it's considered a downgrade, first phase ends at the cycle end
Is that the good way? (sorry for hijacking lol)
This lets you do what you ask, indicate the change you want to make, produce an invoice to be paid, and only apply/commit the change once payment on that succeeds
You can mix this with schedules, but the schedule can do the pending update itself
https://docs.stripe.com/billing/subscriptions/pending-updates#pending-sub-schedules
And if you hit a phase change during the pending invoice window, it'll be reverted/voided and you'll need to apply a new change
ok so the key is PaymentBehavior = "pending_if_incomplete",
And that PaymentBehavior is part of the subscription object or can it also be find somewhere inside the sub schedule? (at its creation/update)
That functionality is not supported through schedule updates, no
Only updates directly to the subscription
(payment_behavior parameter is not exposed via schedule updates)
Ok, so how could we make it work on our flow?
We would need to call a sub update with payment_behavior before creating the schedules, right?
Cause as of now, all our sub changes are handled by schedules
You would need to make this pending update via the subscription, yes
So we tried calling the subscription update with payment behavior before the schedule update, and it doesn't seem to trigger any actual update in stripe
var subscriptionUpdateOptions = new SubscriptionUpdateOptions
{
PaymentBehavior = "pending_if_incomplete"
};
await subscriptionService.UpdateAsync(updateParameters.Subscription.StripeId, subscriptionUpdateOptions);
Are we missing an option?
Hi, taking over as my teammate needs to step away. Let me catch up.
Can you share the request id where you made this update request on the subscription? Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
there it is req_rdOMyYgXrJETYK
Taking a look
Out of curiousity, why are you updatting the subscription when you can pass that in the subscription creation request: https://dashboard.stripe.com/test/logs/req_PFxxaHp4VJMfgg ?
we weren't aware of that parameter, we were introduced to it on this thread, here:
So instead of having that param as an update, we could have it directly at the sub creation?
I'm going to try this
Yes!
Actually, that is not true
pending_if_incomplete is only used with updates and cannot be passed when creating a Subscription.
Let me test this end to end and confirm, hang tight. It has been a while when I tried this flow.
No worries, thanks a lot
'Setting
payment_behaviortopending_if_incompletehas no effect when creating a subscription.'
Can you also update the price on that subscription update call please https://docs.stripe.com/billing/subscriptions/pending-updates#update-subscription ? The latest call to just update the payment behavior does not make sense. The way this works is when you make an update to an existing subscription, if the payment succeeds, you'd want to proceed. When the payment fails, you'd get pending_update hash with the changes.
Yeah, sorry fo the confusion. When you pass another price to either downgrape or updgrade, it works as expected.
we're making the price change via a schedule update
Looking at the docs, we're wondering if default_incomplete would work when creating the initial subscription
This request is not using subscription Schedules: https://dashboard.stripe.com/test/logs/req_PFxxaHp4VJMfgg and instead is using subscription. Can you use the subscription schedules and use the subscription update to the payment behavior? Once I have your full flow, I will be able to test this end to end. Can you create the subscription schedules and the make an update to the subscription to update the payment behavior? You can use Test Clocks: https://docs.stripe.com/billing/testing/test-clocks
Our flow is like this.
What we did to test the pending update was to introduce the sub update before the schedule creation (flow line 4)
This was the request that was made after the other req previously shared
Let me try to reproduce this fully
Ok, that did not work. The subscription schedule is just updated. I have filed a feedback with the product owning team to allow passing pending_if_incomplete changes to subscription schedules.
If that works, default_incomplete works for your business use case works, sure.
However, default_incomplete is to create Subscriptions with status=incomplete when the first invoice requires payment, otherwise start as active. From the way you described your use case, you're looking to decide the behavior when it comed to the subscription schedules update correct?
If that is the case, I think you will manually look at the failed event and then update the subscription again to the original price.
We were hoping to not have to revert to a previous status/product.
For now we're trying to update a subscription item with the new price and passing the pending_if_incomplete at the same time, then updating the schedule like before. Though we're not quite sure how that'll work with downgrades that make deferred payments at the end of the billing cycle.
subscription schedules are complex and testing is highly recommended: https://docs.stripe.com/billing/testing/test-clocks