Skip to content

Credit Grant programs: apply, issue, void

The Credit Grant Verbs apply, issue, void as MCP do programs, with inputs, result, refusals and an example.

Reference for Credit Grant, one group of Credit Grant programs.

CreditGrant.apply

Apply spends Credit Grants against a finalizing Invoice, promotional first, then by priority and earliest expiry, and settles them through Stripe credit grants. Verb page.

Text
do: return await $.CreditGrant.apply(input)

Emits CreditGrant.applied.

Inputs

InputTypeRequiredDescription
invoiceInvoicerequiredThe Invoice being finalized.

Returns

OutputTypeRequiredDescription
appliedmoneyrequiredThe total the grants paid toward the Invoice.
creditGrantslist of Credit GrantrequiredEach grant drawn, with its new remaining balance.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

JSON
{
  "name": "do",
  "arguments": {
    "code": "return await $.CreditGrant.apply({ invoice: 'inv_9sfvgeRT7L' })"
  }
}

CreditGrant.issue

Issue gives a Customer a paid or promotional Credit Grant that its metered calls draw down before anything is invoiced. Verb page.

Text
do: return await $.CreditGrant.issue(input)

Emits CreditGrant.issued.

Inputs

InputTypeRequiredDescription
customerCustomerrequiredThe Customer who receives it.
amountmoneyrequiredThe balance granted.
categorystringrequiredpaid for a balance the Customer bought; promotional for one given, which is never cash.
appliesToOfferThe metered Offer it pays for; every metered Offer of the Startup when absent.
expiresAtdatetimeWhen any remaining balance lapses; never, when absent.
priorityintegerOrder of use among grants; a lower number spends first.

Returns

OutputTypeRequiredDescription
creditGrantCredit GrantrequiredThe new Credit Grant, its remaining balance equal to its amount.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

JSON
{
  "name": "do",
  "arguments": {
    "code": "return await $.CreditGrant.issue({ customer: 'cus_K1BROJhqzZ', amount: { amount: 29, currency: 'USD' }, category: 'paid' })"
  }
}

CreditGrant.void

Void ends a promotional Credit Grant early and forfeits its remaining balance, keeping the record. Verb page.

Text
do: return await $.CreditGrant.void(input)

Emits CreditGrant.voided.

Inputs

InputTypeRequiredDescription
creditGrantCredit GrantrequiredThe grant to end.
reasontextrequiredWhy it ends, shown to the Customer.

Returns

OutputTypeRequiredDescription
creditGrantCredit GrantrequiredThe voided grant, its remaining balance zero.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

JSON
{
  "name": "do",
  "arguments": {
    "code": "return await $.CreditGrant.void({ creditGrant: 'credgr_PduV9IB1HF', reason: 'Example reason' })"
  }
}