Mutation
mutation CreateCreditGrant($input: CreditGrantInput!) {
createCreditGrant(input: $input) {
id
amount
status
cadence
expiryDate
effectiveAt
description
createdAt
}
}
{
"input": {
"customerId": "customer-123",
"amount": 1000,
"cadence": "ONE_TIME",
"expiryDate": "2024-12-31T23:59:59Z",
"description": "Welcome bonus credits"
}
}
{
"data": {
"createCreditGrant": {
"id": "grant-123",
"amount": 1000,
"status": "ACTIVE",
"cadence": "ONE_TIME",
"expiryDate": "2024-12-31T23:59:59Z",
"effectiveAt": "2024-01-15T10:30:00Z",
"description": "Welcome bonus credits",
"createdAt": "2024-01-15T10:30:00Z"
}
}
}
Parameters
CreditGrantInput
required
Input for creating a credit grant
Cadence Options
| Cadence | Description |
|---|---|
ONE_TIME | Single grant |
MONTHLY | Recurring monthly |
YEARLY | Recurring yearly |
Examples
One-Time Grant
{
"input": {
"customerId": "customer-123",
"amount": 1000,
"cadence": "ONE_TIME",
"description": "Welcome bonus"
}
}
Recurring Monthly
{
"input": {
"customerId": "customer-123",
"amount": 500,
"cadence": "MONTHLY",
"description": "Monthly credit allowance"
}
}
Future-Dated Grant
{
"input": {
"customerId": "customer-123",
"amount": 2000,
"effectiveAt": "2024-02-01T00:00:00Z",
"expiryDate": "2024-12-31T23:59:59Z"
}
}
The
OVERDRAFT grant type is system-generated only. Attempting to create a credit grant with grantType: OVERDRAFT via the API will return a validation error. Overdraft grants are created automatically when a customer’s credit consumption exceeds their available balance.Related Operations
- Credit Balance - Check balance
- Void Credit Grant - Cancel grant
