#Jayy

1 messages ยท Page 1 of 1 (latest)

little sluiceBOT
celest kraken
#

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!

muted vortex
#

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?

celest kraken
muted vortex
#

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

nocturne heron
#

๐Ÿ‘‹

#

stepping in

#

Let's back up a moment here

#

We have tiered Pricing

#

Are you using that?

muted vortex
#

can you please explain the tiered pricing?

nocturne heron
#

Take a look at that and let me know if it would fit your use-case

muted vortex
#

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

nocturne heron
#

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

muted vortex
#

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

nocturne heron
muted vortex
#

yup i'm reading through that but a got a bit confused with phases ๐Ÿ˜†

nocturne heron
muted vortex
#

so iterations is the phase number? i

nocturne heron
#

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

muted vortex
#

Will do ๐Ÿ™‚ Thank you so much bismarck