Skip to main content

Managing Credit

Credit entries track all credit-related transactions for a contact's wallet. This includes adding credit, spending credit (redemptions), removing credit, and converting between credit types.

Prerequisites

Before managing credit, ensure you have:

  1. Authenticated with a valid API token
  2. A contact with an associated wallet (see Managing Contacts)

Credit Concepts

Credit TypeDescription
GLOBALMonetary credit values (e.g., store credit in currency)
LOCALNon-monetary values (e.g., loyalty points)
ActionDescription
ADDCredit added to the wallet
SPENDCredit spent (e.g., redemption)
REMOVECredit manually removed

Related types:

Viewing Credit Entries

Credit entries are accessed through a contact's wallet via the account query.

Get Credit Entries for a Contact

query GetContactCreditEntries($uuid: String, $limit: Int, $offset: Int) {
account {
contacts(uuid: $uuid) {
uuid
email
wallet {
uuid
globalCreditBalance
localCreditBalance
creditEntries(limit: $limit, offset: $offset) {
uuid
action
creditType
amount
createdAt
}
}
}
}
}

Get Credit Entries for All Contacts

query GetAllCreditEntries($contactLimit: Int, $entryLimit: Int) {
account {
contacts(limit: $contactLimit) {
uuid
email
wallet {
globalCreditBalance
localCreditBalance
creditEntries(limit: $entryLimit) {
uuid
action
creditType
amount
createdAt
}
}
}
}
}

Get Credit Balances Only

query GetCreditBalances {
account {
contacts {
uuid
email
wallet {
globalCreditBalance
localCreditBalance
shopifyCreditBalance
}
}
}
}

Related types:

  • Wallet - Wallet object with balance fields and creditEntries
  • CreditEntry - Credit entry object fields

Creating Credit Entries

Use the addCreditEntry mutation to add, spend, or remove credit:

mutation AddCreditEntry($creditEntry: AddCreditEntryInput!) {
addCreditEntry(creditEntry: $creditEntry) {
success
creditEntry {
uuid
action
creditType
amount
}
errors
}
}

Variables - Add Global Credit:

{
"creditEntry": {
"action": "ADD",
"creditType": "GLOBAL",
"amount": 25.00,
"walletUuid": "wallet-uuid-here"
}
}

Variables - Add Local Credit (Points):

{
"creditEntry": {
"action": "ADD",
"creditType": "LOCAL",
"amount": 500,
"walletUuid": "wallet-uuid-here"
}
}

Variables - Remove Credit:

{
"creditEntry": {
"action": "REMOVE",
"creditType": "GLOBAL",
"amount": 10.00,
"walletUuid": "wallet-uuid-here"
}
}

Related types:

Converting Credit

Use the convertCredit mutation to convert between credit types (e.g., points to store credit):

mutation ConvertCredit($credit: ConvertCreditInput!) {
convertCredit(credit: $credit) {
success
creditEntry {
uuid
action
creditType
amount
}
errors
}
}

Variables:

{
"credit": {
"walletUuid": "wallet-uuid-here",
"amount": 100,
"conversionRate": 0.01,
"from": "LOCAL",
"to": "GLOBAL"
}
}

This example converts 100 local points to 1.00 global credit (100 × 0.01 = 1.00).

Related types:

Next Steps