Billing API

Stripe checkout session creation and user payment history.

Behavior summary

Billing routes calculate member share and create Stripe checkout sessions, then expose recorded payment history for authenticated users.

Endpoints

Creates a Stripe Checkout session for caller's share.

Body

{
  "groupId": "clx..."
}

Workflow

  1. Validate caller membership.
  2. Resolve active group subscription.
  3. Compute share using rounded-up cents formula.
  4. Create checkout session in Stripe.
  5. Return checkout URL.

Success

{
  "url": "https://checkout.stripe.com/c/pay/cs_test_..."
}

Failure cases

  • 401 UNAUTHORIZED
  • 400 VALIDATION_ERROR
  • 404 NOT_FOUND (group or subscription missing)
  • 409 CONFLICT (invalid group billing state)

Monetary invariant

Use integer cents end-to-end. Never store or compute money in floating-point values.