View Source Stripe.Billing.Alert (stripity_stripe v3.3.1)

A billing alert is a resource that notifies you when a certain usage threshold on a meter is crossed. For example, you might create a billing alert to notify you when a certain user made 100 API requests.

Summary

Types

t()

The billing.alert type.

The configuration of the usage threshold.

Functions

Reactivates this alert, allowing it to trigger again.

Archives this alert, removing it from the list view and APIs. This is non-reversible.

Creates a billing alert

Deactivates this alert, preventing it from triggering.

Lists billing active and inactive alerts

Retrieves a billing alert given an ID

Types

@type filters() :: %{optional(:customer) => binary(), optional(:type) => :customer}
@type t() :: %Stripe.Billing.Alert{
  alert_type: binary(),
  id: binary(),
  livemode: boolean(),
  object: binary(),
  status: binary() | nil,
  title: binary(),
  usage_threshold: term() | nil
}

The billing.alert type.

  • alert_type Defines the type of the alert.
  • id Unique identifier for the object.
  • livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode.
  • object String representing the object's type. Objects of the same type share the same value.
  • status Status of the alert. This can be active, inactive or archived.
  • title Title of the alert.
  • usage_threshold Encapsulates configuration of the alert to monitor usage on a specific Billing Meter.
@type usage_threshold() :: %{
  optional(:filters) => [filters()],
  optional(:gte) => integer(),
  optional(:meter) => binary(),
  optional(:recurrence) => :one_time
}

The configuration of the usage threshold.

Functions

Link to this function

activate(id, params \\ %{}, opts \\ [])

View Source
@spec activate(
  id :: binary(),
  params :: %{optional(:expand) => [binary()]},
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Reactivates this alert, allowing it to trigger again.

Details

  • Method: post
  • Path: /v1/billing/alerts/{id}/activate
Link to this function

archive(id, params \\ %{}, opts \\ [])

View Source
@spec archive(
  id :: binary(),
  params :: %{optional(:expand) => [binary()]},
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Archives this alert, removing it from the list view and APIs. This is non-reversible.

Details

  • Method: post
  • Path: /v1/billing/alerts/{id}/archive
Link to this function

create(params \\ %{}, opts \\ [])

View Source
@spec create(
  params :: %{
    optional(:alert_type) => :usage_threshold,
    optional(:expand) => [binary()],
    optional(:title) => binary(),
    optional(:usage_threshold) => usage_threshold()
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Creates a billing alert

Details

  • Method: post
  • Path: /v1/billing/alerts
Link to this function

deactivate(id, params \\ %{}, opts \\ [])

View Source
@spec deactivate(
  id :: binary(),
  params :: %{optional(:expand) => [binary()]},
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Deactivates this alert, preventing it from triggering.

Details

  • Method: post
  • Path: /v1/billing/alerts/{id}/deactivate
Link to this function

list(params \\ %{}, opts \\ [])

View Source
@spec list(
  params :: %{
    optional(:alert_type) => :usage_threshold,
    optional(:ending_before) => binary(),
    optional(:expand) => [binary()],
    optional(:limit) => integer(),
    optional(:meter) => binary(),
    optional(:starting_after) => binary()
  },
  opts :: Keyword.t()
) ::
  {:ok, Stripe.List.t(t())} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Lists billing active and inactive alerts

Details

  • Method: get
  • Path: /v1/billing/alerts
Link to this function

retrieve(id, params \\ %{}, opts \\ [])

View Source
@spec retrieve(
  id :: binary(),
  params :: %{optional(:expand) => [binary()]},
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Retrieves a billing alert given an ID

Details

  • Method: get
  • Path: /v1/billing/alerts/{id}