Happy Business Starts Here

Highlighted
Support SME

Why the result of BillingPreviewRun is different from the subscription preview?

We need to get the billing preview data through API but we are getting a much larger population of data, which is rendering the data un-usable as is. We’re expecting the data be consistent with subscription preview.






If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √

1 REPLY 1
Support SME

Re: Why the result of BillingPreviewRun is different from the subscription preview?

 Since BillingPreviewRun is used for getting the preview of multiple accounts in certain Billing Batch, the result data would be much larger than the result of preview for single subscription.
 
And that is similar even if we use "BillingPreview" instead of "BillingPreviewRun" because there might be multiple subscriptions under one account.
That is to say, the preview result would be same as in UI only when there is just 1 account under the specified batch and there is just 1 subscription under that account. Please see below as example:
 
There is a subscription got preview result in UI as below when specify Target Date as 06/01/2016:

 

11.png

Since the subscription is the only subscription under the account, so when using BillingPreview through API, the result would be same:

 

 

[REQUEST]

<ns1:billingPreview>
  <ns1:requests>
    <ns1:AccountId>2c92c0f9555cf11d0155710b5c865ace</ns1:AccountId>
    <ns1:TargetDate>2016-06-01T00:00:00</ns1:TargetDate>
    <ns1:IncludingEvergreenSubscription>true</ns1:IncludingEvergreenSubscription>
  </ns1:requests>
</ns1:billingPreview>

 

[RESPONSE]

<ns1:billingPreviewResponse xmlns:ns1="http://api.zuora.com/">
<ns1:results>
<ns1:AccountId>2c92c0f9555cf11d0155710b5c865ace</ns1:AccountId>
<ns1:Success>true</ns1:Success>
<ns1:Size>2</ns1:Size>
<ns1:InvoiceItem xmlns:ns2="http://object.api.zuora.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:InvoiceItem">
<ns2:Id>b7063673dd9c4b5faa0243679cfa08a1</ns2:Id>
<ns2:ChargeAmount>300</ns2:ChargeAmount>
<ns2:ChargeDate>2016-06-22T00:56:29.812-07:00</ns2:ChargeDate>
<ns2:ChargeType>Recurring</ns2:ChargeType>
<ns2:ProcessingType>0</ns2:ProcessingType>
<ns2:Quantity>1</ns2:Quantity>
<ns2:RatePlanChargeId>2c92c0f8555ce5cc0155710b95062d5a</ns2:RatePlanChargeId>
<ns2:ServiceEndDate>2016-05-31T00:00:00.000-07:00</ns2:ServiceEndDate>
<ns2:ServiceStartDate>2016-05-01T00:00:00.000-07:00</ns2:ServiceStartDate>
<ns2:SubscriptionId>2c92c0f8555ce5cc0155710b94e82d54</ns2:SubscriptionId>
</ns1:InvoiceItem>
<ns1:InvoiceItem xmlns:ns2="http://object.api.zuora.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:InvoiceItem">
<ns2:Id>34d75a8fe31f4e0baec2ebdfaeb6ca29</ns2:Id> <ns2:ChargeAmount>300</ns2:ChargeAmount>
<ns2:ChargeDate>2016-06-22T00:56:29.812-07:00</ns2:ChargeDate>
<ns2:ChargeType>Recurring</ns2:ChargeType>
<ns2:ProcessingType>0</ns2:ProcessingType>
<ns2:Quantity>1</ns2:Quantity>
<ns2:RatePlanChargeId>2c92c0f8555ce5cc0155710b95062d5a</ns2:RatePlanChargeId>
<ns2:ServiceEndDate>2016-06-30T00:00:00.000-07:00</ns2:ServiceEndDate>
<ns2:ServiceStartDate>2016-06-01T00:00:00.000-07:00</ns2:ServiceStartDate>
<ns2:SubscriptionId>2c92c0f8555ce5cc0155710b94e82d54</ns2:SubscriptionId>
</ns1:InvoiceItem>
</ns1:results>
</ns1:billingPreviewResponse>

 

 

Since the Billing Batch which the account belongs to only has this one account, "BillingPreviewRun" could also get the same result as below:

<ns1:create>
    <ns1:zObjects xsi:type="ns2:BillingPreviewRun">
        <ns2:Batch>Batch7</ns2:Batch>
        <ns2:IncludingEvergreenSubscription>True</ns2:IncludingEvergreenSubscription>
        <ns2:TargetDate>2016-06-01T00:00:00</ns2:TargetDate>
    </ns1:zObjects>
</ns1:create>
 
Here is the result file
12.png





If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √