API Overview
Purpose
The MeSIM distribution API lets partners automate eSIM purchases, product lookup, order lookup, balance checks, and stock checks. Purchase costs are deducted from your account balance.
Basic Information
| Base URL | https://mesimgo.com/api/v1 |
| Format | JSON |
| Authentication | Send your token with Authorization: Bearer {token}. |
Dujiao Next Integration
Purpose
Use this section when this site is the upstream supplier for a Dujiao Next store. The downstream store can sync categories, products, prices, images, stock, and create purchase orders against your balance.
Downstream Settings
| Site URL | https://mesimgo.com, enter this site root URL. Dujiao Next appends /api/v1/upstream automatically, so do not put the API path in the Site URL. |
| API Base URL | https://mesimgo.com/api/v1/upstream |
| API Key | Login required |
| API Secret | Shown after login. If hidden after refresh, regenerate the token to obtain it again. |
| Currency | USD |
| Billing | A successful purchase deducts the partner price from this site balance. |
Signature Authentication
| Header | Dujiao-Next-Api-Key / Dujiao-Next-Timestamp / Dujiao-Next-Signature |
| Timestamp | 10-digit Unix timestamp in seconds. Allowed drift is 60 seconds. |
| PATH | Path only, for example /api/v1/upstream/products, without domain or query string. |
| GET Body | GET requests use an empty body for signing: md5("") = d41d8cd98f00b204e9800998ecf8427e |
sign_string = METHOD + "\n" + PATH + "\n" + TIMESTAMP + "\n" + md5(RAW_BODY)
signature = hmac_sha256(API_SECRET, sign_string)
# GET https://mesimgo.com/api/v1/upstream/products?page=1&page_size=20
# PATH used for signing: /api/v1/upstream/products
# Do not sign with: /products or a path containing query string
curl -X POST "https://mesimgo.com/api/v1/upstream/ping" \
-H "Dujiao-Next-Api-Key: {api_key}" \
-H "Dujiao-Next-Timestamp: {timestamp}" \
-H "Dujiao-Next-Signature: {signature}" \
-H "Content-Type: application/json"
Endpoints
| Method | Path | Description |
|---|---|---|
POST | /ping | Connectivity, balance, and currency |
GET | /categories | Category list |
GET | /products?page=1&page_size=20 | Product list, max 100 per page |
GET | /products/{id} | Product detail |
POST | /orders | Create purchase order; this site supports quantity=1 only |
GET | /orders/{order_no} | Query order |
POST | /orders/{order_no}/cancel | Only unpaid orders can be canceled |
Product And Stock JSON
This site returns binary stock to Dujiao Next downstream stores: available is stock_status=in_stock / stock_quantity=999, unavailable is stock_status=out_of_stock / stock_quantity=0. Available means currently sellable, not reserved. The create-order result is authoritative.
{
"ok": true,
"items": [
{
"id": 31,
"title": {"zh-CN": "Hong Kong eSIM", "en": "Hong Kong eSIM"},
"images": ["https://mesimgo.com/uploads/example.jpg"],
"price_amount": "6.50",
"member_price": "6.50",
"original_price": "8.00",
"fulfillment_type": "auto",
"category_id": 8,
"skus": [
{
"id": 31,
"sku_code": "31",
"price_amount": "6.50",
"stock_status": "in_stock",
"stock_quantity": 999,
"is_active": true
}
]
}
],
"total": 1,
"page": 1,
"page_size": 20
}
Order And Fulfillment JSON
| sku_id | Use the SKU ID; currently it equals product ID on this site. |
| quantity | 1, multi-quantity purchase is not supported. |
| downstream_order_no | Required downstream order number. Use the same value for idempotent retries and avoiding duplicate charges. |
| callback_url | Optional. Enter the downstream store public HTTPS callback URL, for example https://<A站域名>/api/v1/upstream/callback; not localhost or private IP. |
{
"sku_id": 31,
"quantity": 1,
"downstream_order_no": "DN202606160001",
"callback_url": "https://<A站域名>/api/v1/upstream/callback"
}
{
"ok": true,
"order_no": "APIxxxxxxxxxxxxx",
"downstream_order_no": "DN202606160001",
"status": "completed",
"amount": "6.50",
"currency": "USD",
"fulfillment": {
"type": "auto",
"status": "delivered",
"payload": "LPA:1$xxx.prod.example.com$XXXXXX",
"delivery_data": {
"lpa": "LPA:1$xxx.prod.example.com$XXXXXX",
"number": "8985...",
"verify_code": "",
"qrcode": "data:image/png;base64,...",
"image_url": ""
}
}
}
Statuses, Errors, And Risk Controls
| status | pending_payment / paid / fulfilling / completed / canceled; fulfillment.status is delivered |
| error_code | bad_request, invalid_signature, timestamp_expired, sku_unavailable, insufficient_stock, insufficient_balance, invalid_callback_url, order_not_found, cancel_not_allowed |
| Price | The order amount is calculated server-side from api_price; downstream-submitted prices are ignored. |
| Stock | The product list is only a precheck. Order creation rechecks stock, balance, and product state. Failed creation does not charge balance. |
| Callback | Callbacks are signed with the same Dujiao-Next headers. Verify the signature and make processing idempotent by order_no/downstream_order_no. |
{
"ok": false,
"error_code": "insufficient_stock",
"error_message": "Insufficient stock"
}
Products
Use categoryId when purchasing, checking product details, or querying stock.
| categoryId | Name | Retail Price | Partner Price | Stock |
|---|---|---|---|---|
| Login required |
30GB
|
Login required | Login required | 9999 |
| Login required |
40GB
|
Login required | Login required | 9999 |
| Login required | CMLink Unlimited10GB | Login required | Login required | 9999 |
| Login required | MeSIM 12-Country Unlimited 100GB | Login required | Login required | 9999 |
| Login required | MeSIM 12-Country Unlimited 1000GB | Login required | Login required | 9999 |
| Login required | MeSIM 12-Country Unlimited 50GB | Login required | Login required | 9999 |
| Login required | MeSIM 12-Country Unlimited 25GB | Login required | Login required | 9999 |
| Login required | MeSIM 20GB | Login required | Login required | 9999 |
| Login required | 樂天 Rakuten Unlimited 4GB | Login required | Login required | 9999 |
| Login required | CMLink 52-Country Unlimited10GB | Login required | Login required | 9999 |
| Login required | CMLink 52-Country Unlimited20GB | Login required | Login required | 9999 |
| Login required |
Peoples 30GB
|
Login required | Login required | 0 |
| Login required |
|
Login required | Login required | 9999 |
| Login required |
15GB
|
Login required | Login required | 9999 |
| Login required |
24GB
|
Login required | Login required | 9999 |
| Login required | True 6GB | Login required | Login required | 0 |
Purchase Endpoint
POST /api/v1/pay
Create a real order and deduct the partner price from your balance after stock and account checks pass.
{
"categoryId": 31,
"quantity": 1,
"email": "[email protected]",
"clientOrderNo": "your-order-001"
}
| categoryId | Product type ID. |
| quantity | Purchase quantity. |
| Delivery email. It may be required by some products. | |
| clientOrderNo | Optional partner order number for idempotency and reconciliation. |
Webhooks
Order Completed
When a normal order is completed, MeSIM sends a JSON notification to your configured callback URL. Always verify the final status with the order query endpoint.
{
"title": "Product Name x 1",
"order_sn": "APIxxxxxxxxxxxxx",
"email": "[email protected]",
"actual_price": "5.50",
"order_info": "LPA:1$xxx.prod.example.com$XXXXXX",
"good_id": 31,
"gd_name": "Product Name"
}
Insufficient Stock
If an order was created but delivery later fails because stock is insufficient, MeSIM sends a stock_insufficient webhook.
{
"event": "stock_insufficient",
"status": false,
"code": 22003,
"msg": "Insufficient stock",
"categoryId": 31,
"good_id": 31,
"gd_name": "Product Name",
"clientOrderNo": "your-order-001",
"eventId": "sha256-event-id",
"occurredAt": "2026-04-30T12:34:56+00:00",
"sn": "APIxxxxxxxxxxxxx"
}