Credit Grant
A Credit Grant is a prepaid or promotional balance a Customer spends on a Startup’s metered Offers, checked before each call.
Properties
| Property | Type | Required | Description |
|---|---|---|---|
amount | money | required | The balance granted. Never randomized. |
category | string | required | paid (bought through an Order, deferred revenue until spent) or promotional (given; never cash). Never randomized. |
priority | integer | Order of use when several grants apply: a lower number spends first, then the earliest expiry. | |
expiresAt | datetime | When any remaining balance lapses. Absent means it never lapses. | |
appliesTo | Offer | The metered Offer the balance pays for. Absent means every metered Offer of the Startup. | |
remaining | money | The unspent balance, debited once after each metered call and checked as a Limit before the next. |
Object
{
"$id": "https: //api.sb/ tutorloop.com/ credit-grants/ credit_grant_1",
"$type": "CreditGrant",
"amount": {
"amount": 60,
"currency": "USD"
},
"category": "paid",
"priority": 1,
"expiresAt": "2026-10-22T12: 00: 00Z",
"appliesTo": "offer_1",
"remaining": {
"amount": 60,
"currency": "USD"
}
}Relationships
- A Credit Grant credits one Customer: the Customer whose metered calls spend the balance; credits never move to another Customer.
credits, inversecreditGrants. - A Credit Grant offsets many Invoices: the Invoices the grant paid toward when they finalized.
offsets, inversecreditGrants.
Verbs
createCreates a Credit Grant.POST /{namespace}/credit-grantsgetReturns one Credit Grant by id.GET /{namespace}/credit-grants/{id}listReturns Credit Grants, newest first, one page at a time.GET /{namespace}/credit-grantsapplyApply spends Credit Grants against a finalizing Invoice, promotional first, then by priority and earliest expiry, and settles them through Stripe credit grants.POST /{namespace}/credit-grants/applyissueIssue gives a Customer a paid or promotional Credit Grant that its metered calls draw down before anything is invoiced.POST /{namespace}/credit-grants/issuevoidVoid ends a promotional Credit Grant early and forfeits its remaining balance, keeping the record.POST /{namespace}/credit-grants/{creditGrant}/void
A Credit Grant is never deleted: it ends by CreditGrant.void, and its records stay.
Permissions
Which Access level may call each Verb. One-way Verbs wait their delay window.
| Operation | owner | admin | member | viewer |
|---|---|---|---|---|
CreditGrant.create | Yes | Yes | Yes | No |
CreditGrant.get | Yes | Yes | Yes | Yes |
CreditGrant.list | Yes | Yes | Yes | Yes |
CreditGrant.apply | Yes | Yes | Yes | No |
CreditGrant.issue | Yes | Yes | Yes | No |
CreditGrant.void | Yes | No | No | No |
Call it
Apply the latest credit grant with an invoice.Example
A transcription API sells a $100 paid Credit Grant and adds a $20 promotional grant with priority 1. Each metered call spends the promotional balance first, then the paid one, and a call stops when both reach zero.