Skip to main content

Billing

Stripe-backed billing for the caller's current organization. Every operation resolves the Stripe customer from the authenticated user's current organization (organization.stripeCustomerId) and requires the manageBilling ability on that organization (enforced by StripePolicy). The organization is taken from the access token's current-organization context, not from a request parameter, so no organization id is passed in the body or path. The platform is a thin proxy in front of Stripe: success payloads are the native Stripe resource objects (Customer, Subscription, ...) wrapped in the standard { "success": true, "data": ... } envelope.

📄️ Create (or reuse) the organization's Stripe customer

Creates a Stripe `Customer` for the authenticated user's current organization and persists its id to `organization.stripeCustomerId`. Idempotent per organization: if the organization already carries a live customer id a `409` is returned, and if a Stripe customer already exists for the given `email` whose `metadata.organization_id` matches this organization, that existing customer is re-synced and returned with `200` rather than creating a duplicate. The created customer is tagged with `metadata.organization_id` and configured for automatic tax (the request IP is used for location validation). Requires the `manageBilling` ability.

📄️ List an organization's consumption, one event per action

The raw rows behind `GET .../balance`: every action a member of the organization made against the platform, one event per action whatever the number of technical calls it fanned out into, with the member who made it, the datasets present in the results it returned, how many entries came back, and the cost the ledger charged (`cost`, the same envelope every metered response carries). Each job's compute charge is listed too, as an event of kind `compute` with its own cost line (`{currency, compute, total}`), in the currency it was charged. Summed per currency, the `cost[].total` of every event of the feed equals the `expenses` of `GET .../balance`. A request refused before it reached the data is neither charged nor listed: a `401`, a `403` on a dataset the caller has no access to, or a `402` for a suspended account, a sponsored quota or a sponsored suspension.