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.
Langkah Cepat Memulai:
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.
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.
POST
https://kropay.krispediadigital.my.id/api/v1/payment/create
HTTP Headers
X-API-KEY: YOUR_API_KEY
Content-Type: application/json
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 1.000). |
| 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.
GET
https://kropay.krispediadigital.my.id/api/v1/payment/status/{reference}
HTTP Headers
X-API-KEY: YOUR_API_KEY
Content-Type: application/json
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);
Callback / Webhook
Ketika transaksi QRIS berhasil dibayar oleh pelanggan, server Kropay akan mengirimkan callback request POST otomatis ke URL yang telah Anda atur.
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"
}
Respon yang Diharapkan:
Server merchant harus membalas dengan status HTTP 200 OK dan body JSON
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 // Menerima data callback dari Kropay $rawInput = file_get_contents('php://input'); $payload = json_decode($rawInput, true); if ($payload) { $reference = $payload['reference']; $merchantRef = $payload['merchant_ref']; $status = $payload['status']; if ($status === 'paid') { // TODO: Update status order menjadi lunas di DB Anda } // Berikan respon sukses header('Content-Type: application/json'); echo json_encode(['success' => true]); exit; }