curl https://www.bayar.gg/api/create-payment.php \
-H "X-API-Key: pk_live_xxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"amount": 150000,
"payment_method": "qris_bayar_gg",
"description": "Order 1042",
"callback_url": "https://toko.example.com/webhook"
}'
const res = await fetch("https://www.bayar.gg/api/create-payment.php", {
method: "POST",
headers: {
"X-API-Key": process.env.BAYARGG_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
amount: 150000,
payment_method: "qris_bayar_gg",
description: "Order 1042",
}),
});
const { data } = await res.json();
console.log(data.payment_url);
$ch = curl_init('https://www.bayar.gg/api/create-payment.php');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'X-API-Key: ' . getenv('BAYARGG_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'amount' => 150000,
'payment_method' => 'qris_bayar_gg',
'description' => 'Order 1042',
]),
]);
$payment = json_decode(curl_exec($ch), true);