Credits are accumulated from product purchases and subscription renewals when products or tiers have credit_amount configured, and can be checked or deducted through the credits endpoints.
Get the current credit balance for an account reference ID.
Endpoint
GET https://app.ecom9.com/api/account/{account_ref_id}/credits/Parameters
account_ref_id — path parameter (required)Example request
GET /api/account/ACC123456789/credits/
Authorization: Bearer YOUR_API_KEYExample response
{
"account_ref_id": "ACC123456789",
"credits": 150.0
}credits: 0 if no ledger exists for the account.Debit credits from an account reference ID.
Endpoint
POST https://app.ecom9.com/api/usage/credits/debit/Request headers
Content-Type: application/jsonAuthorization: Bearer YOUR_API_KEYRequired fields
account_ref_id — string (required)quantity — number (required, must be positive)event_id — string (required, unique ID, max 12 characters)Sample incoming payload
{
"account_ref_id": "tEZkv7xR",
"quantity": 5,
"event_id": "xxxxxxxxxxxx"
}Sample output payload
{
"approved": true,
"debited": 5,
"remaining_balance": 42
}Insufficient credits response (403)
{
"approved": false,
"error_code": "insufficient_credits",
"remaining_balance": 2
}404 when the account ledger does not exist, 400 for invalid payload or non-positive quantity, and 403 with error_code: insufficient_credits when the balance is too low.Need a new endpoint or payload tweak? Reach the team through your dashboard chat or email support, and we'll scope it with you.