useChangePlan, useTopUp, useAttachAddon, …) cover the common flows and integrate with React Query cache / loading / error state. useBilling is the escape hatch for everything else — imperative calls from event handlers, async flows, and non-render contexts.
Every hook returns isLoading: boolean and error: Error | null (see Introduction); the section below lists this hook’s specific returns.
useBilling
Returns the underlyingUnitPayClient bound to the active portal token. Use it for ad-hoc imperative calls and non-render contexts — event handlers, async flows, anything not tied to the render lifecycle. For form submissions and anything that should integrate with React Query cache / loading / error state, prefer the dedicated mutation hooks where they exist.
Parameters — none.
Returns
UnitPayClient— the imperative client instance. It exposes resource accessors (e.g.billing.subscription(id),billing.usage) plus settlement helpers likehandleSettlement.
See also
Settlement model
The
handleSettlement outcome kinds and their callbacks.Provider
Configure the
portalToken useBilling binds to.