MELOSTORE.H2H
Introduction

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.

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"
Expected JSON Response
{
  "success": true,
  "message": "Welcome to Melostore H2H API Service",
  "version": "1.0.0"
}

Send the Content-Type: application/json header on POST requests.

Authentication

Header Authentication

Every H2H endpoint call requires dual credential verification sent through the HTTP request headers:

X-API-KeyString

Public API Key prefix from the partner dashboard.

X-Secret-KeyString

Secret key generated by the 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"
Expected JSON Response
{
  "success": true,
  "message": "Authentication successful."
}

Send the Content-Type: application/json header on POST requests.

Endpoints

View Profile

This endpoint is used to retrieve complete partner profile information, the active tier, remaining rate limit, and sandbox mode status.

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"
Expected JSON Response
{
  "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.

Endpoints

Check H2H Balance

A lightweight, low-latency endpoint to check your H2H balance in 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"
Expected JSON Response
{
  "success": true,
  "data": {
    "h2h_balance": 15750000.0,
    "is_sandbox_mode": false
  }
}

Send the Content-Type: application/json header on POST requests.

Endpoints

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.

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"
Expected JSON Response
{
  "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.

Endpoints

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.

POST/api/v1/h2h/transaction

Request Body (JSON Parameters):

sku_codeRequired

Kode SKU produk (contoh: ML86).

customer_targetRequired

Nomor target ID / nomor tujuan penerima pulsa.

customer_target_zoneOptional

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

buyer_trx_idRequired

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

sandbox_modeOptional

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
  }'
Expected JSON Response
{
  "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.

Endpoints

Check Transaction Status

Polls / manually checks the status of a single specific transaction ID.

GET/api/v1/h2h/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.

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"
Expected JSON Response
{
  "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.

Endpoints

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.

POST/api/v1/h2h/check-nickname

Request Body (JSON Parameters):

game_codeRequired

A valid game code.

customer_targetRequired

Target ID number / game player ID.

customer_target_zoneOptional

Game zone ID / server ID number.

sku_code
OptionalML Only

SKU code to check item purchase eligibility. The response will include the purchase_check field.

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"
  }'
Expected JSON Response
{
  "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:

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:

KategoriDescription
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;
}
Expected JSON Response
{
  "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.