Skip to content
Indiana
Dashboard
Docs
Browse docs / Customer state & history

Customer state & history

Build an account UI with exact balances, plan eligibility, state subscriptions and paginated history.

SDK 0.0.1Updated

Read current customer holdings and ledger

Complete host authentication, obtain the current user’s token and call grow.identify. Browser requests omit customer IDs. These reads use the same memberships, balances and verified transactions as screen components. Data remains private and is not cached as public design.

Quantities, balances and rates are decimal strings. Filtering applies to all history before paging with a cursor that preserves microseconds and entry type. Quotes do not charge. Consumption, reservation, confirmation, release and original-price refunds execute only on the trusted backend.

Backend mutations require credits:consume; refunds also require credits:manage. Quotes, ledger and holdings respectively require credits:read, credits:read and entitlements:read. Current balance execution is available only in the explicit Sandbox scope.

app/account.tsTypeScript
const { holdings } = await grow.readHoldings();const { ledger } = await grow.readLedger({  type: null, from: null, to: null, after: null, limit: 50,});// Read the next page with ledger.nextCursor; preserve the entire cursor.const { quote } = await grow.quoteBalance({  operation: "quote", entitlementId, quantity: "1", properties: {},});
server/usage.tsTypeScript
const { receipt } = await groove.mutateBalance({  customerId: verifiedCustomer.id,  command: {    operation: "consume", entitlementId, quantity: "1", properties: {},    idempotencyKey: `job:${job.id}`,  },});// Retry the same job with its original idempotencyKey and input.