Happy Business Starts Here

0 Kudos

Get current active subscription rate plans

This documentation is unclear: https://www.zuora.com/developer/api-reference/#operation/GET_SubscriptionsByAccount

It claims to return the most recent subscription version.  However, it returns all rate plans that have ever existed on the account even if they've been removed.  That wasn't obvious based on the documentation.  I believe it's possible to figure out the current state based on the lastChangeType on the rate plan and the effective start and end dates on the rate plan charges, but it involves a lot of logic.  Can a feature be added for this use case or is there already an easier way to query the current state of a subscription?  Either way I think the documentation could be updated.

1 Comment
Master

Hi @jonconley_sg

 

I agree with your argument. I think that it is strange that the removed RatePlans hit.
However, there is a way to identify the removed RatePlans. We can use "Query Parameters".
("Query Parameters" are mentioned in the documentation: https://www.zuora.com/developer/api-reference/#operation/GET_SubscriptionsByAccount)

 

That is, instead of using the following endpoint,

https://rest.apisandbox.zuora.com/v1/subscriptions/accounts/{account-key}

We use the following endpoints:

https://rest.apisandbox.zuora.com/v1/subscriptions/accounts/{account-key}?charge-detail=current-segment

That way, RatePlan that was removed in the past will not hit (*).

 

* Strictly speaking, this is not a correct description.
Even with this Query Parameters, the removed RatePlans also hits.

However, the "ratePlanCharges" field of that RatePlans are empty.

Therefore, you can identify removed RatePlans without using a lot of logic.

 

Will this help you?