Most GSM unlocking and checking suppliers speak the same language: the Dhru Fusion API format. That is good news for a shop owner, because one connection method covers most of the suppliers you will ever use. This article explains what happens when you connect one, and what to look at when something does not work.
What you need from the supplier
Every Dhru Fusion-style supplier gives its customers three things in their account area:
- the API URL of their server,
- your username with them,
- an API access key.
Some suppliers also ask you to whitelist your server’s IP address before the key works. If yours does, add your hosting server’s IP in their panel first. Your host can tell you what it is.
What happens when you add the supplier
In GSM X Tool you add the supplier with the URL and the key, and the shop imports the supplier’s services, prices, order fields and delivery times. You do not type in a service list by hand. From then on:
- each order is sent to the supplier the moment the customer places it,
- the cron job asks for the result until it is final, and saves it to the order,
- new services, price changes and changed fields are pulled from the supplier every time its sync runs.
What a request looks like
Under the hood, a Dhru Fusion request is a simple HTTPS POST with four fields: username, apiaccesskey, requestformat and action. Placing an order adds the service ID and the IMEI as parameters. The answer is JSON, under either SUCCESS or ERROR. Order status uses four numbers:
0: new,1: in process,3: rejected,4: success.
You never have to build these requests yourself, but knowing the shape makes the API log much easier to read.
Prices: keep your margin automatic
Because supplier prices change, it is a bad idea to fix your selling price by hand. Group your services and price them as a markup on the supplier’s cost, per customer group. When the supplier changes a price, the next sync moves your price with it and your margin stays the same.
When an order fails: read the API log
Every request sent to a supplier and every answer it gave is kept in the API log. When an order is rejected or stuck, open it there before contacting anyone. The usual answers are:
- "Authentication failed" or similar: the key was changed, or the supplier wants your server IP whitelisted.
- "Insufficient credit": your balance with the supplier ran out. The order was not placed, and the customer is refunded when it is rejected.
- "Invalid IMEI" or a missing field: the supplier changed what a service requires. Run a service sync so the order form asks for the right fields.
- A timeout: the supplier’s server was slow or down. The next cron run tries again.
Several suppliers for the same service
Suppliers sell out, go offline and change prices. You can connect several and keep a backup for your most popular services, so an order goes to the next supplier when the first one fails or has sold out. Your customers keep getting results either way.
Next: give your own resellers an API, or see the full reference on the Developers page.