#idhruv - Scheduled cancelation proration
1 messages ยท Page 1 of 1 (latest)
Looks like you have that set to release
So that's why
If you change that to cancel then the underlying Sub will cancel when the Schedule ends
omg, you sure that will work? coz i read somewhere that it should be set to release
Well you should always be testing your integration end-to-end before you go live
But yes, I'm sure it will cancel the Sub at the end of the Schedule
You can use test clocks (https://stripe.com/docs/billing/testing/test-clocks) to easily test this out
And ensure it is the behavior you want
exactly, i had used test clocks multiple times before and it did work with release too i remember
so i am quiet confused why the sub is still running on our user's end
okay i will first change this to cancel
Feel free to provide an example where it canceled the Sub using release and I'd be happy to look.
You can see that our documentation clearly states that release will not cancel a Subscription: https://stripe.com/docs/api/subscription_schedules/create#create_subscription_schedule-end_behavior
i had tested it few months back but alright i will test again with cancel and release both
๐
thansk
Sure!
is there anything else apart from this i need to configure?
let subscriptionObj:any = { customer: userData.stripeCustomerId.toString(), start_date: fromDateSec, // start_date: 'now', end_behavior: 'release', default_settings: { application_fee_percent: adminPercentWithTax, collection_method: "charge_automatically", default_payment_method: payload.cardId, transfer_data: { destination: hostStripeAccId?.stripeAccountId } }, metadata: {'bookingId': String(bookingArr[i]?._id)}, phases: [ { items: [ { price: price.id, quantity: 1, } ], iterations: monthlyIterations, proration_behavior: 'none' }, ] }
my subsch object. can you please check if this is enough for the purpose of this question?
No that's incorrect. You have end_behavior: 'release', in that
You want end_behavior: cancel
yes yes, i did that. apart from that is there anything more?
The rest looks fine as far as I can tell. I don't know your exact use-case but yes this will create a Subscription that will cancel after the number of iterations that you set which seems like what you want
cool
thanks
our use case is simple, users can book monthly space by opting out to 2 months to 12 months of subscription, wherein we charge them every month a specified amount
out of this 10% goes to us, and rest goes to connected account who hosted space for this user
we also have other options to book space hourly/daily and for this we charge the amount in one go for which subscription is not needed
Gotcha
The above is correct then for a 2 month Sub if you set iterations: 2 and end_behavior: cancel
okay I tested it
it works but charge is not happening monthly
instead it only cuts once for entire cycle of 2 months
sub_1Ls8RCGdNldKu1zmTfxuaS6h test clock result
Hi there ๐ taking over for @slate citrus
Give me a few minutes to get caught up.
What was happening when iterations were set to 1?
that i have not tried but i'd assume that it will only run for one month
when i set it to 2 it correctly considers 2 months
but charges only once, as i changed end_behaviour to cancel
i want it to charge every month until 2 months or N months run out and subscription cancels itself
i am also setting up price and recurring interval set to month, this is then used to send while creating subscription schedule
Hmmm, that's odd. I'm trying to make sense of what might be causing that. Just wanted to let you know that I'm still digging
I'll circle back in a few
Sure thing, will do
Alright, circling back to close the loop here. This looks like a bug when using a backdated start date + proration_behavior: none within the phase. We're putting together some clean repros and surfacing the issue to the product team
backdated start date?
sorry, i am still debugging
sub_sched_1Ls9rbGdNldKu1zm1CDdKXHx i am again getting date related problems
Hey there, just an update that we're still digging into this. I'm stepping in for two shoes but will let you know when we have more info.