# Credit Grant commands: apply, issue, void

URL: /code/cli/credit-grant/verbs · Id: `page:code/cli/credit-grant/verbs`

> The Credit Grant Verbs apply, issue, void as CLI commands, with inputs, result, refusals and an example.

Reference for [Credit Grant](/business/nouns/credit-grant), one group of [Credit Grant commands](/code/cli/credit-grant).

### 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](/business/nouns/credit-grant/apply?interface=cli).

```text
npx startup-builder do CreditGrant.apply --json '<input>' [--try | --send | --do]
```

Emits [`CreditGrant.applied`](/business/events/CreditGrant.applied).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `invoice` | [Invoice](/business/nouns/invoice) | Yes | The Invoice being finalized. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `applied` | `money` | Yes | The total the grants paid toward the Invoice. |
| `creditGrants` | list of [Credit Grant](/business/nouns/credit-grant) | Yes | Each grant drawn, with its new remaining balance. |

**Refuses when**

| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The key is valid, but its scopes do not allow this operation. | [`forbidden`](/code/api/errors/forbidden) | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |

**Example**

```bash
npx startup-builder do CreditGrant.apply --json '{"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](/business/nouns/credit-grant/issue?interface=cli).

```text
npx startup-builder do CreditGrant.issue --json '<input>' [--try | --send | --do]
```

Emits [`CreditGrant.issued`](/business/events/CreditGrant.issued).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `customer` | [Customer](/business/nouns/customer) | Yes | The Customer who receives it. |
| `amount` | `money` | Yes | The balance granted. |
| `category` | `string` | Yes | `paid` for a balance the Customer bought; `promotional` for one given, which is never cash. |
| `appliesTo` | [Offer](/business/nouns/offer) | No | The metered Offer it pays for; every metered Offer of the Startup when absent. |
| `expiresAt` | `datetime` | No | When any remaining balance lapses; never, when absent. |
| `priority` | `integer` | No | Order of use among grants; a lower number spends first. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `creditGrant` | [Credit Grant](/business/nouns/credit-grant) | Yes | The new Credit Grant, its remaining balance equal to its amount. |

**Refuses when**

| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The key is valid, but its scopes do not allow this operation. | [`forbidden`](/code/api/errors/forbidden) | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |

**Example**

```bash
npx startup-builder do CreditGrant.issue --json '{"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](/business/nouns/credit-grant/void?interface=cli).

```text
npx startup-builder do CreditGrant.void --json '<input>' [--try | --send | --do]
```

Emits [`CreditGrant.voided`](/business/events/CreditGrant.voided).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `creditGrant` | [Credit Grant](/business/nouns/credit-grant) | Yes | The grant to end. |
| `reason` | `text` | Yes | Why it ends, shown to the Customer. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `creditGrant` | [Credit Grant](/business/nouns/credit-grant) | Yes | The voided grant, its remaining balance zero. |

**Refuses when**

| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The key is valid, but its scopes do not allow this operation. | [`forbidden`](/code/api/errors/forbidden) | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |

**Example**

```bash
npx startup-builder do CreditGrant.void --json '{"creditGrant":"credgr_PduV9IB1HF","reason":"Example reason"}'
```