LatticeStripe.Billing.MeterEventStream.Session (LatticeStripe v1.7.2)

Copy Markdown View Source

Short-lived session struct returned by MeterEventStream.create_session/2.

A %MeterEventStream.Session{} carries a session-scoped authentication_token that grants access to the high-volume v2 event stream endpoint. Sessions are valid for 15 minutes from creation time (expires_at).

Typical usage

Callers hold this struct and pass it to MeterEventStream.send_events/4:

{:ok, session} = MeterEventStream.create_session(client)
{:ok, _result} = MeterEventStream.send_events(client, session, events)

Security note — the :authentication_token field

authentication_token is a bearer credential for the v2 meter event stream endpoint. LatticeStripe masks it in default Inspect output to prevent accidental leaks via Logger, APM agents, crash dumps, or telemetry handlers.

Access the field directly when you need it:

session.authentication_token

To inspect all fields including the token during debugging:

IO.inspect(session, structs: false)

Summary

Functions

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

Types

t()

@type t() :: %LatticeStripe.Billing.MeterEventStream.Session{
  authentication_token: String.t() | nil,
  created: integer() | nil,
  expires_at: integer() | nil,
  id: String.t() | nil,
  livemode: boolean() | nil,
  object: String.t() | nil
}

Functions

from_map(map)

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

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

Maps the v2 session response fields directly — the response shape is stable and does not require @known_fields / :extra handling.

Returns nil when given nil.