eCom9eCom9
Creditsv1

Credits

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.

Check Credits

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_KEY

Example response

{
  "account_ref_id": "ACC123456789",
  "credits": 150.0
}
Returns credits: 0 if no ledger exists for the account.

Use Credits

Debit credits from an account reference ID.

Endpoint

POST https://app.ecom9.com/api/usage/credits/debit/

Request headers

  • Content-Type: application/json
  • Authorization: Bearer YOUR_API_KEY

Required 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
}
Returns 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.

Support

Need a new endpoint or payload tweak? Reach the team through your dashboard chat or email support, and we'll scope it with you.