View Source Stripe.Billing.Meter (stripity_stripe v3.3.1)
Meters specify how to aggregate meter events over a billing period. Meter events represent the actions that customers take in your system. Meters attach to prices and form the basis of the bill.
Related guide: Usage based billing
Summary
Types
Fields that specify how to map a meter event to a customer.
The default settings to aggregate a meter's events with.
The billing.meter type.
Fields that specify how to calculate a meter event's value.
Functions
Creates a billing meter.
When a meter is deactivated, no more meter events will be accepted for this meter. You can’t attach a deactivated meter to a price.
Retrieve a list of billing meters.
When a meter is reactivated, events for this meter can be accepted and you can attach the meter to a price.
Retrieves a billing meter given an ID.
Updates a billing meter.
Types
@type customer_mapping() :: %{ optional(:event_payload_key) => binary(), optional(:type) => :by_id }
Fields that specify how to map a meter event to a customer.
@type default_aggregation() :: %{optional(:formula) => :count | :last | :sum}
The default settings to aggregate a meter's events with.
@type t() :: %Stripe.Billing.Meter{ created: integer(), customer_mapping: term(), default_aggregation: term(), display_name: binary(), event_name: binary(), event_time_window: binary() | nil, id: binary(), livemode: boolean(), object: binary(), status: binary(), status_transitions: term(), updated: integer(), value_settings: term() }
The billing.meter type.
createdTime at which the object was created. Measured in seconds since the Unix epoch.customer_mappingdefault_aggregationdisplay_nameThe meter's name.event_nameThe name of the meter event to record usage for. Corresponds with theevent_namefield on meter events.event_time_windowThe time window which meter events have been pre-aggregated for, if any.idUnique identifier for the object.livemodeHas the valuetrueif the object exists in live mode or the valuefalseif the object exists in test mode.objectString representing the object's type. Objects of the same type share the same value.statusThe meter's status.status_transitionsupdatedTime at which the object was last updated. Measured in seconds since the Unix epoch.value_settings
@type value_settings() :: %{optional(:event_payload_key) => binary()}
Fields that specify how to calculate a meter event's value.
Functions
@spec create( params :: %{ optional(:customer_mapping) => customer_mapping(), optional(:default_aggregation) => default_aggregation(), optional(:display_name) => binary(), optional(:event_name) => binary(), optional(:event_time_window) => :day | :hour, optional(:expand) => [binary()], optional(:value_settings) => value_settings() }, opts :: Keyword.t() ) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Creates a billing meter.
Details
- Method:
post - Path:
/v1/billing/meters
@spec deactivate( id :: binary(), params :: %{optional(:expand) => [binary()]}, opts :: Keyword.t() ) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
When a meter is deactivated, no more meter events will be accepted for this meter. You can’t attach a deactivated meter to a price.
Details
- Method:
post - Path:
/v1/billing/meters/{id}/deactivate
@spec list( params :: %{ optional(:ending_before) => binary(), optional(:expand) => [binary()], optional(:limit) => integer(), optional(:starting_after) => binary(), optional(:status) => :active | :inactive }, opts :: Keyword.t() ) :: {:ok, Stripe.List.t(t())} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Retrieve a list of billing meters.
Details
- Method:
get - Path:
/v1/billing/meters
@spec reactivate( id :: binary(), params :: %{optional(:expand) => [binary()]}, opts :: Keyword.t() ) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
When a meter is reactivated, events for this meter can be accepted and you can attach the meter to a price.
Details
- Method:
post - Path:
/v1/billing/meters/{id}/reactivate
@spec retrieve( id :: binary(), params :: %{optional(:expand) => [binary()]}, opts :: Keyword.t() ) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Retrieves a billing meter given an ID.
Details
- Method:
get - Path:
/v1/billing/meters/{id}
@spec update( id :: binary(), params :: %{ optional(:display_name) => binary(), optional(:expand) => [binary()] }, opts :: Keyword.t() ) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Updates a billing meter.
Details
- Method:
post - Path:
/v1/billing/meters/{id}