The Pricing Problem Every Reseller Faces
Digital gift card wholesale prices are not fixed. They fluctuate with exchange rates, regional supplier costs, and demand spikes. If you set a retail price once and forget it, you will eventually sell below cost โ or price yourself out of the market when costs drop.
The solution is automated price synchronization: your system polls the FoxReload API, computes a retail price from the latest wholesale cost, and pushes the update to your storefront without any manual intervention.
Architecture Overview
A robust price-sync pipeline has three components:
- Scheduler โ triggers the sync job on a fixed interval (every 30โ60 minutes is ideal)
- Price calculator โ applies your markup rules to the wholesale price
- Storefront updater โ pushes the new retail price to your database or e-commerce platform
Step 1 โ Fetch Current Wholesale Prices
GET /api/v1/catalog?category=google-play
Authorization: Bearer YOUR_API_KEY
The response includes wholesale_price for every SKU:
{
"products": [
{ "id": "gp-usd-5", "wholesale_price": 4.55, "currency": "USD" },
{ "id": "gp-usd-10", "wholesale_price": 9.10, "currency": "USD" },
{ "id": "gp-usd-25", "wholesale_price": 22.75, "currency": "USD" },
{ "id": "gp-usd-50", "wholesale_price": 45.50, "currency": "USD" }
]
}
Step 2 โ Define Your Markup Rules
Flat percentage margins work well for starters, but tiered rules maximize competitiveness:
def compute_retail_price(wholesale: float, face_value: float) -> float:
"""
Tiered markup:
- Cards <= $10 face value: 18% margin
- Cards $11โ$50: 14% margin
- Cards > $50: 11% margin
"""
if face_value <= 10:
margin = 1.18
elif face_value <= 50:
margin = 1.14
else:
margin = 1.11
retail = wholesale * margin
# Round to nearest $0.05 for clean pricing
return round(retail * 20) / 20
You can also add a floor price to ensure you never go below a minimum profit:
MIN_PROFIT_USD = 0.30
def safe_retail(wholesale, face_value):
computed = compute_retail_price(wholesale, face_value)
return max(computed, wholesale + MIN_PROFIT_USD)
Step 3 โ Detect Price Changes
Do not update your storefront on every sync cycle โ only when prices actually changed. This reduces database writes and avoids confusing price history logs.
def get_price_changes(new_prices: dict, conn) -> list:
changes = []
cur = conn.cursor()
for product_id, new_cost in new_prices.items():
cur.execute(
"SELECT cost_price FROM digital_products WHERE id=%s",
(product_id,)
)
row = cur.fetchone()
if row and abs(row[0] - new_cost) > 0.001:
changes.append((product_id, new_cost))
return changes
Step 4 โ Apply Updates to Your Storefront
def apply_price_updates(changes: list, conn):
cur = conn.cursor()
for product_id, new_cost in changes:
# Fetch face_value to re-apply tier logic
cur.execute(
"SELECT face_value FROM digital_products WHERE id=%s",
(product_id,)
)
face_value = cur.fetchone()[0]
new_retail = safe_retail(new_cost, face_value)
cur.execute("""
UPDATE digital_products
SET cost_price=%s, retail_price=%s, synced_at=NOW()
WHERE id=%s
""", (new_cost, new_retail, product_id))
conn.commit()
print(f"Updated prices for {len(changes)} products.")
Step 5 โ Schedule the Sync Job
Using cron (Linux/macOS)
# Every 30 minutes
*/30 * * * * /usr/bin/python3 /opt/foxreload/price_sync.py >> /var/log/price_sync.log 2>&1
Using Celery Beat (Python)
from celery.schedules import crontab
CELERYBEAT_SCHEDULE = {
"sync-foxreload-prices": {
"task": "tasks.sync_prices",
"schedule": crontab(minute="*/30"),
}
}
Using Node.js (node-cron)
const cron = require("node-cron");
const { syncPrices } = require("./priceSync");
cron.schedule("*/30 * * * *", async () => {
console.log("Running FoxReload price sync...");
await syncPrices();
});
Step 6 โ Notify Your Team on Large Swings
If a price changes by more than 5%, it may warrant human review before the storefront is updated automatically.
ALERT_THRESHOLD = 0.05 # 5%
def notify_if_large_swing(product_id, old_cost, new_cost):
change = abs(new_cost - old_cost) / old_cost
if change > ALERT_THRESHOLD:
send_slack_alert(
f"Price swing alert: {product_id} changed by "
f"{change*100:.1f}% ({old_cost} โ {new_cost})"
)
Price Sync Checklist
- Sync frequency: every 30โ60 minutes
- Apply tiered margins, not flat markup
- Log every price change with timestamp
- Alert on swings above 5%
- Never let
retail_pricefall belowcost_price - Cache last-known prices to detect changes without extra queries
What Comes Next
With automated price sync in place, your margins are protected around the clock. The logical next steps are:
- Inventory alerts โ get notified when stock drops below a threshold
- Competitor price monitoring โ compare your retail prices against market benchmarks
- Multi-currency support โ sync prices for regional cards in EUR, TRY, INR, and others
See Also
- How to manage Google Play code inventory
- How to connect Google Play Gift Cards to your shop via API
- How to set up webhooks for digital code delivery
Keep margins healthy automatically. The FoxReload API gives you real-time wholesale prices โ wire up the sync job once and stop worrying about manual price updates.

