API effects in plan changes

Frank Koehl's Avatar

Frank Koehl

10 Mar, 2010 10:05 PM

When a user switches plans, the past plans are shown in the output of an API call to /customers/get, however these past plans are not clearly defined as "not the current plan" (so to speak). The only difference I can see in my example is the lack of an invoices sub-object, and that's because I switched between several plans during a trial period.

What if a user has invoices under an old plan, then switches to a new one? There's effectively no way to programmatically distinguish between them in that situation.

I know that the current plan shows up as the first object under subscriptions -- i.e. sub1 is current, sub2 is past, sub3 is past, etc -- but is that really the only way to determine the current subscription plan? I feel like a more definitive flag of some sort would be safer and more effective. Why not set the canceledDatetime flag?

For an example, look up this customer:
ddf35ae6-784c-102d-b8e8-40402145ee8b

  1. Support Staff 1 Posted by Marc Guyer on 11 Mar, 2010 03:29 PM

    Marc Guyer's Avatar

    The current subscription record is as you say, the first one. It is also the one with the latest createdDatetime. We've considered adding a flag for 'isActive' or something similar but only because we'd like to implement a feature where a single customer could have multiple active plans. In that case, we'd probably add an 'ancestorId' to subscription to show the lineage. As it stands, the lineage is simply chronological. So, to answer your question, yes, this is the only way and is a definitive way to determine the active subscription record.

    That leaves this concern:

    What if a user has invoices under an old plan, then switches to a new one? There's effectively no way to programmatically distinguish between them in that situation.

    I'm not sure what you're asking here. I think you mean "How are invoices under an old plan represented?" The answer to that question is invoices billed under an old subscription are contained within that subscription. You're seeing subscription nodes in the example customer's xml without invoices because the customer was never billed under that subscription record.

  2. Marc Guyer closed this discussion on 18 May, 2010 01:53 PM.

Discussions are closed to public comments.
If you need help with Cheddar please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

28 Mar, 2024 10:45 PM
24 Jan, 2024 08:33 AM
11 Jan, 2024 07:13 AM
30 Nov, 2023 02:07 AM
22 Nov, 2023 08:41 AM