- 26 Oct 2024
- 5 Minutes to read
- Print
- DarkLight
- PDF
Get invoice line items for all the customers and latest billing period
- Updated on 26 Oct 2024
- 5 Minutes to read
- Print
- DarkLight
- PDF
URL
POST https://contoso-prod-api.azurewebsites.net/api/invoices/Download/v3/BillingPeriods/{billingperiodid}
{{billingperiodid}} – This is an optional parameter. Pass a value to this parameter to get the details for a particular billing period.
Request headers
Key | Value |
Authorization | Bearer <access_token> |
Content-Type | Application/json |
Request body
Payload | Description |
{ "TenantIds":"<tenantids-as-comma-separated-values>" } | The body for this request is optional. If the body is left blank, the API would return the invoice line items for all the active customers. |
Response body
An example response for the request to get active customers is as follows:
{
"OperationType": null,
"Status": "Success",
"RequestCorrelationID": "37a20015-c6d1-443c-aeea-377b0e17f059",
"ErrorMessage": null,
"ErrorDetail": null,
"Data": [
{
"CustomerBillingType": null,
"ERPCustomerID": "409872RD",
"CRMOpportunityID": "CRM-5544567"
"CouponDiscountPercentage": null,
"ProviderOfferId": "78991911-35A7-4320-92C9-DDE63C540A20",
"SubscriptionEndDate": "2024-09-24T00:00:00",
"ProviderCategory": null,
"Category": "Custom",
"ProductSKUId": "AF7D8CA4-4B47-49F8-9B0C-9F1F4651CAA2",
"UniqueProviderOfferId": "78991911-35A7-4320-92C9-DDE63C540A20",
"UnitPriceOfProduct": 6.00000000,
"ReservationOrderId": null,
"InvoiceEntity": "Customer",
"ResellerName": null,
"ProviderInvoiceNumber": "G012345678",
"TenantID": "12hgyu80-434a-4c4a-n009-2cd1e1500b2d",
"SubscriptionID": "60c29efd-434a-4c4a-a008-2cd1e1500b2d",
"CurrencyCode": "USD",
"AlternateId": null,
"ItemCode": "",
"CustomerName": "Contoso",
"InvoiceNumber": "Invoice_Contoso_20241008_USD",
"InvoiceGeneratedDate": "2024-10-08T00:00:00",
"InvoiceDueDate": "2024-10-26T00:00:00",
"SubscriptionName": "Microsoft 365 Business Essential",
"ChargeStartDate": "2024-09-24T00:00:00",
"ChargeEndDate": "2024-10-23T00:00:00",
"LineItemType": "RenewalFee",
"Quantity": 1.00000000,
"UnitPrice": 6.00000000,
"InvoiceLineAmount": 6.00000000,
"DiscountAmount": null,
"TaxAmount": 0.00000000,
"PreTaxAmount": 6.00000000,
"PostTaxAmount": 6.00000000,
"TaxPercentage": 0.00000000,
"SubscriptionType": "Custom",
"OfferCode": "P-Custom",
"TaxCode": null,
"OfferID": "78991911-35A7-4320-92C9-DDE63C540A20",
"InternalBillingID": "78349900",
"CostOnPartner": 4.00000000,
"PONumber": "6655",
"Notes": "Customer is tax exempted, please do not apply any taxes while sending from Business Central",
"OwnerEntity": "Customer",
"OwnerName": "Contoso"
},
Here is the explanation for the properties in the response (JSON)
Property | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
OperationType | Can be ignored | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Status | Indicates the status of the request. Possible values – Success / Error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
RequestCorrelationID | Internal ID generated by C3 for correspondence for troubleshooting issues, if any. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ErrorMessage | Message in case the request runs into an error during processing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ErrorDetail | Additional detail related to the error in case there is an error while processing the request | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Data | Contains a list of billing period objects represented by the following attributes:
|
Error response
The API validates the input parameters – billing period id and the tenant Ids and returns 400 – Bad request error in case the input is found to be invalid.
A sample bad request error covering both the attributes is as follows:
{
"OperationType": null,
"Status": "Error",
"RequestCorrelationID": "3a0ce2d6-e8b6-402f-a926-10f5a7e0f2bb",
"ErrorMessage": "ERROR_DESC_BAD_INPUT",
"ErrorDetail": "ERROR_DESC_BAD_INPUT",
"Data": [
{
"Atribute": "BillingPeriodId",
"AtributeKey": "BILLING_PERIOD_ID",
"Message": "Invalid Billing Period. Should be one of the 9 most recent billing periods",
"DefaultMessage": "INVALID_BILLING_PERIOD_ID",
"Value": "2323
]
}
The following table explains the constituents of the response in detail:
Property | Description |
OperationType | Can be ignored |
Status | Indicates the status of the request. Possible values – Success / Error |
RequestCorrelationID | Internal ID generated by C3 for correspondence for troubleshooting issues, if any. |
ErrorMessage | Message in case the request runs into an error during processing |
ErrorDetail | Additional detail related to the error in case there is an error while processing the request |
Data | Contains a list of validation errors represented by the following attributes:
|