Create Credits Top-Up Session
Top up credits on the authenticated account.
One credit equals one US cent ($0.01). The customer is charged credits plus a Stripe processing fee (US card pricing: 2.9% + $0.30) — e.g. credits: 10000 charges $103.30 total ($100.00 credits + $3.30 fee).
Two outcomes, distinguished by response shape:
-
Auto-charged — if the account has a card on file (from a prior subscription or top-up), the card is charged immediately and the response is
{ paymentIntentId, creditsPurchased, totalCents }. Credits land in the account’s balance asynchronously via Stripe webhook (typically within seconds). No human interaction required. -
Checkout required — if no card is on file, or the saved card requires 3-D Secure authentication, the response is
{ id, url }with a hosted Stripe Checkout URL. Redirect to that URL; credits land on successful payment.
Clients should discriminate on the presence of url (Checkout) vs paymentIntentId (auto-charged). Cards entered through the Checkout fallback are saved for future top-ups, so a customer’s second top-up typically auto-charges.
Authorizations
Your Recoup API key. Learn more.
Body
Top-up parameters
The number of credits to purchase. One credit equals one US cent ($0.01), so the value of the credits in USD is credits / 100. Example: 250 is $2.50 worth of credits (the customer is also charged a Stripe processing fee on top).
x >= 1250
The URL to redirect the customer to after a successful Stripe Checkout payment. Only used when the response is a Checkout fallback (no card on file or 3-D Secure required) — ignored when the card on file is charged directly. Defaults to a generic Recoup success page if omitted.
"https://chat.recoupable.com?credits=success"
UUID of the account to create the session for. Only applicable when the authenticated account has admin access to multiple accounts. If not provided, creates a session for the API key's own account.
"123e4567-e89b-12d3-a456-426614174000"
Response
Top-up initiated successfully. Some fields are conditional on which path was taken — see each field's description.
Top-up response. Two paths share this shape — clients can discriminate on the presence of url (Checkout fallback) vs paymentIntentId (auto-charged).
Auto-charge path only. The Stripe PaymentIntent ID for the off-session charge. Useful for reconciliation and support. Omitted on the Checkout fallback path.
"pi_3O1a2b3c4d5e6f7g_h8i9j0kL"
Auto-charge path only. The number of credits purchased, matching the credits request field. These credits are added to the account's balance asynchronously via Stripe webhook (typically within seconds). Omitted on the Checkout fallback path.
x >= 1250
Auto-charge path only. Total amount in cents charged to the saved card, equal to creditsPurchased plus the Stripe processing fee. Omitted on the Checkout fallback path.
x >= 1289
Checkout fallback only. The Stripe Checkout Session ID. Omitted on the auto-charge path.
"cs_test_a1b2c3d4e5f6g7h8i9j0"
Checkout fallback only. The hosted Stripe Checkout URL — redirect the customer here to enter card details and complete payment. Omitted on the auto-charge path.
"https://checkout.stripe.com/pay/cs_test_a1b2c3d4e5f6g7h8i9j0"
