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
- Validate caller membership.
- Resolve active group subscription.
- Compute share using rounded-up cents formula.
- Create checkout session in Stripe.
- Return checkout URL.
Success
{
"url": "https://checkout.stripe.com/c/pay/cs_test_..."
}
Failure cases
401 UNAUTHORIZED400 VALIDATION_ERROR404 NOT_FOUND(group or subscription missing)409 CONFLICT(invalid group billing state)
Returns current user's payment records.
Success
- Status:
200 - Array entries typically include:
amountCents,currency,statusbillingPeriod,paidAt- Group/subscription context
Failure cases
401 UNAUTHORIZED
Monetary invariant
Use integer cents end-to-end. Never store or compute money in floating-point values.