Prioritization of multiple credit grants
If more than one grant can apply to an invoice or usage event, Stigg selects grants in the following order:-
Priority
Grants with a higher priority apply first.
Lower numeric value = higher priority. -
Expiration date (
expires_at)
Grants that expire sooner are consumed before later-expiring or non-expiring grants. -
Category
Among grants with the same expiration date, promotional credits are consumed before paid credits. -
Effective date (
effective_at)
Grants that became effective earlier apply first. -
Created date (
created_at)
If all other attributes match, older grants are consumed before newer ones.
Deductions that span multiple grants
If a single usage event requires more credits than are available in one grant:- Stigg deducts from the highest-ranked grant until its balance is zero,
- Then continues with the next eligible grant according to the same prioritization order,
- Creating a separate ledger entry for each consumed grant.
Example
A customer has these credit grants:| Grant | Priority | Expires | Category | Balance |
|---|---|---|---|---|
| A | 1 | Sep 1 | paid | 50 |
| B | 1 | Sep 1 | promotional | 20 |
| C | 2 | Aug 15 | promotional | 100 |
- Priority → only A and B (priority 1).
- Expiration → both expire Sep 1.
- Category → promotional before paid → B then A.
Deduction result
- 20 credits deducted from B
- 40 credits deducted from A
- Grant C is not used
