CreditGrant .issue
POST /{namespace}/credit-grants/issue
Issue gives a Customer a paid or promotional Credit Grant that its metered calls draw down before anything is invoiced.
- Noun
- Credit Grant
- Mode
do- Event
CreditGrant.issued
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
customer | Customer | required | The Customer who receives it. |
amount | money | required | The balance granted. |
category | string | required | paid for a balance the Customer bought; promotional for one given, which is never cash. |
appliesTo | Offer | The metered Offer it pays for; every metered Offer of the Startup when absent. | |
expiresAt | datetime | When any remaining balance lapses; never, when absent. | |
priority | integer | Order of use among grants; a lower number spends first. |
Outputs
| Output | Type | Required | Description |
|---|---|---|---|
creditGrant | Credit Grant | required | The new Credit Grant, its remaining balance equal to its amount. |
Effects
- Emits
CreditGrant.issued. - Performed by the Billing Specialist.
- Two-way: it runs at once, in the
try,sendanddomodes. Order.payissues apaidgrant on an Offer withcredit; apromotionalgrant counts against the issuer’s Limit.- Mirrors the grant to Stripe, which applies it when the Invoice finalizes.
Refuses when
| Check | Error | Fix | Then call |
|---|---|---|---|
| The key is valid, but its scopes do not allow this operation. | forbidden | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | CreditGrant.issue |
When it waits
| Gate | Default |
|---|---|
| Decision class | Low: two-way, nothing at stake |
| Delay window | None: it runs once review passes. |
| Limit | The call Limit of the Permission it runs under. |
| Over the Limit | It waits pending for an Approval from the Founder. Approved, it runs; refused, it ends refused with limit-exceeded; unanswered by its deadline, it ends canceled. |