Within the “Your APIs” tab you can choose ‘Billing API’. After you have generated an API key you have access to the environment for which the API key was generated. The image below shows 3 tabs of which the ‘DEV Key “test”’ is selected.
Above you can also see that there are currently 4 endpoints which can provide you of relevant data: consolidatedinvoices, customerinvoices, invoices and subscriptiondetails. The ‘API version’ select box defaults to ‘No version selected’. Here one can choose between v2 and v3. This document focuses on the v3 API version.
After selecting the v3 version and expanding one of the endpoints e.g. consolidatedinvoices a GUI is displayed as shown below in Image 3. The ‘Accept Header’ normally is set to “None (defaults to XML)” indicating that XML is de default format used. In this select box you can choose application/json if wanted. There are also input fields for Start and End Date. After you fill in these dates and click on the url that will appear in green color the requested data is retrieved. Depending on the format you chose a .xml (default) or .json file is downloaded to your local system.
2.1 Consolidatedinvoices XML
The downloaded file in xml format has the following structure:
As image 4. shows the ConsolidatedInvoice xml has a Root element with the same name. It contains one <Invoices> element which is a collection of 1 or more <Invoice> elements (these will be further explained in $3.1 Invoice element). This <Invoice> consists of a <Header>, <Sender>, <Receiver>, <Customers> and <Totals> element. Typical for a consolidatedinvoice xml is that the <Totals> element consists of a <TotalPurchases> and <TotalSales> element.
2.2 Customerinvoices XML
The root element in the customerinvoices xml is called <InvoiceResponse>. As shown above this contains multiple <Invoice> elements. Each element is made up of the same sub-elements as described in $2.1 except that here the <Totals> element is NOT divided in a <TotalPurchases> and <TotalSales> element.
2.3 Invoices XML
Root element in the invoices xml is also called <InvoiceResponse> and contains one <Invoice> element of the same structure as in the customerinvoices xml file.
2.4 Subscriptiondetails XML
The subscriptiondetails xml has a root element <SubscriptionDetails> consisting of <Subscription>, <ServicePlan>, <ServicePlanPeriod> and <Resources>. In $3.6 you can find a more detailed explanation of this root element.