B2B platform for digital goods

Balance API for Resellers: How It Works

A balance API lets you programmatically check your reseller account credit balance with the supplier. Your account runs on a prepaid model: you load funds, and each order deducts the wholesale cost.

Balance API for Resellers: How It Works


Short Answer

A balance API lets you programmatically check your reseller account credit balance with the supplier. Your account runs on a prepaid model: you load funds, and each order deducts the wholesale cost. If the balance hits zero, all orders fail. The balance API prevents this by giving your system real-time visibility of available funds, so you can alert on low balance, block order creation when balance is insufficient, and automate top-up workflows.


Definition: A balance API is an endpoint that returns the current credit balance of a reseller's account with a digital goods supplier. It is used to monitor available funds, prevent failed orders due to insufficient balance, and trigger balance replenishment workflows.


Key takeaway: A zero balance at 2am on a Saturday night means failed orders, angry customers and lost revenue until someone manually tops up. Balance API monitoring with automated alerts prevents this entirely.


Who This Guide Is For

  • Developers integrating a digital goods supplier API
  • Store operators who have experienced failed orders due to empty balance
  • Anyone building a production-grade digital goods reseller system

How the Prepaid Balance Model Works

Most digital goods suppliers run on a prepaid (credit) model:

  1. You deposit funds into your reseller account (bank transfer, crypto, etc.)
  2. Each order creation deducts the wholesale cost from your balance
  3. When balance reaches zero, order creation calls return an error
  4. You top up to restore the balance

This is different from a net-30 model (where you pay after the fact). The prepaid model means you must always have sufficient balance before orders can process.


What the Balance API Returns

GET /balance
Authorization: Bearer {api_key}

Response:
{
  "balance": {
    "amount": 284.50,
    "currency": "USD",
    "updated_at": "2026-05-01T13:45:22Z"
  }
}

Key fields:

  • amount β€” current available balance
  • currency β€” the currency of the balance (usually USD)
  • updated_at β€” when the balance was last recalculated

How to Use the Balance API Effectively

1. Pre-Order Balance Check

Before creating an order, check that your balance is sufficient to cover the wholesale cost:

balance = get_balance()
order_cost = get_wholesale_price(sku, quantity)

if balance.amount < order_cost:
    # Do not call order creation
    # Show "temporarily unavailable" to customer
    # Trigger balance alert to ops team
    raise InsufficientBalanceError()

This prevents a frustrating UX where the customer has paid but the order fails because of your account balance.

2. Low-Balance Alert

Set an alert threshold β€” the minimum balance below which you want to receive a notification:

ALERT_THRESHOLD = 100.00  # Alert when balance < $100

def check_balance_alert():
    balance = get_balance()
    if balance.amount < ALERT_THRESHOLD:
        send_alert(f"Supplier balance low: ${balance.amount:.2f}")

Run this check as a scheduled job (every 15–30 minutes during business hours; every hour overnight).

3. Daily Balance Monitoring

Log your balance at the start and end of each trading day. This gives you:

  • Daily spend rate (useful for cash flow planning)
  • Alert if balance drops faster than expected (possible duplicate orders or system issue)
  • Data for projecting how far current balance will last
daily_spend = opening_balance - closing_balance
days_remaining = closing_balance / daily_spend  # Estimate

Balance vs. Order Volume Planning

Use your daily spend rate to plan balance top-ups:

Daily order volume Avg order cost Daily spend Balance for 7 days
100 orders $9.50 $950 $6,650
500 orders $9.50 $4,750 $33,250
2,000 orders $9.50 $19,000 $133,000

Top up when balance covers fewer than 3–5 days of expected spend. For high-volume stores, consider automating the top-up trigger.


Automated Balance Top-Up

For high-volume operators, automate the top-up process:

MIN_BALANCE_DAYS = 3  # Always maintain 3 days of runway

def check_and_top_up():
    balance = get_balance()
    daily_spend = calculate_daily_spend()  # From your order history
    days_remaining = balance.amount / daily_spend
    
    if days_remaining < MIN_BALANCE_DAYS:
        top_up_amount = daily_spend * 7  # Top up to 7 days
        trigger_top_up(top_up_amount)
        send_notification(f"Balance top-up triggered: ${top_up_amount:.2f}")

This requires your top-up method to support automation (some suppliers support automated top-up via bank transfer or crypto).


Balance API Rate Limits

Do not poll the balance endpoint on every order. This wastes API rate limits and adds latency to your order flow. Instead:

  • Cache balance: update every 60–300 seconds
  • On order creation: subtract the expected cost from your cached balance value
  • Reconcile cached balance with actual API response every 5–10 minutes

Checklist

  • Balance API endpoint identified and tested
  • Pre-order balance check implemented (block order if insufficient)
  • Low-balance alert threshold set (e.g., $100 or 24-hour spend equivalent)
  • Alert sent to ops team via Slack, Telegram, email or SMS
  • Balance monitoring scheduled job runs every 15–30 minutes
  • Daily balance log for spend tracking
  • Balance caching to avoid per-order API calls
  • (Optional) Automated top-up logic for high-volume operations

Frequently asked questions

What happens if my balance hits zero during a peak period?
All order creation calls return an error. Your store should handle this gracefully β€” show "temporarily unavailable" rather than letting payment succeed on an order that cannot fulfill.
How often should I call the balance API?
Every 5–15 minutes is sufficient for monitoring. Do not call it on every order request. Cache the balance and update the cache on a schedule.
Can I set up automatic top-ups when balance gets low?
This depends on your supplier's payment infrastructure. Some support automated top-ups; others require manual wire transfer. Check with your supplier.
What is a sensible low-balance alert threshold?
Set the threshold at your expected spend for 24–48 hours. If you spend $500/day, alert at $1,000 so you have two business days to top up. For overnight and weekend coverage, alert at 72-hour spend.
Does the balance API show pending deductions?
Not always. Some suppliers show the balance after all pending deductions; others show the confirmed balance only. Ask your supplier which calculation method they use.
Get FoxReload API access

Related articles