
Aanchal Parmar
Product Marketing Manager, Flexprice

How Flexprice implements each model
Prepaid with auto-recharge (wallet docs, auto top-up):
Create the wallet and set the auto-recharge configuration in one step:
bash
POST /v1/wallets
{
"customer_id": "cust_ABC123",
"currency": "usd",
"conversion_rate": 1,
"wallet_type": "PRE_PAID",
"auto_topup": {
"amount": 7954.136132619662,
"enabled": true,
"invoicing": true,
"threshold": 181.8940595834384
}
}
invoicing: false means credits land immediately when the threshold triggers. Set invoicing: true and the system creates an invoice first; credits stay in pending status until the invoice is marked paid. The AutoCompletePurchasedCreditTransaction setting on the tenant lets you skip the pending step for customers on pre-authorized payment plans.
Balance alerts fire automatically as the balance moves through states: ok ↔ info ↔ warning ↔ in_alarm.
Here’s what each of these mean:
OK: Balance is healthy, no action needed
Info: Balance crossed info threshold, informational tracking only
Warning: Balance crossed warning threshold, attention needed
In Alarm: Balance crossed critical threshold, immediate action required
Each state change sends a webhook. You configure the thresholds per wallet: three independent levels, each with a numeric threshold and a direction (above or below). One API call replaces an alerting pipeline that most teams spend two to three weeks building.
Plan-based credit grants with expiry (credit grant docs):
bash
POST /v1/credit-grants
{
"name": "Starter Plan Monthly Grant",
"scope": "PLAN",
"plan_id": "plan_starter",
"credit_amount": 50000,
"currency": "USD",
"cadence": "RECURRING",
"period": "monthly",
"expire_in_days": 30,
"priority": 1
}
For one-time grants (signup bonus, referral credit), set cadence: "ONETIME". The credit applies immediately on subscription creation and doesn't repeat.
The priority field controls burn order. A customer with a plan grant (priority 1) and a referral bonus (priority 2) burns plan credits first. If you want promotional credits to burn before purchased ones, flip the priorities.
The build vs. buy calculation
Two mid-level engineers building a production-grade credit system typically take three to four months to ship something that holds up under real traffic. At $15,000/month per engineer, that's $90,000 to $120,000 in engineering cost before the first production bug.
After launch, the maintenance tax doesn't disappear. The Singapore timezone bug. The retry idempotency fix. The new requirement from finance to track credit reason codes for revenue recognition.
The enterprise customer is asking for a per-wallet credit type breakdown in their portal. Based on what we hear from teams that have been through this, one engineer spends 20-30% of their time on the credit system after launch, permanently.
That's $3,000 to $4,500 per month in ongoing engineering cost, plus the opportunity cost of features those engineers didn't build.
Flexprice Starter is $500/month. The math is straightforward from month one.
The deeper cost is harder to quantify but easier to feel: a credit system built under a three-week estimate will cut corners the team doesn't discover until month six. The concurrent deduction race condition that only appears under load. The expiry ordering bug that only surfaces when a customer has multiple active grants. The audit log gap that becomes a problem during your first enterprise security review.
Building your own is the right call when you have requirements that no platform can meet: specific regulatory constraints, deeply custom credit semantics, or scale that puts you in a tier where first-party infrastructure is cost-justified. For most AI SaaS and API companies, that threshold is well beyond where they are when they make the build decision.
Can different credit grants expire at different rates?
What happens if an auto-recharge invoice goes unpaid?
Can a customer have two wallets in the same currency?
How does priority work when a customer has both expiring and non-expiring credits?
What's the difference between a credit grant and a wallet top-up?



























