واجهة برمجية احترافية لدمج المتجر في أنظمتك | تكامل آمن وسريع مع جميع الخدمات
الرابط الأساسي لجميع طلبات API
جميع الإندبوينتات تبدأ بهذا الرابط
عرض جميع المنتجات المتاحة عبر API بشكل مباشر
الحصول على التوكن وإدارة إعدادات API
يجب إرسال رمز الوصول الخاص بك في الهيدر مع كل طلب. يمكنك الحصول على التوكن من صفحة إدارة API.
الرابط الكامل: https://mhd-game.com/api/client/api/profile
curl -X GET https://mhd-game.com/api/client/api/profile \
-H "api-token: your_api_token_here"
هذا الإندبوينت يعيد قائمة بجميع المنتجات المتاحة مع التفاصيل. يمكنك أيضاً زيارة صفحة المنتجات API لعرضها بشكل مباشر.
الرابط الكامل: https://mhd-game.com/api/client/api/products
curl -X GET https://mhd-game.com/api/client/api/products \
-H "api-token: YOUR_API_TOKEN"
[
{
"id": 2054,
"name": "Google Play 10 USD",
"price": 8.5,
"category_name": "بطاقات",
"product_type": "digital",
"available": true,
"stock": 99,
"qty_values": {
"min": 1,
"max": 10
}
},
{
"id": 2055,
"name": "iTunes 25 USD",
"price": 21.0,
"category_name": "بطاقات",
"product_type": "digital",
"available": true,
"stock": 50,
"qty_values": {
"min": 1,
"max": 5
}
}
]
[...] وليس كائن يحتوي على مفتاح products.
لإنشاء طلب شراء، يتم تمرير المعاملات كـ Query Parameters: qty و playerId و order_uuid الفريد لمنع التكرار.
anyKey، ويتم استخدامه عادةً لإرسال رقم السيرفر. هذا الباراميتر يرسل للمزود فقط عند المنتجات التي تحتاجه.
الرابط الكامل: https://mhd-game.com/api/client/api/newOrder/{product_id}/params
curl "https://mhd-game.com/api/client/api/newOrder/2054/params?qty=1&playerId=0992588759&anyKey=1234&order_uuid=unique_order_xyz_123" \
-H "api-token: YOUR_API_TOKEN"
{
"status": "OK",
"data": {
"order_id": "unique_order_xyz_123",
"status": "accept",
"price": 0.04829939,
"data": {
"playerId": "0992588759",
"anyKey": "1234"
},
"replay_api": null
}
}
playerId هو آيدي اللاعب، و anyKey هو السيرفر. مثال: playerId=123456789&anyKey=1234.
يمكنك متابعة حالة الطلب باستخدام الـ order_id (نفس order_uuid الذي أرسلته سابقاً).
الرابط الكامل: https://mhd-game.com/api/client/api/check?orders=[ID]&uuid=1
curl "https://mhd-game.com/api/client/api/check?orders=%5Bunique_order_xyz_123%5D&uuid=1" \
-H "api-token: YOUR_API_TOKEN"
{
"status": "OK",
"data": [
{
"order_id": "unique_order_xyz_123",
"status": "wait"
}
]
}
يعيد الرصيد الحالي والمعلومات الأساسية للمستخدم المرتبط بالتوكن.
الرابط الكامل: https://mhd-game.com/api/client/api/profile
curl -X GET https://mhd-game.com/api/client/api/profile \
-H "api-token: YOUR_API_TOKEN"
{
"status": "OK",
"balance": 125.75,
"currency": "USD",
"user": "developer@example.com"
}
// مثال لإنشاء طلب باستخدام Fetch API
const API_BASE = 'https://mhd-game.com/api';
const API_TOKEN = 'your_api_token';
const createOrder = async () => {
const productId = 2054;
const quantity = 1;
const playerId = 'player123';
const orderUuid = crypto.randomUUID();
const url = `${API_BASE}/client/api/newOrder/${productId}/params?qty=${quantity}&playerId=${playerId}&order_uuid=${orderUuid}`;
const res = await fetch(url, {
method: 'GET',
headers: {
'api-token': API_TOKEN
}
});
const data = await res.json();
console.log('Order response:', data);
// التحقق من الحالة
if(data.status === 'OK') {
const checkUrl = `${API_BASE}/client/api/check?orders=[${orderUuid}]&uuid=1`;
const checkRes = await fetch(checkUrl, { headers: { 'api-token': API_TOKEN } });
const checkData = await checkRes.json();
console.log('Order status:', checkData);
}
};
createOrder();