Usage
Usage is the amount of resources a customer uses. You track the usage of metered resources, then charge based on the amount that your customers consume.
Usage is always billed in arrears. For example, you bill in November for usage consumed in October. You can bill usage on a recurring, monthly, quarterly, semi-annual, and annual basis.
Use the Usage object to import the quantity of units that customers use of a product, such as the number of page loads on a wiki. To load usage data, you send a create() call. If usage data isn't in an invoice yet, then you can modify usage data with an update() or delete() call.
You can send a maximum of 50 usage records in a single batch call. If you have a larger amount of usage data to upload, then consider creating a .csv file, then use the Import
object instead of the Usage object.
Supported Calls
You can use this object with the following calls:
Walkthroughs and use cases
Here are some common ways to use this object:
- Upload usage data of metered resources.
- Change that usage data, including deleting it.
- Query usage data in preparation for invoicing.
- Update usage custom fields after usage has been processed.
Field Descriptions
All field names are case sensitive. Check enumerated values in descriptions to confirm capitalization and spacing. See Field Types for additional information.
Name | Required? | Allowed Operations | Description |
---|---|---|---|
optional |
Create |
The ID of the account associated with the usage data. This field is required if no value is specified for the Type: zns:ID |
|
AccountNumber |
optional |
Create |
The number of the account associated with the usage data. This field is required if no value is specified for the Type: string |
AncestorAccountId |
optional |
Filter |
A filter option for querying all subscriptions under the same account hierarchy. Type: zns:ID |
optional |
Create |
The OrginalId of the rate plan charge related to the usage record, e.g., Type: zns:ID |
|
optional |
Create |
A unique number for the rate plan charge related to the usage record, e.g., Type: string |
|
CreatedById |
optional |
Query |
The user ID of the person who uploaded the usage records. Type: zns:ID |
CreatedDate |
optional |
Query |
The date when the usage was generated. Type: dateTime |
Description |
optional |
Create |
A description of the usage data. Type: string |
EndDateTime |
optional |
Create |
The end date and time of a range of time when usage is tracked. Use this field for reporting; this field doesn't affect usage calculation. Type: dateTime |
optional |
Query |
The ID of this object. Upon creation, the ID for this object is Type: zns:ID |
|
ImportId |
optional |
Query |
The ID of an import that successfully imported usage data. This value comes from using the Type: zns:ID |
optional |
Filter |
If this usage has been invoiced, the ID of the invoice. Type: zns:ID |
|
optional |
Filter |
If this usage has been invoiced, the number of the invoice. Type: string |
|
Quantity |
required |
Create |
Indicates the number of units used. Type: decimal |
RbeStatus |
optional |
Query |
Indicates if the rating and billing engine (RBE) processed usage data for an invoice. Type: string (enum) |
SourceName |
optional |
Query |
The name of the source file that contains usage data. This field is generated from the name of the file uploaded in the web-based UI. Type: string |
SourceType |
optional |
Query |
Indicates if the usage records were imported from the web-based UI or the API. Type: string (enum) |
StartDateTime |
required |
Create |
The start date and time of a range of time when usage is tracked. Zuora uses this field value to determine the usage date. Unlike the Type: dateTime |
SubmissionDateTime |
optional |
Query |
The date when usage was submitted. The value of Type: dateTime |
optional |
Create |
The OriginalId of the subscription that contains the fees related to the usage data. Type: zns:ID |
|
optional |
Create |
The name* of the subscription that contains the fees related to the usage data. Type: string *Note that the "subscription number" in the Usage object corresponds to the value of the subscription "name" field in the Subscription object. |
|
UniqueKey | optional |
Create |
Note: The field is only available if you have Prepaid with Drawdown feature enabled. A customer-defined specific identifier of a usage record. Type: string Character limit: 255 Version notes: WSDL 114+ Values: any string value as defined by customer, for example, UK123. If not specified, its value will be ‘null’ by default. When you upload a usage record and specify the unique key, the system will check if there is an existing usage record with the same unique key. See this article for details. |
UOM |
required |
Create |
Specifies the units to measure usage. Units of measure are configured in the web-based UI. Your values depend on your configuration in Z-Billing > Settings. Type: string |
UpdatedById |
optional |
Query |
The ID of the user who last updated the usage upload. Type: zns:ID |
UpdatedDate |
optional |
Query |
The date when the usage upload was last updated. Type: dateTime |
Additional Field Detail
AccountId
The ID of the account associated with the usage data. This field is required if no value is specified for the AccountNumber field.
Usage data is associated primarily with a specific account. When you bill an account, the invoice includes all the usage-based fees in the billing period. If accounts can have multiple subscriptions, then you can specify charge and subscription information in other fields to prevent repeated counting of usage data. These other fields are the following:
ChargeId
orChargeNumber
SubscriptionId
orSubscriptionNumber
ChargeId, ChargeNumber
The ID or number of the rate plan charge for fees related to the usage data. Use the ChargeId or ChargeNumber fields to connect usage to its charge. Use SubscriptionId
or SubscriptionNumber
to apply usage data to all charges with the same unit of measure in the subscription.
If you omit all of the fields ChargeId
, ChargeNumber
, SubscriptionId
, and SubscriptionNumber
, then usage is billed against all charges associated with the account that have the same UOM
values. The two charge-related fields, ChargeId
and ChargeNumber
, connect usage with a specific charge. The two subscription-related fields, SubscriptionId
and SubscriptionNumber
, connect usage with a specific subscription.
ChargeId changes each time an amendment is performed, however ChargeNumber
does not, which makes it useful for tracking the charge.
Id
The ID of this object. Every object has a unique identifier that Zuora automatically assigns upon creation. You use this ID later when you work with the object. For example, if you send an amend()
call to modify an existing subscription, then you need to include the specific Subscription object's ID with the call.
The ID for the Usage
object is UsageId
.
InvoiceId, InvoiceNumber
If the usage record has been invoiced to the customer, it will contain an automatically-generated invoice ID and an invoice number. As of WSDL 33.0, you can include the invoice ID and/or the invoice number in the WHERE clause of your query. This allows you, for instance, to retrieve all the usage details for a particular invoice. Note that the invoice ID and invoice number are not queryable fields; the SOAP API will not return these fields in the result.
SubscriptionId, SubscriptionNumber
The original ID or number of the subscription that contains the fees related to the usage data. Use the ChargeId
or ChargeNumber
field to connect usage to its charge. Use SubscriptionId
or SubscriptionNumber
to apply usage data to all charges with the same unit of measure in the subscription.
If you omit all of the fields ChargeId
, ChargeNumber
, SubscriptionId
, and SubscriptionNumber
, then usage is billed against all charges associated with the account that have the same UOM
values. The two charge-related fields, ChargeId
and ChargeNumber
, connect usage with a specific charge. The two subscription-related fields, SubscriptionId
and SubscriptionNumber
, connect usage with a specific subscription.
Note that ChargeId
and SubscriptionId
are original IDs of the rate plan charge and the subscription.
Custom Fields
In the Usage object, you can update custom fields using the SOAP API even if the object has a processed status. Only custom fields can be updated in this way. If you try to update any standard fields after the object has been processed, you will receive a ValidateException
error.
Example
Request
<soapenv:Body> <api:update> <api:zObjects xsi:type="ns2:Usage"> <obj:Id>402891f74c443614014c44f93bde07ae</obj:Id> <obj:Index1__c>Index_test</obj:Index1__c> <obj:Field__c>Field_test</obj:Field__c> <obj:Country__c>Japan</obj:Country__c> </api:zObjects> </api:update> </soapenv:Body>
Response
<soapenv:Body> <ns1:updateResponse xmlns:ns1="http://api.zuora.com/"> <ns1:result> <ns1:Id>402891f74c443614014c44f93bde07ae</ns1:Id> <ns1:Success>true</ns1:Success> </ns1:result> </ns1:updateResponse> </soapenv:Body>
See Custom Fields for more information about custom fields.