MELOSTORE.H2H
Pengenalan

Pengenalan H2H API

Platform Host-to-Host (H2H) Melostore.id dirancang dengan mengutamakan performa tinggi dan latensi rendah. Setiap transaksi diproses secara prioritas agar sukses dikirim dalam hitungan detik.

Uji Coba Sandbox Mode

Setiap akun baru didefaultkan dalam Sandbox Mode. Anda dapat menguji seluruh response code dan alur integrasi tanpa memotong saldo H2H nyata.

H2H API
Endpoint URL
https://api.melostore.id
Request Code
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"
Contoh Response JSON
{
  "success": true,
  "message": "Welcome to Melostore H2H API Service",
  "version": "1.0.0"
}

Kirim header Content-Type: application/json pada request POST.

Otentikasi

Otentikasi Header

Setiap pemanggilan endpoint H2H membutuhkan verifikasi kredensial ganda yang dikirimkan melalui header HTTP request:

X-API-KeyString

Prefix API Key publik dari dashboard partner.

X-Secret-KeyString

Secret key rahasia yang digenerate oleh partner.

H2H API
Endpoint URL
https://api.melostore.id
Request Code
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"
Contoh Response JSON
{
  "success": true,
  "message": "Authentication successful."
}

Kirim header Content-Type: application/json pada request POST.

Endpoints

Lihat Profil

Endpoint ini digunakan untuk memperoleh informasi lengkap profil mitra, tier aktif, sisa rate limit, dan status sandbox mode.

GET/api/v1/h2h/profile
H2H API
Endpoint URL
https://api.melostore.id
Request Code
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"
Contoh Response JSON
{
  "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"
  }
}

Kirim header Content-Type: application/json pada request POST.

Endpoints

Cek Saldo H2H

Endpoint ringan berlatensi rendah untuk memeriksa saldo H2H Anda secara real-time.

GET/api/v1/h2h/profile/balance
H2H API
Endpoint URL
https://api.melostore.id
Request Code
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"
Contoh Response JSON
{
  "success": true,
  "data": {
    "h2h_balance": 15750000.0,
    "is_sandbox_mode": false
  }
}

Kirim header Content-Type: application/json pada request POST.

Endpoints

Lihat Pricelist Produk

Mengambil daftar produk aktif yang tersedia untuk H2H beserta detail modal beli dan harga khusus tier partner Anda.

Rate Limit

Endpoint /api/v1/h2h/pricelists hanya bisa diakses sebanyak 1 kali per 10 menit.

GET/api/v1/h2h/pricelists
GET/api/v1/h2h/pricelists/{category_slug}
H2H API
Endpoint URL
https://api.melostore.id
Request Code
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"
Contoh Response JSON
{
  "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"
          }
        ]
      }
    }
  ]
}

Kirim header Content-Type: application/json pada request POST.

Endpoints

Membuat Transaksi

Mengirimkan request pembelian untuk produk apa pun di pricelist Anda — top up game, voucher, pulsa, paket data, token PLN, atau PPOB. Request diproses secara asinkron dan status akhirnya dikirim via webhook callback.

POST/api/v1/h2h/transaction

Request Body (JSON Parameters):

sku_codeWajib

Kode SKU produk (contoh: ML86).

customer_targetWajib

Nomor target ID / nomor tujuan penerima pulsa.

customer_target_zoneOpsional

Nomor zone ID game (jika dibutuhkan, seperti Mobile Legends).

buyer_trx_idWajib

ID transaksi unik dari sistem Anda (buyer transaction ID) untuk mencegah pemesanan ganda.

sandbox_modeOpsional

Override mode sandbox per request (true = sandbox, false = produksi). Fallback ke akun jika tidak dikirim.

H2H API
Endpoint URL
https://api.melostore.id
Request Code
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
  }'
Contoh Response JSON
{
  "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"
  }
}

Kirim header Content-Type: application/json pada request POST.

Endpoints

Cek Status Transaksi

Melakukan polling / pengecekan status manual untuk satu ID transaksi tertentu.

GET/api/v1/h2h/transaction/{id}

