# firebase_functions.alerts.billing_fn module

Cloud functions to handle billing events from Firebase Alerts.

## Classes

| ### BillingEvent *class* firebase_functions.alerts.billing_fn.BillingEvent(*specversion: str* , *id: str* , *source: str* , *type: str* , *time: datetime* , *data: T* , *subject: str \| None* , *alert_type: str* ) |
|---|
| Bases: [`CloudEvent`](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.core#firebase_functions.core.CloudEvent "firebase_functions.core.CloudEvent")\[`FirebaseAlertData`\[`T`\]\] A custom CloudEvent for billing Firebase Alerts. alert_type*: str* :   The type of the alerts that got triggered. |

| ### PlanAutomatedUpdatePayload *class* firebase_functions.alerts.billing_fn.PlanAutomatedUpdatePayload(*billing_plan: str* , *notification_type: str* ) |
|---|
| Bases: `object` The internal payload object for billing plan automated updates. Payload is wrapped inside a FirebaseAlertData object. billing_plan*: str* :   A Firebase billing plan, e.g. "spark" or "blaze". notification_type*: str* :   The type of the notification, e.g. "upgrade_plan" or "downgrade_plan". |

| ### PlanUpdatePayload *class* firebase_functions.alerts.billing_fn.PlanUpdatePayload(*billing_plan: str* , *notification_type: str* , *principal_email: str* ) |
|---|
| Bases: [`PlanAutomatedUpdatePayload`](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.alerts.billing_fn#firebase_functions.alerts.billing_fn.PlanAutomatedUpdatePayload "firebase_functions.alerts.billing_fn.PlanAutomatedUpdatePayload") The internal payload object for billing plan updates. Payload is wrapped inside a FirebaseAlertData object. principal_email*: str* :   The email address of the person that triggered billing plan change. |

## Functions

| ### on_plan_automated_update_published firebase_functions.alerts.billing_fn.on_plan_automated_update_published(*\*\*kwargs* ) → Callable\[\[Callable\[\[[BillingEvent](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.alerts.billing_fn#firebase_functions.alerts.billing_fn.BillingEvent "firebase_functions.alerts.billing_fn.BillingEvent")\[[PlanAutomatedUpdatePayload](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.alerts.billing_fn#firebase_functions.alerts.billing_fn.PlanAutomatedUpdatePayload "firebase_functions.alerts.billing_fn.PlanAutomatedUpdatePayload")\]\], None\]\], Callable\[\[[BillingEvent](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.alerts.billing_fn#firebase_functions.alerts.billing_fn.BillingEvent "firebase_functions.alerts.billing_fn.BillingEvent")\[[PlanAutomatedUpdatePayload](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.alerts.billing_fn#firebase_functions.alerts.billing_fn.PlanAutomatedUpdatePayload "firebase_functions.alerts.billing_fn.PlanAutomatedUpdatePayload")\]\], None\]\] |
|---|
| Event handler which triggers when a Firebase Alerts billing event is published. Example: ``` import firebase_functions.alerts.billing_fn as billing_fn @billing_fn.on_plan_automated_update_published() def example(alert: billing_fn.BillingPlanAutomatedUpdateEvent) -> None: print(alert) ``` Parameters: :   **\*\*kwargs** (as [`firebase_functions.options.BillingOptions`](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.options#firebase_functions.options.BillingOptions "firebase_functions.options.BillingOptions")) -- Options. Return type: :   `typing.Callable` \[ \[ [`firebase_functions.alerts.billing_fn.BillingPlanAutomatedUpdateEvent`](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.alerts.billing_fn#firebase_functions.alerts.billing_fn.BillingPlanAutomatedUpdateEvent "firebase_functions.alerts.billing_fn.BillingPlanAutomatedUpdateEvent") \], None \] A function that takes a BillingPlanUpdateEvent and returns None. |

| ### on_plan_update_published firebase_functions.alerts.billing_fn.on_plan_update_published(*\*\*kwargs* ) → Callable\[\[Callable\[\[[BillingEvent](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.alerts.billing_fn#firebase_functions.alerts.billing_fn.BillingEvent "firebase_functions.alerts.billing_fn.BillingEvent")\[[PlanUpdatePayload](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.alerts.billing_fn#firebase_functions.alerts.billing_fn.PlanUpdatePayload "firebase_functions.alerts.billing_fn.PlanUpdatePayload")\]\], None\]\], Callable\[\[[BillingEvent](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.alerts.billing_fn#firebase_functions.alerts.billing_fn.BillingEvent "firebase_functions.alerts.billing_fn.BillingEvent")\[[PlanUpdatePayload](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.alerts.billing_fn#firebase_functions.alerts.billing_fn.PlanUpdatePayload "firebase_functions.alerts.billing_fn.PlanUpdatePayload")\]\], None\]\] |
|---|
| Event handler which triggers when a Firebase Alerts billing event is published. Example: ``` import firebase_functions.alerts.billing_fn as billing_fn @billing_fn.on_plan_update_published() def example(alert: billing_fn.BillingPlanUpdateEvent) -> None: print(alert) ``` Parameters: :   **\*\*kwargs** (as [`firebase_functions.options.BillingOptions`](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.options#firebase_functions.options.BillingOptions "firebase_functions.options.BillingOptions")) -- Options. Return type: :   `typing.Callable` \[ \[ [`firebase_functions.alerts.billing_fn.BillingPlanUpdateEvent`](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.alerts.billing_fn#firebase_functions.alerts.billing_fn.BillingPlanUpdateEvent "firebase_functions.alerts.billing_fn.BillingPlanUpdateEvent") \], None \] A function that takes a BillingPlanUpdateEvent and returns None. |

## Constants

| ### BillingPlanAutomatedUpdateEvent firebase_functions.alerts.billing_fn.BillingPlanAutomatedUpdateEvent |
|---|
| The type of the event for 'on_plan_automated_update_published' functions. alias of [`BillingEvent`](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.alerts.billing_fn#firebase_functions.alerts.billing_fn.BillingEvent "firebase_functions.alerts.billing_fn.BillingEvent")\[[`PlanAutomatedUpdatePayload`](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.alerts.billing_fn#firebase_functions.alerts.billing_fn.PlanAutomatedUpdatePayload "firebase_functions.alerts.billing_fn.PlanAutomatedUpdatePayload")\] |

| ### BillingPlanUpdateEvent firebase_functions.alerts.billing_fn.BillingPlanUpdateEvent |
|---|
| The type of the event for 'on_plan_update_published' functions. alias of [`BillingEvent`](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.alerts.billing_fn#firebase_functions.alerts.billing_fn.BillingEvent "firebase_functions.alerts.billing_fn.BillingEvent")\[[`PlanUpdatePayload`](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.alerts.billing_fn#firebase_functions.alerts.billing_fn.PlanUpdatePayload "firebase_functions.alerts.billing_fn.PlanUpdatePayload")\] |

| ### OnPlanAutomatedUpdatePublishedCallable firebase_functions.alerts.billing_fn.OnPlanAutomatedUpdatePublishedCallable |
|---|
| The type of the callable for 'on_plan_automated_update_published' functions. alias of `Callable`\[\[[`BillingEvent`](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.alerts.billing_fn#firebase_functions.alerts.billing_fn.BillingEvent "firebase_functions.alerts.billing_fn.BillingEvent")\[[`PlanAutomatedUpdatePayload`](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.alerts.billing_fn#firebase_functions.alerts.billing_fn.PlanAutomatedUpdatePayload "firebase_functions.alerts.billing_fn.PlanAutomatedUpdatePayload")\]\], `None`\] |

| ### OnPlanUpdatePublishedCallable firebase_functions.alerts.billing_fn.OnPlanUpdatePublishedCallable |
|---|
| The type of the callable for 'on_plan_update_published' functions. alias of `Callable`\[\[[`BillingEvent`](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.alerts.billing_fn#firebase_functions.alerts.billing_fn.BillingEvent "firebase_functions.alerts.billing_fn.BillingEvent")\[[`PlanUpdatePayload`](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.alerts.billing_fn#firebase_functions.alerts.billing_fn.PlanUpdatePayload "firebase_functions.alerts.billing_fn.PlanUpdatePayload")\]\], `None`\] |