Mutation
mutation ConsumeCredits($input: ConsumeCreditInput!) {
consumeCredits(input: $input) {
amount
credit {
currencyId
currentUsage
timestamp
usageLimit
usagePeriodEnd
}
currencyId
customerId
resourceId
timestamp
}
}Variables
{
"input": {
"amount": 1.5,
"currencyId": "string",
"customerId": "string",
"idempotencyKey": "string"
}
}Response
{
"data": {
"consumeCredits": {
"amount": 1.5,
"credit": {
"currencyId": "string",
"currentUsage": 1.5,
"timestamp": "value",
"usageLimit": 1.5,
"usagePeriodEnd": "value"
},
"currencyId": "string",
"customerId": "string",
"resourceId": "string",
"timestamp": "value"
}
}
}Mutations
consumeCredits
Consume credits directly from a wallet (synchronous, low-volume)
MUTATION
consumeCredits(input: ConsumeCreditInput!): CreditConsumptionResponse!Arguments
input
required
Returns
amount
Float!
The amount of credits consumed
credit
The optimistic credit balance after consumption (when sync credit consumption is enabled)
currencyId
String!
The credit currency (custom currency refId) to consume from
customerId
String!
The customer to consume credits from (refId)
resourceId
String
Optional resource (refId) the consumption is attributed to
timestamp
DateTime!
The timestamp the consumption was attributed to
Mutation
mutation ConsumeCredits($input: ConsumeCreditInput!) {
consumeCredits(input: $input) {
amount
credit {
currencyId
currentUsage
timestamp
usageLimit
usagePeriodEnd
}
currencyId
customerId
resourceId
timestamp
}
}Variables
{
"input": {
"amount": 1.5,
"currencyId": "string",
"customerId": "string",
"idempotencyKey": "string"
}
}Response
{
"data": {
"consumeCredits": {
"amount": 1.5,
"credit": {
"currencyId": "string",
"currentUsage": 1.5,
"timestamp": "value",
"usageLimit": 1.5,
"usagePeriodEnd": "value"
},
"currencyId": "string",
"customerId": "string",
"resourceId": "string",
"timestamp": "value"
}
}
}