Gunakan API di bawah ini jika Anda ingin mengintegrasikan pembayaran otomatis ke website atau bot Anda sendiri.
POST
Create Payment
https://paydigital.biz.id/api/create_payment.php
Form Data (POST)
| Parameter |
Tipe |
Keterangan |
| api_key | String | Wajib |
| store_id | Int | Wajib (ID Toko Anda) |
| amount | Int | Minimal 1000 |
| description | String | Opsional (Deskripsi pembayaran) |
| customer_name | String | Opsional (Nama pelanggan) |
Contoh Response Berhasil (JSON)
{
"status": "success",
"data": {
"invoice": "PYG20231201123456",
"amount": 10000,
"unique_code": 387,
"total_amount": 10387,
"qr_content": "000201010212266....DBD7",
"qr_url": "https://api.qrserver.com/v1/create-qr-code/?size=300x300&data=...",
"payment_url": "http://paydigital.biz.id/pay.php?invoice=PYG20231201123456",
"expired_at": "2023-12-01 15:00:00"
}
}
Contoh Request (cURL)
curl -X POST http://paydigital.biz.id/api/create_payment.php \
-H "Authorization: Bearer PYG1234567890abcdef" \
-d "store_id=1" \
-d "amount=10000" \
-d "description=Pembelian Produk A" \
-d "customer_name=John Doe"
Contoh Request (PHP cURL)
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://paydigital.biz.id/api/create_payment.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([
'store_id' => 1,
'amount' => 10000,
'description' => 'Pembelian Produk A',
'customer_name' => 'John Doe'
]));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer PYG1234567890abcdef"
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
Contoh Request (Node.js Fetch)
fetch("http://paydigital.biz.id/api/create_payment.php", {
method: "POST",
headers: {
"Authorization": "Bearer PYG1234567890abcdef",
"Content-Type": "application/x-www-form-urlencoded"
},
body: new URLSearchParams({
"store_id": "1",
"amount": "10000",
"description": "Pembelian Produk A",
"customer_name": "John Doe"
})
})
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
GET/POST
Cek Status Pembayaran
http://paydigital.biz.id/api/payment.php?invoice={invoice}
Parameter Request
| Parameter |
Tipe |
Keterangan |
| api_key | String | Wajib |
| invoice | String | Wajib (Nomor invoice transaksi) |
Contoh Response Berhasil (JSON)
{
"status": "success",
"data": {
"invoice": "PYG20231201123456",
"amount": 10000,
"unique_code": 387,
"total_amount": 10387,
"status": "paid",
"paid_at": "2023-12-01 14:30:00",
"customer_name": "John Doe",
"store_name": "Toko Example"
}
}
Contoh Request (cURL)
curl -X GET "http://paydigital.biz.id/api/payment.php?invoice=PYG20231201123456" \
-H "Authorization: Bearer PYG1234567890abcdef"
Contoh Request (PHP cURL)
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://paydigital.biz.id/api/payment.php?invoice=PYG20231201123456");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer PYG1234567890abcdef"
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
Contoh Request (Node.js Fetch)
fetch("http://paydigital.biz.id/api/payment.php?invoice=PYG20231201123456", {
method: "GET",
headers: {
"Authorization": "Bearer PYG1234567890abcdef"
}
})
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));