Pengenalan API Kropay
Kropay menyediakan API RESTful terpadu untuk memudahkan para merchant mengintegrasikan pembayaran QRIS Dinamis ke website, e-commerce, atau aplikasi kasir secara instan.
1. Lakukan pendaftaran akun merchant di Kropay.
2. Masuk ke dashboard dan buka tab Pengaturan.
3. Dapatkan API Key / Client ID Anda.
4. Gunakan API Key tersebut di header setiap HTTP request.
Base URL
https://kropay.krispediadigital.my.id
Kredensial API Anda
Gunakan kunci di bawah ini untuk otentikasi. Jaga kerahasiaannya.
API Key / Client IDPembuatan QRIS
Endpoint ini digunakan untuk membuat transaksi pembayaran QRIS baru berdasarkan parameter nominal yang dikirimkan.
https://kropay.krispediadigital.my.id/api/v1/payment/create
HTTP Headers
Parameter Request (JSON)
| Field | Tipe | Wajib | Keterangan |
|---|---|---|---|
| merchant_ref | String | Ya | ID unik transaksi dari sistem Anda (Maks. 100 karakter). |
| amount | Integer | Ya | Nominal pembayaran (Minimal Rp 10). |
| customer_name | String | Tidak | Nama pembeli/pelanggan. |
| customer_email | String | Tidak | Email pelanggan. |
| expired_in | Integer | Tidak | Kedaluwarsa QRIS dalam hitungan detik (Min: 300, default: 3600). |
Response JSON (Success 201)
{
"success": true,
"reference": "PG-20260529A1B2",
"merchant_ref": "ORDER-12345",
"amount": 10000,
"fee": 20,
"unique_code": 20,
"total_amount": 10020,
"status": "pending",
"expired_at": "2026-05-30 15:30:00",
"qris_string": "00020101021226580011ID.CO.QREN.WWW0118...",
"qris_image": "https://kropay.krispediadigital.my.id/api/v1/qris/PG-20260529A1B2.svg"
}
Code Example
<?php $apiKey = "YOUR_API_KEY"; $url = "https://kropay.krispediadigital.my.id/api/v1/payment/create"; $payload = [ 'merchant_ref' => 'ORDER-' . time(), 'amount' => 10000, 'customer_name' => 'Krisdi' ]; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload)); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'X-API-KEY: ' . $apiKey, 'Content-Type: application/json' ]); $response = curl_exec($ch); curl_close($ch); $result = json_decode($response, true); print_r($result);
Cek Status Transaksi
Gunakan API ini untuk melakukan pengecekan status transaksi pembayaran QRIS secara manual / real-time dari server Anda.
https://kropay.krispediadigital.my.id/api/v1/payment/status/{reference}
HTTP Headers
Parameter URL
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
| {reference} | String | Ya | Nomor referensi unik transaksi Kropay (contoh: PG-20260529A1B2). |
Response JSON (Success 200 OK)
{
"success": true,
"reference": "PG-20260529A1B2",
"merchant_ref": "ORDER-12345",
"amount": 10000,
"fee": 20, // Potongan biaya MDR 0.2%
"total_amount": 10020,
"net_amount": 10000, // Dana bersih yang diterima merchant
"status": "success", // pending, success, failed, expired
"created_at": "2026-05-29 15:00:00",
"paid_at": "2026-05-29 15:30:00"
}
Code Example
<?php $apiKey = "YOUR_API_KEY"; $reference = "PG-20260529A1B2"; $url = "https://kropay.krispediadigital.my.id/api/v1/payment/status/" . $reference; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'X-API-KEY: ' . $apiKey, 'Content-Type: application/json' ]); $response = curl_exec($ch); curl_close($ch); $result = json_decode($response, true); print_r($result);
Cek Profile
Gunakan API ini untuk mendapatkan informasi dasar profile Anda seperti nama dan sisa saldo (balance) saat ini.
https://kropay.krispediadigital.my.id/api/v1/profile
HTTP Headers
Response JSON (Success 200 OK)
{
"success": true,
"nama": "Nama Anda",
"balance": 150000
}
Code Example
<?php $apiKey = "YOUR_API_KEY"; $url = "https://kropay.krispediadigital.my.id/api/v1/profile"; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'X-API-KEY: ' . $apiKey, 'Content-Type: application/json' ]); $response = curl_exec($ch); curl_close($ch); $result = json_decode($response, true); print_r($result);
Callback / Webhook
Ketika transaksi QRIS berhasil dibayar oleh pelanggan, server Kropay akan mengirimkan callback request POST otomatis ke URL yang telah Anda atur di dashboard.
Payload Callback (HTTP POST - JSON)
{
"reference": "PG-20260529A1B2",
"merchant_ref": "ORDER-12345",
"amount": 10000,
"fee": 20, // Potongan fee MDR 0.2%
"unique_code": 20,
"total_amount": 10020,
"status": "paid",
"expired_at": "2026-05-30 15:30:00",
"paid_at": "2026-05-29 15:30:00"
}
Verifikasi Keamanan (X-Signature Header)
Setiap callback dari Kropay menyertakan header X-Signature. Gunakan Secret Key Anda untuk memverifikasi bahwa request benar-benar berasal dari server Kropay dan bukan dari pihak ketiga yang mencoba memanipulasi data.
X-Signature sebelum memproses callback. Tolak request jika signature tidak cocok. Secret Key Anda ada di panel Kredensial API.
Server merchant harus membalas dengan status HTTP 200 OK dan body JSON
{"success": true}. Jika server merchant memberikan respon selain itu (atau timeout), server Kropay akan melakukan percobaan callback ulang secara berkala.
Handler Example
<?php // Secret Key dari Dashboard Anda $secretKey = "YOUR_SECRET_KEY"; // Baca raw payload dari Kropay $rawInput = file_get_contents('php://input'); $payload = json_decode($rawInput, true); // Ambil signature dari header request $receivedSig = $_SERVER['HTTP_X_SIGNATURE'] ?? ''; // Hitung ulang signature dengan secret key Anda $expectedSig = hash_hmac('sha256', $rawInput, $secretKey); // ✅ Verifikasi: Tolak jika signature tidak cocok if (!hash_equals($expectedSig, $receivedSig)) { http_response_code(403); echo json_encode(['success' => false, 'message' => 'Invalid signature']); exit; } // ✅ Proses pembayaran $status = $payload['status']; $merchantRef = $payload['merchant_ref']; if ($status === 'paid') { // TODO: Update status order di DB Anda } header('Content-Type: application/json'); echo json_encode(['success' => true]); exit;