Bill
Last Updated:2020-07-20
Generating charge bills and providing resource-level bills are the basic core functions of the trading system of Baidu AI Cloud.
// Query bill of the currently logging in user 
public static void getBills(BillingClient billingClient) {
   ResourceMonthBillRequest request = new ResourceMonthBillRequest();
   // Set month of the bill 
   request.setMonth("2019-02");
   // Set to query postpayment bill 
   request.setProductType("postpay");
   // Set to query resource bill of CDS product 
   request.setServiceType("CDS");
   // Set paging mark 
   request.setPageNo(1);
   // Set size of paging return data 
   request.setPageSize(50);
   
   ResourceMonthBillResponse response = billingClient.getResourceMonthBill(request);
}
// Query bill of the master account��s sub-accounts in the financial circle 
public static void getBills(BillingClient billingClient) {
   ResourceMonthBillRequest request = new ResourceMonthBillRequest();
   // Set month of the bill 
   request.setMonth("2019-02");
   // Set to query postpayment bill 
   request.setProductType("postpay");
   // Set to query resource bill of CDS product 
   request.setServiceType("CDS");
   // Set accountId of the sub-account added to the financial circle, which shall be the same enterprise or organization, otherwise it will be considered as unauthorized access 
   request.setQueryAccountId("XXX");
   // Set paging mark 
   request.setPageNo(1);
   // Set size of paging return data 
   request.setPageSize(50);
   
   ResourceMonthBillResponse response = billingClient.getResourceMonthBill(request);
}1.A maximum of 100 bills can be queried at one time. 2.Only the master account is allowed to check bills of other accounts for others, and the account queried shall be the sub-account of the enterprise or organization where the master account is located and shall be added to the financial circle of enterprise financial management.
