LatticeStripe.Billing.MeterEventAdjustment (LatticeStripe v1.7.12)

Copy Markdown View Source

Stripe Billing MeterEventAdjustment — correct a previously-reported MeterEvent within Stripe's 24-hour cancellation window. Create-only.

Only the cancel action is currently exposed by Stripe; it must contain a cancel.identifier matching the identifier of the event you want to cancel. See guides/metering.md → "Corrections and adjustments" for the dunning worked example.

Summary

Functions

Create a meter event adjustment. The cancel param MUST be a nested map with an identifier key — NOT a top-level identifier, NOT cancel.id, NOT cancel.event_id. Example

Decode a Stripe-shaped string-keyed map into a %MeterEventAdjustment{}.

Types

t()

@type t() :: %LatticeStripe.Billing.MeterEventAdjustment{
  cancel: LatticeStripe.Billing.MeterEventAdjustment.Cancel.t() | nil,
  event_name: String.t() | nil,
  extra: map(),
  id: String.t() | nil,
  livemode: boolean() | nil,
  object: String.t() | nil,
  status: String.t() | nil
}

Functions

create(client, params, opts \\ [])

@spec create(LatticeStripe.Client.t(), map(), keyword()) ::
  {:ok, t()} | {:error, LatticeStripe.Error.t()}

Create a meter event adjustment. The cancel param MUST be a nested map with an identifier key — NOT a top-level identifier, NOT cancel.id, NOT cancel.event_id. Example:

MeterEventAdjustment.create(client, %{
  "event_name" => "api_call",
  "cancel" => %{"identifier" => "req_abc"}
})

Stripe enforces a 24-hour cancellation window from the original event's created timestamp; adjustments outside this window return out_of_window.

create!(client, params, opts \\ [])

@spec create!(LatticeStripe.Client.t(), map(), keyword()) :: t()

Bang variant of create/3. Raises LatticeStripe.Error on failure.

from_map(map)

@spec from_map(map()) :: t()

Decode a Stripe-shaped string-keyed map into a %MeterEventAdjustment{}.

The cancel sub-object is decoded into %Cancel{} via Cancel.from_map/1. Unknown top-level keys land in :extra.