What a grant is
Every credit a customer holds arrived as a grant. Grants come from different sources and stack:- Plan grant — the recurring allowance from a plan (the Lovable “1,000 credits/month”), refilled each cycle.
- Daily drip — a small plan-level grant that refills every day.
- Rollover — unused balance carried over from a prior period.
- Contract grant — the committed allocation on an SLG/enterprise contract.
- Promotional — a one-off grant you issue by hand (referral reward, goodwill, coupon).
- Package — credits the customer bought as a self-serve top-up. See Top-ups.
breakdown behind a customer’s balance (see Wallets & the ledger).
The priority convention
When usage is deducted, grants are consumed in priority order — lowest number first. Priorities are configurable percredit_grant_rules; the defaults encode a sensible convention that differs slightly between PLG (self-serve) and enterprise:
| Priority | Grant type | PLG | Enterprise |
|---|---|---|---|
| 0 | Daily drip (plan-level) | consume first | — |
| 5 | Rollover (from expired contract) | — | consume first |
| 10 | Plan grant / Contract grant | main allocation | committed spend |
| 30 | Promotional | before packages | before packages |
| 50 | Package (self-serve top-up) | preserve as buffer | overflow |
| 100 | Package (post-contract) | — | dead last |
FIFO within a priority
When two or more grants share the same priority, UnitPay breaks the tie FIFO:The same principle governs the dollar-side balance deduction order: shorter intervals before longer ones, so expiring allocation is always spent before permanent allocation.
How the sources stack
A single customer routinely holds several grants at once, and they draw down in convention order:Example (PLG)
A customer has a daily drip (priority 0, 50 credits, expires tonight), a monthly plan grant (priority 10, 1,000 credits), and a package they topped up with (priority 50, 500 credits).
Usage burns the 50 drip credits first, then the 1,000 plan credits, and only touches the purchased 500 once everything cheaper-to-lose is gone — so the credits they paid for are the last to disappear.
Example (enterprise)
A contract customer has rollover from a lapsed contract (priority 5), their contract grant (priority 10), and overflow packages (priority 50, then 100). Rollover — which would otherwise expire — is consumed before the committed contract spend, and purchased packages absorb the overflow last.
See also
Credits overview
The full track → resolve → deduct → ledger path.
Wallets & the ledger
Where grants and deductions are recorded.
Denominations
Unit vs. fiat credits — and the rule never to mix them.
Top-ups
Where package credits sit in the deduction order.