CRUD: Post or cancel a bill run

Posts or cancels a bill run.

Post a Bill Run

Posting a bill run is an asynchronous operation. To post a bill run, the current bill run must have a status of Completed.

When a bill run is posted, its status is changed to PostInProgress. Once all invoices for this bill run are posted then its status is changed to Posted.

When you post a bill run and query the status of a bill run, you will get one of the following results PostInProgress, Completed, or Posted. If all invoices in the bill run are posted, then the status of the bill run is Posted. If one or more invoices fail to post, the status will change back to Completed and you will need to post the bill run again.

Cancel a Bill Run

Canceling a bill run is an asynchronous operation. When canceling a bill run, the logic is the same as when using the UI to cancel a bill run. You need to provide the BillRunId, and set the Status to Canceled.

When canceling a bill run, consider the following:

  • Canceling a bill run with a Completed status.
    • Only the current bill run will be canceled.
  • Canceling a bill run with a Pending status.
    • When canceling an Ad-hoc bill run, only the current bill run will be canceled.
    • When canceling a scheduled bill, all scheduled bill runs will be canceled.

The Cancel operation may not be successful. Its success depends on its current business validation. Only a bill run that has no posted invoices can be canceled. If any posted invoices belong to the bill run then an invalid value exception will be thrown with the message, "The Bill Run cannot be Cancelled, There are Posted invoices."

Request
path Parameters
id
required
string

Object id

query Parameters
rejectUnknownFields
boolean
Default: false

Specifies whether the call fails if the request body contains unknown fields. With rejectUnknownFields set to true, Zuora returns a 400 response if the request body contains unknown fields. The body of the 400 response is:

{
    "message": "Error - unrecognised fields"
}

By default, Zuora ignores unknown fields in the request body.

header Parameters
Accept-Encoding
string

Include the Accept-Encoding: gzip header to compress responses as a gzipped file. It can significantly reduce the bandwidth required for a response.

If specified, Zuora automatically compresses responses that contain over 1000 bytes of data, and the response contains a Content-Encoding header with the compression algorithm so that your client can decompress it.

Content-Encoding
string

Include the Content-Encoding: gzip header to compress a request. With this header specified, you should upload a gzipped file for the request payload instead of sending the JSON payload.

Authorization
string

The value is in the Bearer {token} format where {token} is a valid OAuth token generated by calling Create an OAuth token.

Zuora-Entity-Ids
string

An entity ID. If you have Zuora Multi-entity enabled and the OAuth token is valid for more than one entity, you must use this header to specify which entity to perform the operation in. If the OAuth token is only valid for a single entity, or you do not have Zuora Multi-entity enabled, you do not need to set this header.

Zuora-Track-Id
string <= 64 characters

A custom identifier for tracing the API call. If you set a value for this header, Zuora returns the same value in the response headers. This header enables you to associate your system process identifiers with Zuora API calls, to assist with troubleshooting in the event of an issue.

The value of this field must use the US-ASCII character set and must not include any of the following characters: colon (:), semicolon (;), double quote ("), and quote (').

Request Body schema: application/json
required
Status
required
string

The status for this bill run. See Status Types for more information.

To cancel a bill run, specify Canceled. To post a bill run, specify Posted.

Character limit: 20

Values:

  • Pending
  • Processing
  • Completed
  • Error
  • Canceled
  • Posted
InvoiceDate
string <date>

The new invoice date of all invoices invloved in the bill run, or the new memo date of all credit memos invloved in the bill run. The date cannot fall in a closed accounting period.

This field takes effect only when Status is set to Posted.

Note: The Credit and Debit Memos feature is only available if you have Invoice Settlement enabled. The Invoice Settlement feature is generally available as of Zuora Billing Release 296 (March 2021). This feature includes Unapplied Payments, Credit and Debit Memo, and Invoice Item Settlement. If you want to enable Invoice Settlement, see Invoice Settlement Enablement and Checklist Guide for more information.

Responses
200
401
put/v1/object/bill-run/{id}
Request samples
application/json
{
  • "Status": "Posted",
  • "InvoiceDate": "2020-02-18"
}
Response samples
application/json
{
  • "Success": true,
  • "Id": "2c92c0f959d961e1015a0872b69a7347"
}