> ## Documentation Index
> Fetch the complete documentation index at: https://docs.megaport.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Billing Webhook Events

> This help topic describes the billing webhook events.

export const Anchor = ({name}) => {
  const errorPrefix = '\x1b[31;1;4mERROR\x1b[0m: Anchor -';
  if (name === undefined || name === null || name === 'undefined') {
    console.error(`${errorPrefix} \`name\` must have a value — rendering an empty string instead`);
    return <></>;
  }
  const raw = typeof name === 'string' ? name : JSON.stringify(name);
  const id = raw.replace(/\s+/g, '-').replace(/[^A-Za-z0-9_-]/g, '').replace(/-+/g, '-').replace(/^-+|-+$/g, '');
  if (!id) {
    console.error(`${errorPrefix} \`name\` "${name}" sanitizes to an empty id — rendering an empty string instead`);
    return <></>;
  }
  return <a style={{
    scrollMarginTop: 'var(--scroll-mt)'
  }} id={id}></a>;
};

This topic describes the billing events sent by Megaport's webhooks.

<Anchor name="billing-contract-expiring" />

## billing.contract.expiring

`billing.contract.expiring` is sent when a billing contract is about to expire.

The payload of this event has the following structure:

* `company_uid` (string, UUID)
* `metadata` (object)
  * `environment` (string)
* `schema_version` (string)
* `timestamp` (string, date-time)
* `type` (string)
* `data` (object)
  * `billing_market` (string)
  * `contract_expiry_date` (string, date-time)
  * `is_auto_renew` (boolean)
  * `monthly_rate` (number, double)
  * `renewal_available_date` (string, date-time)
  * `service_name` (string)
  * `service_owner_company_uid` (string, UUID)
  * `service_type` (string)
  * `service_uid` (string, UUID)
  * `term_months` (integer, int32)

For example:

```json theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
{
  "company_uid": "681ef39b-436b-40dd-a914-26391db2689c",
  "metadata": {
    "environment": "production"
  },
  "schema_version": "1",
  "timestamp": "2026-04-23T10:29:12Z",
  "type": "billing.contract.expiring",
  "data": {
    "billing_market": "US",
    "contract_expiry_date": "2027-05-12T03:00:00Z",
    "is_auto_renew": true,
    "monthly_rate": 500,
    "renewal_available_date": "2027-04-12T03:00:00Z",
    "service_name": "My VXC",
    "service_owner_company_uid": "123e4567-e89b-12d3-a456-426614174000",
    "service_type": "VXC",
    "service_uid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "term_months": 12
  }
}
```

<Anchor name="billing-invoice-generated" />

## billing.invoice.generated

`billing.invoice.generated` is sent when a billing invoice has been generated.

The payload of this event has the following structure:

* `company_uid` (string, UUID)
* `metadata` (object)
  * `environment` (string)
* `schema_version` (string)
* `timestamp` (string, date-time)
* `type` (string)
* `data` (object)
  * `billing_market` (string)
  * `currency` (string)
  * `invoice_amount` (number, double)
  * `invoice_id` (string)
  * `invoice_url` (string, uri)

For example:

```json theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
{
  "company_uid": "681ef39b-436b-40dd-a914-26391db2689c",
  "metadata": {
    "environment": "production"
  },
  "schema_version": "1",
  "timestamp": "2026-04-23T10:29:12Z",
  "type": "billing.invoice.generated",
  "data": {
    "billing_market": "US",
    "currency": "USD",
    "invoice_amount": 1500,
    "invoice_id": "INV001234",
    "invoice_url": "https://portal.megaport.com/settings/company/markets/market/123/invoice/INV001234"
  }
}
```

<Anchor name="billing-service-retermed" />

## billing.service.retermed

`billing.service.retermed` is sent when a billing service has been re-termed.

The payload of this event has the following structure:

* `company_uid` (string, UUID)
* `metadata` (object)
  * `environment` (string)
* `schema_version` (string)
* `timestamp` (string, date-time)
* `type` (string)
* `data` (object)
  * `billing_market` (string)
  * `contract_expiry_date` (string, date-time)
  * `is_auto_renew` (boolean)
  * `monthly_rate` (number, double)
  * `service_name` (string)
  * `service_owner_company_uid` (string, UUID)
  * `service_type` (string)
  * `service_uid` (string, UUID)
  * `term_months` (integer, int32)

For example:

```json theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
{
  "company_uid": "681ef39b-436b-40dd-a914-26391db2689c",
  "metadata": {
    "environment": "production"
  },
  "schema_version": "1",
  "timestamp": "2026-04-23T10:29:12Z",
  "type": "billing.service.retermed",
  "data": {
    "billing_market": "US",
    "contract_expiry_date": "2026-05-12T03:00:00Z",
    "is_auto_renew": true,
    "monthly_rate": 500,
    "service_name": "My VXC",
    "service_owner_company_uid": "123e4567-e89b-12d3-a456-426614174000",
    "service_type": "VXC",
    "service_uid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "term_months": 12
  }
}
```

<Anchor name="billing-service-started" />

## billing.service.started

`billing.service.started` is sent when a service has started billing.

The payload of this event has the following structure:

* `company_uid` (string, UUID)
* `metadata` (object)
  * `environment` (string)
* `schema_version` (string)
* `timestamp` (string, date-time)
* `type` (string)
* `data` (object)
  * `billing_market` (string)
  * `contract_expiry_date` (string, date-time)
  * `is_auto_renew` (boolean)
  * `monthly_rate` (number, double)
  * `service_name` (string)
  * `service_owner_company_uid` (string, UUID)
  * `service_type` (string)
  * `service_uid` (string, UUID)
  * `term_months` (integer, int32)

For example:

```json theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
{
  "company_uid": "681ef39b-436b-40dd-a914-26391db2689c",
  "metadata": {
    "environment": "production"
  },
  "schema_version": "1",
  "timestamp": "2026-04-23T10:29:12Z",
  "type": "billing.service.started",
  "data": {
    "billing_market": "US",
    "contract_expiry_date": "2026-05-12T03:00:00Z",
    "is_auto_renew": true,
    "monthly_rate": 500,
    "service_name": "My VXC",
    "service_owner_company_uid": "123e4567-e89b-12d3-a456-426614174000",
    "service_type": "VXC",
    "service_uid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "term_months": 12
  }
}
```
