TopupCraft API v1

Sell our top-ups and vouchers on your own website or app. Import the catalog (products, variations, images, prices), place orders, and get status updates by webhook. Orders are paid from your TopupCraft wallet.

Base URLhttps://topupcraft.com/api/v1
FormatJSON
CurrencyBDT

Get your API key from Account → API.

Authentication

Send your key in the X-API-Key header on every request (Authorization: Bearer <key> also works). Keep it on your server, never in browser or app code. Regenerating the key disables the old one immediately.

curl https://topupcraft.com/api/v1/profile \
  -H "X-API-Key: sk_your_key_here"

Errors & limits

Every response has success. Errors carry a stable error.code:

{
  "success": false,
  "error": { "code": "insufficient_balance", "message": "Wallet balance is too low for this order." }
}
HTTPcodeMeaning
401unauthorizedMissing or invalid API key
402insufficient_balanceAdd money to your wallet
403ip_not_allowed, account_on_hold, account_disabledAccount or IP not allowed
404product_not_found, variation_not_found, order_not_foundUnknown id
409out_of_stock, order_failedCould not place the order (nothing charged)
422missing_field, invalid_field, invalid_quantityFix the request
429rate_limited, busyToo many requests, see Retry-After
503api_disabledAPI temporarily off

Rate limit: 60 requests per minute per key.

GET /profile

Your wallet balance and pricing.

{
  "success": true,
  "data": { "id": 15, "name": "My Shop", "email": "[email protected]",
            "balance": 5230.00, "currency": "BDT", "reseller": true, "discount_percent": 5 }
}

GET /catalog

All products available to you, with variations and your price (reseller discount already applied). GET /products/{id} returns one product.

{
  "success": true,
  "data": [{
    "id": 11,
    "title": "PUBG Mobile UC",
    "slug": "pubg-mobile-uc",
    "type": "topup",                       // topup | ingame | voucher
    "image": "https://.../uploads/media/11/pubg.png",
    "description": "Instant delivery",
    "fields": [                            // what to send in "fields" when ordering
      { "key": "player_id", "label": "Player ID", "type": "text", "required": true, "placeholder": "Player ID (UID)" }
    ],
    "variations": [
      { "id": 120, "title": "60 UC", "price": 114.00, "currency": "BDT", "available": true, "max_quantity": 1 }
    ]
  }]
}

Only variations with available: true can be ordered. Vouchers can be ordered in quantity up to max_quantity.

POST /orders

Places an order and pays it from your wallet.

FieldDescription
variation_idrequiredVariation id from the catalog
quantityoptionalDefault 1 (only vouchers allow more)
fieldsdependsObject keyed by the product's fields[].key
referenceoptionalYour own order id (max 100 chars), returned back to you

Send an Idempotency-Key header (any unique string, e.g. your order id). Retrying with the same key returns the first order instead of creating a new one, so a network timeout never charges you twice.

curl -X POST https://topupcraft.com/api/v1/orders \
  -H "X-API-Key: sk_your_key_here" \
  -H "Idempotency-Key: shop-order-1001" \
  -H "Content-Type: application/json" \
  -d '{"variation_id":120,"quantity":1,"fields":{"player_id":"5123456789"},"reference":"shop-order-1001"}'
// 201 Created
{
  "success": true,
  "data": {
    "id": 91702, "reference": "shop-order-1001",
    "status": "processing", "raw_status": "auto-processing",
    "product": { "id": 11, "title": "PUBG Mobile UC" },
    "variation": { "id": 120, "title": "60 UC" },
    "quantity": 1, "amount": 114.00, "currency": "BDT",
    "fields": { "player_id": "5123456789" },
    "codes": [], "message": null,
    "created_at": "2026-10-30T15:40:12+06:00", "updated_at": "2026-10-30T15:40:12+06:00"
  }
}

Voucher orders return the codes in codes right away when in stock.

GET /orders/{id}

{id} is our order id or your reference. GET /orders?page=1&per_page=20 lists your API orders, newest first.

Order statuses

statusMeaning
processingPaid, being delivered
completedDelivered (codes in codes for vouchers)
cancelledCancelled; the amount is returned to your wallet

raw_status shows our internal status for support questions.

Webhooks

Set a Webhook URL (https) in Account → API. When the status of one of your API orders changes we send:

POST https://your-site.com/webhook
X-Webhook-Event: order.updated
X-Webhook-Delivery: evt_381
X-Webhook-Signature: 6f1c...e9   (hex HMAC-SHA256 of the raw body, key = your webhook secret)

{ "id": "evt_381", "event": "order.updated", "created_at": "...", "data": { ...same as GET /orders/{id}... } }

Reply with any 2xx within 10 seconds. Failed deliveries are retried after 1 min, 5 min, 15 min and 1 hour. Use X-Webhook-Delivery to ignore duplicates, and treat the webhook as a hint: you can always confirm with GET /orders/{id}.

Verify the signature (PHP):

$body = file_get_contents('php://input');
$expected = hash_hmac('sha256', $body, 'whsec_your_secret');
if (! hash_equals($expected, $_SERVER['HTTP_X_WEBHOOK_SIGNATURE'] ?? '')) {
    http_response_code(401); exit;
}
$event = json_decode($body, true);

Node.js:

const sig = crypto.createHmac('sha256', SECRET).update(rawBody).digest('hex');
if (!crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(req.get('X-Webhook-Signature') || ''))) return res.sendStatus(401);

Importing products

  1. Call GET /catalog and save each product (title, type, image, description).
  2. Save each variation with its id; this is what you send as variation_id.
  3. Download image to your own storage if you like; the URL stays valid.
  4. Build your checkout fields from fields and send them back as fields.
  5. Set your own selling price on top of our price, and refresh the catalog regularly (prices and stock can change).
Cart
Shopping Cart

Your cart is empty.

Subtotal 0.00৳
Support