Every time you create an amendment for a subscription, a new version of that subscription along with a copy of all of its dependent objects is created. These objects may include multiple rate plans, rate plan charges, and rate plan charge tiers. Each of these objects will get their own new Id and the amended original subscription’s status will be changed to "expired." As an example, this outlined procedure can be used on a customer portal to show the current state of a customer's subscription.
Below is a graphical representation of an account with three versions of its subscription:
The following objects and fields will be used to help determine the current rate plan charges and map back to active subscriptions:
Note: this is intended for API versions 24 and above.
A rateplancharge, like rateplan, is part of a subscription. Each subscription can have one or more rate plans, and each rate plan can have one or more rate plan charges. Rate plan charges are the actual charges for the services (rate plans) that you are giving, and can be of different types: for example, one-time fees, monthly recurring fees, usage fees, and so on.
Every time a charge is changed through an amendment, Zuora will create a new segmented rateplancharge. For example, If you have a subscription with an annual charge that has an EffectiveStartDate = January 1, EffectiveEndDate = December 31, and then you have an amendment in the middle of the effective dates, on June 1, you would have 2 segments. Segment 1 with effective dates January 1 to May 31 and segment 2 with effective dates June 1 to December 31. You can now quickly and easily parse a charge's history, know when price or quantity were changed, and if there are any future pending changes to a charge. By default, Zuora will now return a rateplancharge for each segment of the charge. You can use RatePlanCharge.Segment, RatePlanCharge.EffectiveEndDate, and RatePlanCharge.EffectiveStartDate to quickly:
<ns1:query> <ns1:queryString>Select Id from Account where AccountNumber='0000001'</ns1:queryString> </ns1:query>
<ns1:query> <ns1:queryString>Select Id from Subscription where AccountId='xxxx0000001' and Status='Active'</ns1:queryString> </ns1:query>
<ns1:query> <ns1:queryString>Select Id from RatePlan where SubscriptionId='xxxx0000001'</ns1:queryString> </ns1:query>
<ns1:query> <ns1:queryString>Select Id, RatePlanId, EffectiveStartDate, EffectiveEndDate, Segment, IsLastSegment from RatePlanCharge where RatePlanId='xxxx0000001'</ns1:queryString> </ns1:query>