Checkout handoff wrapper.
Wraps the processor-level checkout_session_create/2 and
checkout_session_fetch/2 callbacks, projects the raw processor payload
into a tightly-typed struct, and masks the embedded-mode :client_secret
field in Inspect output.
Accrue models checkout as a provider-neutral handoff. Stripe currently maps this to a Checkout Session. Other processors may map it to a transaction or similar hosted checkout primitive, as long as they can return a redirect URL (hosted mode) or a bearer credential (embedded mode).
Two ui_mode values are supported when the configured processor declares
them in Accrue.Processor.capabilities/0:
:hosted(default) — processor-hosted checkout page; the returned%Session{}has a:urlto redirect the customer to.:embedded— the host app mounts the processor's embedded form; the returned%Session{}has a:client_secretto hand to the front end.
The :mode option mirrors the dominant subscription billing modes:
:subscription (default), :payment, or :setup.
Summary
Functions
Creates a Checkout Session through the configured processor.
Bang variant of create/1. Raises Accrue.APIError (or a generic
RuntimeError) on failure.
Retrieves a Checkout Session by id.
Types
@type t() :: %Accrue.Checkout.Session{ amount_tax: term(), amount_total: term(), automatic_tax: term(), client_secret: term(), currency: term(), customer: term(), data: term(), expires_at: term(), id: term(), metadata: term(), mode: term(), object: term(), payment_intent: term(), payment_status: term(), status: term(), subscription: term(), ui_mode: term(), url: term() }
Functions
Creates a Checkout Session through the configured processor.
See module docs for accepted options. Returns {:ok, %Session{}}
on success.
Bang variant of create/1. Raises Accrue.APIError (or a generic
RuntimeError) on failure.
Retrieves a Checkout Session by id.