H2H API Introduction
The Melostore.id Host-to-Host (H2H) platform is built for high performance and low latency. Every transaction is processed with priority so it is fulfilled within seconds.
Sandbox Mode Trial
Every new account defaults to Sandbox Mode. You can test all response codes and integration flows without deducting real H2H balance.
curl -X GET "https://api.melostore.id/api/v1/h2h/profile" \ -H "X-API-Key: YOUR_API_KEY" \ -H "X-Secret-Key: YOUR_SECRET_KEY"
{
"success": true,
"message": "Welcome to Melostore H2H API Service",
"version": "1.0.0"
}Send the Content-Type: application/json header on POST requests.
Header Authentication
Every H2H endpoint call requires dual credential verification sent through the HTTP request headers:
| Header Key | Type | Description |
|---|---|---|
| X-API-Key | String | Public API Key prefix from the partner dashboard. |
| X-Secret-Key | String | Secret key generated by the partner. |
Public API Key prefix from the partner dashboard.
Secret key generated by the partner.
curl -X GET "https://api.melostore.id/api/v1/h2h/profile" \ -H "X-API-Key: YOUR_API_KEY" \ -H "X-Secret-Key: YOUR_SECRET_KEY"
{
"success": true,
"message": "Authentication successful."
}Send the Content-Type: application/json header on POST requests.
View Profile
This endpoint is used to retrieve complete partner profile information, the active tier, remaining rate limit, and sandbox mode status.
curl -X GET "https://api.melostore.id/api/v1/h2h/profile" \ -H "X-API-Key: YOUR_API_KEY" \ -H "X-Secret-Key: YOUR_SECRET_KEY"
{
"success": true,
"data": {
"id": "783ad2e9-4e50-4ba2-809a-112df8bc4081",
"name": "Demo H2H",
"email": "[EMAIL_ADDRESS]",
"tier": {
"name": "H2H Premium (Platinum)",
"code": "h2h_premium",
"rate_limit": 150,
"max_ips": 10
},
"h2h_balance": 15750000.0,
"is_sandbox_mode": false,
"total_volume_30_days": 182450000.0,
"webhook_url": "https://client.site/webhook",
"created_at": "2026-07-10T17:40:00Z"
}
}Send the Content-Type: application/json header on POST requests.
Check H2H Balance
A lightweight, low-latency endpoint to check your H2H balance in real time.
curl -X GET "https://api.melostore.id/api/v1/h2h/profile/balance" \ -H "X-API-Key: YOUR_API_KEY" \ -H "X-Secret-Key: YOUR_SECRET_KEY"
{
"success": true,
"data": {
"h2h_balance": 15750000.0,
"is_sandbox_mode": false
}
}Send the Content-Type: application/json header on POST requests.
View Product Pricelist
Retrieves the list of active products available for H2H along with cost details and your partner tier's special pricing.
Rate Limit
The /api/v1/h2h/pricelists endpoint can only be accessed once every 10 minutes.
curl -X GET "https://api.melostore.id/api/v1/h2h/pricelists" \ -H "X-API-Key: YOUR_API_KEY" \ -H "X-Secret-Key: YOUR_SECRET_KEY"
{
"success": true,
"data": [
{
"name": "1.045 Diamonds",
"sku_code": "ml-id-1045",
"price": 263316,
"category_name": "Game",
"brand_name": "Mobile Legends (Indonesia)",
"type_name": "ML Diamonds",
"status": "active",
"h2h_status": "active",
"inquiry_fields": {
"fields": [
{
"key": "target_id",
"name": "User ID",
"type": "text",
"placeholder": "Masukkan User ID"
},
{
"key": "target_zone",
"name": "Zone ID",
"type": "text",
"placeholder": "Masukkan Zone ID"
}
]
}
}
]
}Send the Content-Type: application/json header on POST requests.
Create Transaction
Sends a purchase request for any product in your pricelist — game top up, voucher, mobile credit, data plan, PLN token, or PPOB. The request is processed asynchronously and the final status is delivered via webhook callback.
Request Body (JSON Parameters):
| Parameter | Status | Description |
|---|---|---|
| sku_code | Required | Product SKU code (e.g. ML86). |
| customer_target | Required | Target ID number / destination number for the mobile credit recipient. |
| customer_target_zone | Optional | Game zone ID number (if required, such as Mobile Legends). |
| buyer_trx_id | Required | A unique transaction ID from your system (buyer transaction ID) to prevent duplicate orders. |
| sandbox_mode | Optional | Override sandbox mode per request (true = sandbox/simulation, false = production). If omitted, it automatically falls back to the sandbox setting on your H2H account. |
Kode SKU produk (contoh: ML86).
Nomor target ID / nomor tujuan penerima pulsa.
Nomor zone ID game (jika dibutuhkan, seperti Mobile Legends).
ID transaksi unik dari sistem Anda (buyer transaction ID) untuk mencegah pemesanan ganda.
Override mode sandbox per request (true = sandbox, false = produksi). Fallback ke akun jika tidak dikirim.
curl -X POST "https://api.melostore.id/api/v1/h2h/transaction" \
-H "X-API-Key: YOUR_API_KEY" \
-H "X-Secret-Key: YOUR_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"sku_code": "ML86",
"customer_target": "12345678",
"customer_target_zone": "2039",
"buyer_trx_id": "unique_tx_ref_001",
"sandbox_mode": true
}'{
"success": true,
"message": "Transaction successfully created and queued.",
"data": {
"id": "e93ad291-ffb0-40e1-b849-c1248ab02390",
"buyer_trx_id": "unique_tx_ref_001",
"sku_code": "ML86",
"product_name": "Mobile Legends 86 Diamonds",
"customer_target": "12345678",
"customer_target_zone": "2039",
"price": 18700.0,
"status": "pending",
"serial_number": null,
"webhook_delivery_status": "pending",
"is_sandbox": false,
"created_at": "2026-07-10T17:40:00+00:00"
}
}Send the Content-Type: application/json header on POST requests.
Check Transaction Status
Polls / manually checks the status of a single specific transaction ID.
Note: The {id} parameter can be filled using the Internal Transaction ID (e.g. e93ad291-ffb0-40e1-b849-c1248ab02390) OR using the buyer_trx_id you sent when creating the transaction.
curl -X GET "https://api.melostore.id/api/v1/h2h/transaction/e93ad291-ffb0-40e1-b849-c1248ab02390" \ -H "X-API-Key: YOUR_API_KEY" \ -H "X-Secret-Key: YOUR_SECRET_KEY"
{
"success": true,
"data": {
"id": "e93ad291-ffb0-40e1-b849-c1248ab02390",
"buyer_trx_id": "unique_tx_ref_001",
"sku_code": "ML86",
"product_name": "Mobile Legends 86 Diamonds",
"customer_target": "12345678",
"customer_target_zone": "2039",
"price": 18700.0,
"status": "success",
"serial_number": "MLO20260710A3F9KZ71",
"webhook_delivery_status": "sent",
"is_sandbox": false,
"created_at": "2026-07-10T17:40:00+00:00"
}
}Send the Content-Type: application/json header on POST requests.
Check Game Nickname
This endpoint is used to validate a game player ID (customer target) before making a transaction. This feature helps minimize game ID input errors by your customers.
Request Body (JSON Parameters):
| Parameter | Status | Description |
|---|---|---|
| game_code | Required | A valid game code (e.g. mobile-legends, free-fire). |
| customer_target | Required | Target ID number / game player ID. |
| customer_target_zone | Optional | Game zone ID / server ID number if required (such as in Mobile Legends). |
| sku_code | Optional | SKU code to check item purchase eligibility (e.g. ml-id-ft150).Mobile Legends OnlyThe response will include the purchase_check field if this parameter is sent. |
A valid game code.
Target ID number / game player ID.
Game zone ID / server ID number.
SKU code to check item purchase eligibility. The response will include the purchase_check field.
curl -X POST "https://api.melostore.id/api/v1/h2h/check-nickname" \
-H "X-API-Key: YOUR_API_KEY" \
-H "X-Secret-Key: YOUR_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"game_code": "mobile-legends",
"customer_target": "47486147",
"customer_target_zone": "2076",
"sku_code": "ml-id-ft150"
}'{
"success": true,
"data": {
"game_code": "mobile-legends",
"customer_target": "47486147",
"customer_target_zone": "2076",
"username": "VanillaSyrup",
"region": "Indonesia"
}
}Send the Content-Type: application/json header on POST requests.
Game Nickname Check Payload & Response Examples:
{
"game_code": "mobile-legends",
"customer_target": "47486147",
"customer_target_zone": "2076"
}{
"success": true,
"data": {
"game_code": "mobile-legends",
"customer_target": "47486147",
"customer_target_zone": "2076",
"username": "VanillaSyrup",
"region": "Indonesia"
}
}{
"game_code": "mobile-legends",
"customer_target": "47486147",
"customer_target_zone": "2076",
"sku_code": "ml-id-ft150"
}{
"success": true,
"data": {
"game_code": "mobile-legends",
"customer_target": "47486147",
"customer_target_zone": "2076",
"username": "VanillaSyrup",
"region": "Indonesia",
"purchase_check": {
"sku_code": "ml-id-ft150",
"sku_name": "300 Diamonds (150+150) first top up",
"sku_type": "first_topup",
"can_purchase": true
}
}
}{
"game_code": "mobile-legends",
"customer_target": "47486147",
"customer_target_zone": "2076",
"sku_code": "ml-id-ft500"
}{
"success": true,
"data": {
"game_code": "mobile-legends",
"customer_target": "47486147",
"customer_target_zone": "2076",
"username": "VanillaSyrup",
"region": "Indonesia",
"purchase_check": {
"sku_code": "ml-id-ft500",
"sku_name": "1000 Diamonds (500+500) first top up",
"sku_type": "first_topup",
"can_purchase": false,
"error_code": -101,
"error_msg": "SKU ini tidak tersedia atau sudah pernah diklaim oleh akun ini."
}
}
}{
"game_code": "mobile-legends",
"customer_target": "999999999",
"customer_target_zone": "99999"
}{
"success": false,
"message": "Kami tidak menemukan User ID: {0}",
"error": {
"code": 4001,
"message": "Kami tidak menemukan User ID: {0}",
"category": "not_found"
}
}Daftar Kategori Error Verifikasi Game:
| Kategori | Description |
|---|---|
| not_found | ID pemain tidak ditemukan atau tidak valid. |
| restricted | Akun atau item tidak memenuhi syarat (misal: batasan wilayah/region). |
| unavailable | Produk atau server game sedang tidak tersedia. |
| limit_reached | Batas verifikasi atau pembelian terlampaui untuk akun target. |
| validation | Input parameter target tidak valid atau tidak lengkap. |
| server | Server game sedang pemeliharaan atau mengalami masalah teknis. |
| unknown | Kesalahan sistem internal lainnya. |
Daftar Kode Error Spesifik:
| Kode Error | Pesan Standard | Kategori |
|---|---|---|
| 4001 | Kami tidak menemukan User ID: {id} / Akun tidak ditemukan. | not_found |
| 4002 | ID tidak memenuhi syarat untuk membeli item ini / batasan region. | restricted |
| 4003 | Layanan, server game, atau item produk tidak tersedia sementara. | unavailable |
| 4004 | Batas verifikasi atau pembelian terlampaui untuk akun ini. | limit_reached |
| 4006 | Input parameter target tidak lengkap atau format parameter tidak valid. | validation |
| 4007 | Server game sedang pemeliharaan (downtime). Silakan coba lagi nanti. | server |
| 4008 | Terjadi kesalahan internal yang tidak dikenal. | unknown |
Daftar Game yang Tersedia:
Gunakan nilai di kolom game_code saat memanggil API. Target parameter dipetakan ke customer_target dan customer_target_zone.
Webhook Callback
Setiap kali transaksi selesai — baik berhasil maupun gagal — backend Melostore akan mengirimkan POST request callback ke URL webhook yang sudah Anda konfigurasi.
Validasi Tanda Tangan Webhook
Gunakan header signature X-H2H-Signature yang dikirim untuk memvalidasi keaslian body request. Tanda tangan diperoleh dari hash HMAC SHA256 dari payload JSON mentah menggunakan webhook_secret akun Anda.
const crypto = require('crypto');
// Verifikasi signature webhook
function verifySignature(payloadString, incomingSignature, webhookSecret) {
const hash = crypto
.createHmac('sha256', webhookSecret)
.update(payloadString)
.digest('hex');
return hash === incomingSignature;
}{
"id": "e93ad291-ffb0-40e1-b849-c1248ab02390",
"buyer_trx_id": "unique_tx_ref_001",
"sku_code": "ML86",
"customer_target": "12345678",
"customer_target_zone": "2039",
"price": 18700.0,
"status": "success",
"serial_number": "MLO20260710A3F9KZ71",
"is_sandbox": false,
"created_at": "2026-07-10T17:40:00+00:00"
}Send the Content-Type: application/json header on POST requests.