How it works
The customer saves a card and chooses a rule: when the balance falls below a threshold, buy a specific pack. After each deduction the system compares the balance with the threshold and, if it is lower, charges the card off-session and issues the credits when the payment succeeds.
The engineering risk is charging twice. Deductions arrive concurrently, so two can cross the threshold at the same moment, and charges can time out without a clear result. A safe implementation lets only one charge per rule be in flight and retries an interrupted charge with the same payment idempotency key rather than starting a new one.
Example
A rule says: below 200 credits, buy 2,000 for $25. A user at 230 credits runs a 50-credit job, leaving 180. That triggers one $25 charge and the balance becomes 2,180. If ten jobs had finished at once, the customer should still see one $25 charge, not ten.
Auto top-up in Cred
A card is saved only from a checkout sent with save_payment_method: true. Set a threshold and pack with POST /auto-topup and cred charges the card whenever a deduct drops the balance below it, leasing the rule so only one charge is in flight; a sweep within about 10 minutes catches balances that fell another way.
Saved Cards & Auto Top-Up docsRelated terms
Questions
- What happens if the auto top-up charge is declined?
- No credits are issued, and the customer continues on their remaining balance. Notify them so they can update the card, and avoid retrying a hard decline repeatedly.
- Does auto top-up need customer consent?
- Yes. Stripe requires you to collect the customer's explicit consent to charge a saved card when they are not present, and your terms must cover the timing of payments, such as unscheduled top-ups, and how the amount is set. State the threshold, pack, and price when the card is saved.