#becca-schedules-phaseinvoice

1 messages · Page 1 of 1 (latest)

fickle sunBOT
proper tusk
#

becca-schedules-phaseinvoice

#

@pliant belfry I don't really grasp what you are trying to do/describe. Can you give a simple concrete example?

pliant belfry
#

we're doing subscriptions, and for downgrading the level, we're creating a schedule from the subscription and adding another phase that starts at the existing period end with the downgraded price id.

#

when listening to invoice events, trying to differentiate between a regular subscription cycle invoice and one that's from a phase change

proper tusk
#

That's not really possible

pliant belfry
#

hrmm

#

seems like I'm going about things the wrong way but not sure what the alternative would be

#

ultimately, I want the plan to change at the billing cycle and at that billing cycle I want to know that's the reason as opposed to a normal renewal or an immediate plan upgrade

proper tusk
#

I would track this in my database I think so that when I get the next cycle I'd match things together

pliant belfry
#

I do have a record that stores the schedule id, thinking I'd be able to match that from an invoice property haha

proper tusk
#

yeah that would work

pliant belfry
#

I mean, that's what I have now and asking about because it's not possible hehe

proper tusk
#

I don't get it. You can store the schedule info in your database so that when you get the invoice.updated Event you can look at that record and notice the change

pliant belfry
#

there's nothing on the invoice object that indicates the schedule though

proper tusk
#

I mean the Invoice is associated with a Subscription, that Subscription is associated with a Schedule. You should have both sub_123 and sub_sched_123 in your database to map things

pliant belfry
#

yeah, I could just look up by subscription and test for existence, that'll work when it's the next invoice that the change happens. but it wouldn't work if it was like "agree to pay a year and we'll give you monthly price of $10 instead of $12", in that I'd need a date to go with it

#

if I have a schedule phase with iterations instead of end date, can I get the calculated end date that I could store?

proper tusk
#

No that's not possible

pliant belfry
#

huh I was just gonna say it was because looking at the api docs the schedule object has a phase.end_date but no phase.iterations

proper tusk
#

Ah yeah maybe phase.end_date works if you have X months for an iteration. I'd recommend testing it in Test mode to confirm

pliant belfry
#

yeah the upsert has both end_date and iterations, but the actual schedule object just has end_date

#

have gone to lunch so can't test at the moment

#

will be back to the drawing board yet again this afternoon heh

#

thanks