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.