Catatan: Parameter {id} dapat diisi menggunakan ID Transaksi Internal (contoh: e93ad291-ffb0-40e1-b849-c1248ab02390) ATAU menggunakan buyer_trx_id yang Anda kirimkan saat pembuatan transaksi.

H2H API
Endpoint URL
https://api.melostore.id
Request Code
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"
Contoh Response JSON
{
  "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"
  }
}

Kirim header Content-Type: application/json pada request POST.

Endpoints

Cek Nickname Game

Endpoint ini digunakan untuk memvalidasi ID pemain game (customer target) sebelum melakukan transaksi. Fitur ini membantu meminimalisir kesalahan input ID game oleh pelanggan Anda.

POST/api/v1/h2h/check-nickname

Request Body (JSON Parameters):

game_codeWajib

Kode game yang valid.

customer_targetWajib

Nomor target ID / ID pemain game.

customer_target_zoneOpsional

Nomor zone ID / server ID game.

sku_code
OpsionalML Only

Kode SKU untuk cek kelayakan pembelian item. Response akan menyertakan field purchase_check.

H2H API
Endpoint URL
https://api.melostore.id
Request Code
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"
  }'
Contoh Response JSON
{
  "success": true,
  "data": {
    "game_code": "mobile-legends",
    "customer_target": "47486147",
    "customer_target_zone": "2076",
    "username": "VanillaSyrup",
    "region": "Indonesia"
  }
}

Kirim header Content-Type: application/json pada request POST.

Contoh Payload & Response Cek Nickname Game:

1. Mobile Legends: Bang Bang
Request Body
{
  "game_code": "mobile-legends",
  "customer_target": "47486147",
  "customer_target_zone": "2076"
}
Response (200 OK)
{
  "success": true,
  "data": {
    "game_code": "mobile-legends",
    "customer_target": "47486147",
    "customer_target_zone": "2076",
    "username": "VanillaSyrup",
    "region": "Indonesia"
  }
}
2. ML + SKU Check (Bisa Beli)
sku_code
Request Body
{
  "game_code": "mobile-legends",
  "customer_target": "47486147",
  "customer_target_zone": "2076",
  "sku_code": "ml-id-ft150"
}
Response (200 OK)
{
  "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
    }
  }
}
3. ML + SKU Check (Tidak Eligible)
sku_code
Request Body
{
  "game_code": "mobile-legends",
  "customer_target": "47486147",
  "customer_target_zone": "2076",
  "sku_code": "ml-id-ft500"
}
Response (200 OK)
{
  "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."
    }
  }
}
4. Error: ID Tidak Valid
Request Body
{
  "game_code": "mobile-legends",
  "customer_target": "999999999",
  "customer_target_zone": "99999"
}
Response (422 Unprocessable)
{
  "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:

KategoriDeskripsi
not_foundID pemain tidak ditemukan atau tidak valid.
restrictedAkun atau item tidak memenuhi syarat (misal: batasan wilayah/region).
unavailableProduk atau server game sedang tidak tersedia.
limit_reachedBatas verifikasi atau pembelian terlampaui untuk akun target.
validationInput parameter target tidak valid atau tidak lengkap.
serverServer game sedang pemeliharaan atau mengalami masalah teknis.
unknownKesalahan sistem internal lainnya.

Daftar Kode Error Spesifik:

Kode ErrorPesan StandardKategori
4001Kami tidak menemukan User ID: {id} / Akun tidak ditemukan.not_found
4002ID tidak memenuhi syarat untuk membeli item ini / batasan region.restricted
4003Layanan, server game, atau item produk tidak tersedia sementara.unavailable
4004Batas verifikasi atau pembelian terlampaui untuk akun ini.limit_reached
4006Input parameter target tidak lengkap atau format parameter tidak valid.validation
4007Server game sedang pemeliharaan (downtime). Silakan coba lagi nanti.server
4008Terjadi 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.

game_codeNama GameParameter TargetKeterangan
Memuat daftar game...
Callback

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.

H2H API
Endpoint URL
https://api.melostore.id
Request Code
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;
}
Contoh Response JSON
{
  "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"
}

Kirim header Content-Type: application/json pada request POST.