#becca-schedules-phaseinvoice
1 messages · Page 1 of 1 (latest)
becca-schedules-phaseinvoice
@pliant belfry I don't really grasp what you are trying to do/describe. Can you give a simple concrete example?
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
That's not really possible
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
I would track this in my database I think so that when I get the next cycle I'd match things together
I do have a record that stores the schedule id, thinking I'd be able to match that from an invoice property haha
yeah that would work
I mean, that's what I have now and asking about because it's not possible hehe
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
there's nothing on the invoice object that indicates the schedule though
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
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?
No that's not possible
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
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