Happy Business Starts Here

How does BillingPreviewRun work?

Zuora Support Moderator

How does BillingPreviewRun work?

Question:  Can you explain how BillingPreviewRun works?



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

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Zuora Support Moderator

Re: How does BillingPreviewRun work?

Response:

Using this Knowledge Center page as a reference: BillingPreviewRun (NOTE: This feature is currently in limited availability).

The feature itself will allow you create a CSV file that contains a preview of a bill run of what the potential invoice items will be.


Using this feature will require two API calls:

1) Use a create() call where you include the TargetDate field (required).
2) Use the Id from the create call to do a query() call which will give you the ResultsFileURL which you can use to download the generated file.

For example, this is what my create() call looks like:

 

 

<ns1:create>
    <ns1:zObjects xsi:type="ns2:BillingPreviewRun">
        <ns2:TargetDate>2016-04-01</ns2:TargetDate>
    </ns1:zObjects>
</ns1:create>

 

The response I get gives me an Id.

Using that that Id, I will query:

 

<ns1:query>
    <ns1:queryString>Select Id, CreatedDate, ResultFileUrl From BillingPreviewRun where Id='2c92c0f85388c41e01538b54996708da' </ns1:queryString>
</ns1:query>

 

My response will include the URL:

 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
      <soapenv:Body>
            <ns1:queryResponse xmlns:ns1="http://api.zuora.com/">
                  <ns1:result>
                        <ns1:done>true</ns1:done>
                        <ns1:queryLocator xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="1"></ns1:queryLocator>
                        <ns1:records xmlns:ns2="http://object.api.zuora.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:BillingPreviewRun">
                              <ns2:Id>2c92c0f85388c41e01538b54996708da</ns2:Id>
                              <ns2:CreatedDate>2016-03-18T13:04:50.000-07:00</ns2:CreatedDate>
                              <ns2:ResultFileUrl>https://apisandbox.zuora.com/apps/api/file/2c92c0855388c50301538b54c1b748b7</ns2:ResultFileUrl>
                        </ns1:records>
                        <ns1:size>1</ns1:size>
                  </ns1:result>
            </ns1:queryResponse>
      </soapenv:Body>
</soapenv:Envelope>

 

 

The file that is generated will include these columns of information about the invoice items that would be included on a bill run with the target date.

* Account: ID
* Rate Plan Charge: ID
* Invoice Item: Charge Amount
* Invoice Item: Processing Type
* Invoice Item: Service Start Date
* Invoice Item: Service End Date
* Invoice Item: Charge Date
* Invoice Item: ID
* Subscription: SubscriptionId
* Invoice Item: AppliedToInvoiceItemId
* Invoice Item: Quantity
* Invoice Item: UOM
* Invoice Item: ChargeType


Reference Articles:



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

View solution in original post

1 REPLY 1
Highlighted
Zuora Support Moderator

Re: How does BillingPreviewRun work?

Response:

Using this Knowledge Center page as a reference: BillingPreviewRun (NOTE: This feature is currently in limited availability).

The feature itself will allow you create a CSV file that contains a preview of a bill run of what the potential invoice items will be.


Using this feature will require two API calls:

1) Use a create() call where you include the TargetDate field (required).
2) Use the Id from the create call to do a query() call which will give you the ResultsFileURL which you can use to download the generated file.

For example, this is what my create() call looks like:

 

 

<ns1:create>
    <ns1:zObjects xsi:type="ns2:BillingPreviewRun">
        <ns2:TargetDate>2016-04-01</ns2:TargetDate>
    </ns1:zObjects>
</ns1:create>

 

The response I get gives me an Id.

Using that that Id, I will query:

 

<ns1:query>
    <ns1:queryString>Select Id, CreatedDate, ResultFileUrl From BillingPreviewRun where Id='2c92c0f85388c41e01538b54996708da' </ns1:queryString>
</ns1:query>

 

My response will include the URL:

 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
      <soapenv:Body>
            <ns1:queryResponse xmlns:ns1="http://api.zuora.com/">
                  <ns1:result>
                        <ns1:done>true</ns1:done>
                        <ns1:queryLocator xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="1"></ns1:queryLocator>
                        <ns1:records xmlns:ns2="http://object.api.zuora.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:BillingPreviewRun">
                              <ns2:Id>2c92c0f85388c41e01538b54996708da</ns2:Id>
                              <ns2:CreatedDate>2016-03-18T13:04:50.000-07:00</ns2:CreatedDate>
                              <ns2:ResultFileUrl>https://apisandbox.zuora.com/apps/api/file/2c92c0855388c50301538b54c1b748b7</ns2:ResultFileUrl>
                        </ns1:records>
                        <ns1:size>1</ns1:size>
                  </ns1:result>
            </ns1:queryResponse>
      </soapenv:Body>
</soapenv:Envelope>

 

 

The file that is generated will include these columns of information about the invoice items that would be included on a bill run with the target date.

* Account: ID
* Rate Plan Charge: ID
* Invoice Item: Charge Amount
* Invoice Item: Processing Type
* Invoice Item: Service Start Date
* Invoice Item: Service End Date
* Invoice Item: Charge Date
* Invoice Item: ID
* Subscription: SubscriptionId
* Invoice Item: AppliedToInvoiceItemId
* Invoice Item: Quantity
* Invoice Item: UOM
* Invoice Item: ChargeType


Reference Articles:



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

View solution in original post