Daftar Produk

587.044 request sukses

Endpoint ini digunakan untuk mengambil daftar semua produk yang tersedia atau detail produk tertentu menggunakan kode produk.

Catatan: Gunakan endpoint ini untuk mendapatkan informasi terbaru mengenai produk, harga, status ketersediaan, dan waktu cut-off transaksi.
Limitasi Request:
  • Tanpa parameter code: Request dapat dilakukan setiap 6 menit sekali untuk mengambil seluruh daftar produk
  • Dengan parameter code: Request dapat dilakukan setiap 5 detik sekali untuk mengambil produk spesifik

Endpoint

POST /v1/product-list

https://api.kokinpay.com/v1/product-list

Request Parameters

Berikut adalah parameter yang diperlukan untuk melakukan request daftar produk:

Parameter Type Status Deskripsi
cmd string Required Command yang digunakan. Untuk daftar produk gunakan nilai: product-list
api_key string Required API Key yang didapatkan setelah registrasi di kokinpay.com
sign string Required Signature untuk validasi request. Format: MD5(api_key + cmd)
code string Optional Kode produk spesifik. Jika diisi, hanya akan mengembalikan data produk dengan kode tersebut

Cara Membuat Signature

Signature dibuat dengan menggabungkan api_key dan cmd kemudian di-hash menggunakan MD5.

Formula Signature
sign = MD5(api_key + cmd)
Contoh Pembuatan Signature (PHP)
$api_key = "your-api-key-here";
$cmd = "product-list";

$sign = md5($api_key . $cmd);

echo $sign; // hasil hash MD5
Contoh Pembuatan Signature (JavaScript/Node.js)
const crypto = require('crypto');

const api_key = "your-api-key-here";
const cmd = "product-list";

const sign = crypto.createHash('md5')
    .update(api_key + cmd)
    .digest('hex');

console.log(sign); // hasil hash MD5
Contoh Pembuatan Signature (Python)
import hashlib

api_key = "your-api-key-here"
cmd = "product-list"

sign = hashlib.md5((api_key + cmd).encode()).hexdigest()

print(sign)  # hasil hash MD5

Request Example

Request Semua Produk

Request untuk mengambil seluruh daftar produk yang tersedia:

Request Body
{
  "cmd": "product-list",
  "api_key": "your-api-key-here",
  "sign": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6"
}
cURL Example
curl -X POST https://api.kokinpay.com/v1/product-list \
  -H "Content-Type: application/json" \
  -d '{
    "cmd": "product-list",
    "api_key": "your-api-key-here",
    "sign": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6"
  }'

Request Produk Spesifik

Request untuk mengambil detail produk tertentu menggunakan kode produk:

Request Body
{
  "cmd": "product-list",
  "api_key": "your-api-key-here",
  "sign": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6",
  "code": "ML100"
}
cURL Example
curl -X POST https://api.kokinpay.com/v1/product-list \
  -H "Content-Type: application/json" \
  -d '{
    "cmd": "product-list",
    "api_key": "your-api-key-here",
    "sign": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6",
    "code": "ML100"
  }'

Response

API akan mengembalikan response dalam format JSON dengan struktur sebagai berikut:

Response Sukses (200 OK) - Semua Produk

{
  "status": true,
  "data": [
    {
      "product_name": "Weekly Diamond Pass",
      "category": "Top Up Games",
      "brand": "Mobile Legends",
      "code": "KPMLWDP",
      "type": "Special Items (Indonesia)",
      "price": 27223,
      "multi": true,
      "product_status": "on",
      "cut_off_start": "23:59",
      "cut_off_end": "00:00"
    },
    {
      "product_name": "Telkomsel 5.000",
      "category": "Pulsa",
      "brand": "Telkomsel",
      "code": "KPTSEL5",
      "type": "Pulsa Reguler",
      "price": 5350,
      "multi": true,
      "product_status": "on",
      "cut_off_start": "23:45",
      "cut_off_end": "00:15"
    }
  ]
}

Response Sukses (200 OK) - Produk Spesifik

{
  "status": true,
  "data": [
    {
      "product_name": "Weekly Diamond Pass",
      "category": "Top Up Games",
      "brand": "Mobile Legends",
      "code": "KPMLWDP",
      "type": "Special Items (Indonesia)",
      "price": 27223,
      "multi": true,
      "product_status": "on",
      "cut_off_start": "23:59",
      "cut_off_end": "00:00"
    }
  ]
}
Perhatian: Response pada JSON dibungkus dalam variabel data. Harap melakukan parsing dengan benar.

Penjelasan Response Fields

