Skip to main content
Retrieves the credit transaction ledger for a customer, showing all credits and debits.

Query

query GetCreditLedger($input: CreditLedgerInput!) {
  creditsLedger(input: $input) {
    edges {
      node {
        id
        amount
        type
        description
        createdAt
        balanceAfter
      }
      cursor
    }
    pageInfo {
      hasNextPage
      endCursor
    }
    totalCount
  }
}
{
  "input": {
    "customerId": "customer-123",
    "paging": {
      "first": 50
    }
  }
}
{
  "data": {
    "creditsLedger": {
      "edges": [
        {
          "node": {
            "id": "ledger-001",
            "amount": 1000,
            "type": "CREDIT",
            "description": "Initial credit grant",
            "createdAt": "2024-01-01T00:00:00Z",
            "balanceAfter": 1000
          },
          "cursor": "abc123"
        },
        {
          "node": {
            "id": "ledger-002",
            "amount": -50,
            "type": "DEBIT",
            "description": "API usage: 50 calls",
            "createdAt": "2024-01-15T10:30:00Z",
            "balanceAfter": 950
          },
          "cursor": "def456"
        }
      ],
      "pageInfo": {
        "hasNextPage": true,
        "endCursor": "def456"
      },
      "totalCount": 125
    }
  }
}

Parameters

input
CreditLedgerInput
required
Input parameters for credit ledger query

Return Type

Returns a CreditLedgerConnection with ledger entries.

Ledger Entry Fields

FieldTypeDescription
idUUIDEntry ID
amountFloatTransaction amount (+/-)
typeStringCREDIT or DEBIT
descriptionStringTransaction description
createdAtDateTimeTransaction time
balanceAfterFloatBalance after transaction

Overdraft settlement event types

The credit ledger includes the following event types related to overdraft settlement:
Event TypeDescription
CREDITS_CONSUMPTION_TRANSFER_SOURCERecorded on the overdraft grant when consumed credits are transferred out during settlement. Shows a negative quantity (reduction in consumed amount).
CREDITS_CONSUMPTION_TRANSFER_TARGETRecorded on the new grant when consumed credits are transferred in during settlement. Shows a positive quantity (increase in consumed amount).
These events always appear in pairs — one on the source (overdraft) grant and one on the target (new) grant — with matching quantities.

Common Use Cases

Show detailed credit transaction history to customers.
Maintain audit trail of all credit movements.
Analyze credit consumption patterns.