This guide covers the other side of our reseller API guide. That post describes what a store must offer when partners buy from it. Here you are the buyer: you run a gift card or game top-up store and want to connect it to a supplier or distributor API, so orders are fulfilled without anyone copying codes by hand.
1. Authentication and test environment
Most suppliers give you an API key, sometimes with a secret used to sign each request, and often an IP allow-list.
- Keep keys in server configuration, never in website code, the bot or a spreadsheet.
- Ask for a test (sandbox) environment with separate keys. If there is none, ask how test orders are cancelled and refunded.
- If the supplier uses an allow-list, give them a fixed server IP, and write down who can rotate the key and how.
2. Catalog sync without scraping
The supplier has its own product IDs, names, face values and regions. Your store has its own catalog. Do not import theirs wholesale; map it. For each of your products, store the supplier product ID, face value, region and the supplier's currency.
Sync prices, availability and removed products on a schedule through the API. A product that disappears from the supplier's list should be hidden in your store automatically, not discovered by a customer. Never scrape the supplier's website; ask for the catalog endpoint.
3. Your balance with the supplier
Distributors usually work prepaid: you deposit funds, and each order is deducted from that balance. Two consequences:
- Read your supplier balance through the API and alert yourself well before it runs out. To the customer, an empty supplier balance looks like a broken store.
- Record every deposit in your own books with date, amount, currency and the supplier's reference. You will need it for reconciliation.
4. Placing orders idempotently
This rule protects your money. Each order you send carries your own unique order ID, often called externalOrderId or reference. If the connection drops and you retry, the supplier should recognise the same ID and return the original order instead of charging you twice. The IETF is standardising the same idea as an Idempotency-Key header.
Before going live, ask the supplier directly: what happens if I send the same reference twice? If the answer is unclear, do not retry blindly; first look up the order status by your reference.
Keep money as decimals, never floating point, and store the supplier's price, currency and order ID on your order.
5. Pending, failed and refunded orders
Top-ups are not always instant. Plan for three outcomes:
- Pending: the supplier accepted the order but has not delivered yet. Show the customer a clear status and check again by webhook or by polling the status endpoint at a sensible interval.
- Failed: nothing was delivered. Refund the customer to their balance or original payment, and record the refund as a new ledger entry instead of editing the old one.
- Reversed later: some suppliers reverse an order hours after it completed. Your system needs a path for that too.
6. Webhooks and signatures
If the supplier sends status updates to your server, verify every one. The usual method is an HMAC signature over the request body with a shared secret, plus a timestamp so old messages cannot be replayed; Stripe's webhook documentation describes the pattern well. Treat a webhook as a signal: confirm the status through the API before releasing codes or money, and expect the same webhook to arrive twice.
7. Rate limits
Suppliers cap how many requests you may send. Over the limit you usually get HTTP 429 Too Many Requests (RFC 6585), sometimes with a Retry-After header. Queue orders, wait and retry with the same reference; do not hammer the API in a loop.
8. Daily reconciliation
Once a day, compare the supplier's statement or order list with your own ledger. Every order, amount and refund on their side should match one on yours. Typical differences: an order you marked failed that the supplier charged, a refund they issued that you never recorded, or a deposit credited in another currency. Fix them while the logs still exist.
9. Margin per product
Margin is not one number for the whole store. For each product track the supplier cost, currency conversion, payment fees and your selling price. When a supplier raises a price, a product can turn unprofitable overnight. Set a minimum margin and get an alert, or pause the product, when a sync pushes it below.
10. Stock-outs and monitoring
Watch a few signals: failed order rate per supplier, orders pending longer than your limit, supplier balance and products marked unavailable. A second supplier for your best sellers lets you switch when one runs dry.
The supplier side in Kavia Commerce
Kavia Commerce comes with prebuilt supplier integrations: one on Kavia Start, three on Kavia Pro together with automatic game top-ups, and all prebuilt integrations plus one new custom integration per month on Kavia Max. New suppliers are connected on request. Stocked codes and supplier API products go to the buyer as soon as payment is confirmed, and the website, Telegram bot and partner API read the same catalog. Plan details are on the plans page; to check a specific distributor, send us its API documentation.
Questions
What is the most important rule when connecting to a supplier API?
Idempotent orders. Send your own unique order ID with every order and make sure the supplier returns the original order when the same ID arrives again. Otherwise a network retry can cost you a second purchase.
Can I scrape the supplier website to get products and prices?
No. Pages change without notice and scraped prices go stale. Use the supplier's catalog endpoint, map their product IDs to yours and sync on a schedule.
What should happen to an order that stays pending?
Show the customer a clear status, check the supplier again by webhook or status request, and send the order to staff after a set time. If it fails, refund the customer with a new ledger entry.
How often should I reconcile with my supplier?
Daily. Compare the supplier's statement with your ledger order by order, including refunds and deposits, and fix differences while the logs still exist.
Can Kavia Commerce connect to my supplier?
Kavia Commerce has prebuilt supplier integrations: one on Start, three on Pro and all of them plus one new custom integration per month on Max. New suppliers are connected on request; send us the supplier's API documentation.



