#Jayy
1 messages ยท Page 1 of 1 (latest)
Hello! All of the dates/times in the Stripe API take Unix timestamps in seconds. I believe Moment's .unix() method should work, but let me confirm...
Yep, that should work!
oh awesome! and after that schedule is created
let's say the customer wants it cancelled, i should consider it a normal subscription from then or will it be using a stripe.subscriptionSchedule.cancel() since the customer isn't charged yet?
If they want it canceled before the start date or when the Subscription is still being controlled by the Subscription Schedule you can cancel the Subscription Schedule: https://stripe.com/docs/api/subscription_schedules/cancel
If you want to cancel a Subscription created by a Subscription Schedule which has been released from that Schedule you would cancel the Subscription itself: https://stripe.com/docs/api/subscriptions/cancel#cancel_subscription
I'm just reading through the docs trying to find the best approach for the following:
I have a set of package, each have an addon.
let's say the first package has 2 free posts and the ability to purchase extra (as addons)
and the second package has 5 posts (also with the ability to purchase extra)
what i'm doing is if the customer has purchased addons, i check if it's equal or more than the next tier's capacity.
if it's equal i just cancel the subscription, but if it's more i want to create a subscription to be charged once the old subscription ends.
not sure if just creating a new scheduled subscription would be the best in this scenario
๐
stepping in
Let's back up a moment here
We have tiered Pricing
Are you using that?
can you please explain the tiered pricing?
To me it sounds like this is what you want: https://stripe.com/docs/products-prices/pricing-models#tiered-pricing
Take a look at that and let me know if it would fit your use-case
it wouldn't for 1 reason, the pricing of the addons would vary depending on package chosen .
if package 1 has each extra post addon for $5, package 2 will have the addons for $3, package 3 for even less and such
the way i went with them is i created them as individual products and handle the logic of choosing from my backend before sending the price_id to stripe to create a payment.
I've managed to handle all the payments, upgrades and downgrades. just reached a point where if a customer had already purchased said addon when he was on a previous package, then upgraded and the amount of posts provided by the package isn't enough to cancel all his purchased addons, i need to charge him using the new package's price, which means a new price_id
but that is to be charged when the old subscription reaches it's expiry
Ah okay I see. Thanks for clarifying.
Then yes, a Sub Schedule would be the right way to go here where you can create a phase for when the current cycle ends and have it update the Sub to the new Price at that point
could you elaborate more on this point:
you can create a phase for when the current cycle ends and have it update the Sub to the new Price at that point
as what i was doing is cancelling the whole subscription and just create a subscription schedule at a future time (when the subscription ends) with the new prices
Ah yeah no I'd add a Schedule to the current Sub where phase 0 is the current Price of the Sub, then add a phase 1 which starts at the end of Phase 0's billing cycle and moves the Sub to your new Price. Have you taken a read through https://stripe.com/docs/billing/subscriptions/subscription-schedules for how Sub Schedules work?
yup i'm reading through that but a got a bit confused with phases ๐
Gotcha. So you can see a simple example at https://stripe.com/docs/api/subscription_schedules/create
so iterations is the phase number? i
Basically you want a two step process where you create the Schedule with from_subscription
Then you can retrieve that Sub Schedule to see what the phase 0 should look like when you make the update. Then you create a phase 1 with the new information.
I'd say give it a try and show me what you have if you run into an error or issue and then I can help you from there
Will do ๐ Thank you so much bismarck