Field Type Deskripsi
product_name string Nama lengkap produk yang ditampilkan kepada pengguna
category string Kategori produk (contoh: Games, Pulsa, E-Wallet, PLN, dll)
brand string Brand atau nama penyedia produk (contoh: Mobile Legends, Free Fire, Telkomsel, dll)
code string Kode unik produk yang digunakan untuk melakukan transaksi. Kode ini harus disimpan untuk proses pembelian
type string Tipe layanan produk (contoh: Top Up Instant, Voucher, Direct Recharge)
price integer Harga produk dalam Rupiah (IDR) yang akan dipotong dari saldo deposit
multi boolean Apabila status multi pada produk true, maka produk tersebut bisa dibeli ulang untuk tujuan yang sama dalam satu hari. Jika false, maka transaksi akan ditolak apabila dalam satu hari sudah melakukan transaksi ke tujuan yang sama
product_status string Status ketersediaan produk. Nilai: on (tersedia), off (tidak tersedia)
cut_off_start string Waktu mulai layanan tidak tersedia (format HH:mm, contoh: "00:00"). Transaksi pada jam ini akan ditolak
cut_off_end string Waktu akhir layanan tidak tersedia (format HH:mm, contoh: "23:59"). Transaksi setelah jam ini akan diterima
Catatan: Jika cut_off_start menunjukkan 00:00 dan cut_off_end menunjukkan 00:00, berarti produk tersebut tersedia 24 jam.

Response Error

Jika terjadi error, API akan mengembalikan response dengan format berikut:

Error - Parameter Tidak Lengkap (400 Bad Request)
{
  "status": false,
  "message": "Gagal memproses permintaan Anda. Harap periksa parameter yang dibutuhkan"
}
Error - Signature Tidak Valid (401 Unauthorized)
{
  "status": false,
  "message": "Invalid signature"
}
Error - Rate Limit Exceeded (429 Too Many Requests)
{
  "status": false,
  "message": "Terlalu banyak request. Silakan tunggu beberapa saat"
}
Error - Produk Tidak Ditemukan (404 Not Found)
{
  "status": false,
  "message": "Produk dengan kode tersebut tidak ditemukan"
}

HTTP Status Code

Status Code Deskripsi
200 Request berhasil diproses dan data produk berhasil dikembalikan
400 Parameter yang dikirim tidak lengkap atau tidak valid
401 Signature tidak valid atau API Key tidak ditemukan
404 Produk dengan kode yang diminta tidak ditemukan
429 Rate limit terlampaui. Tunggu hingga periode limitasi selesai

Contoh Implementasi

Contoh Implementasi PHP - Semua Produk
<?php

$api_key = "your-api-key-here";
$cmd = "price-list";
$sign = md5($api_key . $cmd);

$data = [
    'cmd' => $cmd,
    'api_key' => $api_key,
    'sign' => $sign
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.kokinpay.com/v1/price-list");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);

$result = json_decode($response, true);

if($result['status']) {
    foreach($result['data'] as $product) {
        echo "Produk: " . $product['product_name'] . "\n";
        echo "Harga: Rp " . number_format($product['price'], 0, ',', '.') . "\n";
        echo "Status: " . $product['product_status'] . "\n\n";
    }
} else {
    echo "Error: " . $result['message'];
}
?>
Contoh Implementasi PHP - Produk Spesifik
<?php

$api_key = "your-api-key-here";
$cmd = "price-list";
$sign = md5($api_key . $cmd);

$data = [
    'cmd' => $cmd,
    'api_key' => $api_key,
    'sign' => $sign,
    'code' => 'ML100'  // Kode produk spesifik
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.kokinpay.com/v1/price-list");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);

$result = json_decode($response, true);

if($result['status']) {
    $product = $result['data'];
    echo "Produk: " . $product['product_name'] . "\n";
    echo "Brand: " . $product['brand'] . "\n";
    echo "Harga: Rp " . number_format($product['price'], 0, ',', '.') . "\n";
    echo "Status: " . $product['product_status'] . "\n";
} else {
    echo "Error: " . $result['message'];
}
?>
Contoh Implementasi JavaScript (Fetch API)
const crypto = require('crypto');

const api_key = "your-api-key-here";
const cmd = "price-list";
const sign = crypto.createHash('md5').update(api_key + cmd).digest('hex');

const data = {
  cmd: cmd,
  api_key: api_key,
  sign: sign,
  code: "ML100"  // Optional: hapus jika ingin semua produk
};

fetch('https://api.kokinpay.com/v1/price-list', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(data)
})
.then(response => response.json())
.then(result => {
  if(result.status) {
    if(Array.isArray(result.data)) {
      // Response semua produk
      result.data.forEach(product => {
        console.log(`Produk: ${product.product_name}`);
        console.log(`Harga: Rp ${product.price.toLocaleString('id-ID')}`);
        console.log(`Status: ${product.product_status}\n`);
      });
    } else {
      // Response produk spesifik
      const product = result.data;
      console.log(`Produk: ${product.product_name}`);
      console.log(`Harga: Rp ${product.price.toLocaleString('id-ID')}`);
      console.log(`Status: ${product.product_status}`);
    }
  } else {
    console.log('Error:', result.message);
  }
})
.catch(error => console.error('Error:', error));
Tips:
  • Simpan hasil response di cache atau database lokal untuk mengurangi jumlah request
  • Perhatikan waktu cut_off_start dan cut_off_end sebelum melakukan transaksi
  • Cek product_status untuk memastikan produk tersedia sebelum melakukan transaksi
  • Gunakan parameter code untuk update harga real-time produk spesifik tanpa terkena rate limit ketat