Charge the saved card for credits, or start Stripe Checkout
Charge the saved card, or start Checkout when that is not possible.
Teams with a default payment method are charged in place and credits are granted here. Teams without a usable card, or whose bank requires a 3DS challenge, still go through hosted Checkout; the checkout.session.completed webhook applies those credits.
Args: request: Raw request, required by the rate limiter. team_id: Team the credits are bought for. body: Purchase amount, attempt id, and the Checkout return URLs. auth: Caller identity; payment enforcement is off because this route is how a team with no funds acquires them.
Returns: checkout_url set when the buyer must finish on Stripe; None when the saved card was charged and credits are already on the balance.
Raises: HTTPException: 403 without MANAGE_BILLING; 400 when a Stripe customer cannot be resolved; 402 when the saved card is declined; 500 when payment succeeded but the grant failed; 502 or 503 when Stripe cannot start a session.
Path parameters
Request body
Response
Successful Response