$apiInstance = new Fastly\Api\BillingApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
Method | Fastly API endpoint | Description |
---|---|---|
getInvoice() | GET /billing/v2/year/{year}/month/{month} | Get an invoice |
getInvoiceById() | GET /billing/v2/account_customers/{customer_id}/invoices/{invoice_id} | Get an invoice |
getInvoiceMtd() | GET /billing/v2/account_customers/{customer_id}/mtd_invoice | Get month-to-date billing estimate |
getInvoice($options): \Fastly\Model\BillingResponse // Get an invoice
Get the invoice for a given year and month. Can be any month from when the Customer was created to the current month.
$options['month'] = 05; // string | 2-digit month.
$options['year'] = 2020; // string | 4-digit year.
try {
$result = $apiInstance->getInvoice($options);
} catch (Exception $e) {
echo 'Exception when calling BillingApi->getInvoice: ', $e->getMessage(), PHP_EOL;
}
Note: the input parameter is an associative array with the keys listed below.
Name | Type | Description | Notes |
---|---|---|---|
month | string | 2-digit month. | |
year | string | 4-digit year. |
[Back to top] [Back to API list] [Back to README]
getInvoiceById($options): \Fastly\Model\BillingResponse // Get an invoice
Get the invoice for the given invoice_id.
$options['customer_id'] = 'customer_id_example'; // string | Alphanumeric string identifying the customer.
$options['invoice_id'] = 'invoice_id_example'; // string | Alphanumeric string identifying the invoice.
try {
$result = $apiInstance->getInvoiceById($options);
} catch (Exception $e) {
echo 'Exception when calling BillingApi->getInvoiceById: ', $e->getMessage(), PHP_EOL;
}
Note: the input parameter is an associative array with the keys listed below.
Name | Type | Description | Notes |
---|---|---|---|
customer_id | string | Alphanumeric string identifying the customer. | |
invoice_id | string | Alphanumeric string identifying the invoice. |
[Back to top] [Back to API list] [Back to README]
getInvoiceMtd($options): \Fastly\Model\BillingEstimateResponse // Get month-to-date billing estimate
Get the current month-to-date estimate. This endpoint has two different responses. Under normal circumstances, it generally takes less than 5 seconds to generate but in certain cases can take up to 60 seconds. Once generated the month-to-date estimate is cached for 4 hours, and is available the next request will return the JSON representation of the month-to-date estimate. While a report is being generated in the background, this endpoint will return a 202 Accepted
response. The full format of which can be found in detail in our billing calculation guide. There are certain accounts for which we are unable to generate a month-to-date estimate. For example, accounts who have parent-pay are unable to generate an MTD estimate. The parent accounts are able to generate a month-to-date estimate but that estimate will not include the child accounts amounts at this time.
$options['customer_id'] = 'customer_id_example'; // string | Alphanumeric string identifying the customer.
$options['month'] = 05; // string | 2-digit month.
$options['year'] = 2020; // string | 4-digit year.
try {
$result = $apiInstance->getInvoiceMtd($options);
} catch (Exception $e) {
echo 'Exception when calling BillingApi->getInvoiceMtd: ', $e->getMessage(), PHP_EOL;
}
Note: the input parameter is an associative array with the keys listed below.
Name | Type | Description | Notes |
---|---|---|---|
customer_id | string | Alphanumeric string identifying the customer. | |
month | string | 2-digit month. | [optional] |
year | string | 4-digit year. | [optional] |