| Session ID | Requested | Payable | Customer | Source | Status | Created | Actions |
|---|---|---|---|---|---|---|---|
No sessions yet | |||||||
| ID | Label | Key | Permissions | Webhook | Requests | Revenue | Status | Actions |
|---|---|---|---|---|---|---|---|---|
No API keys yet | ||||||||
http://localhost:3000
Include your API key in every request header:
X-API-Key: pgk_your_api_key_here
POST /api/v1/create-payment
Content-Type: application/json
X-API-Key: pgk_your_api_key
{
"amount": 100,
"customer_name": "John Doe",
"customer_email": "john@example.com",
"merchant_ref": "ORDER-123",
"metadata": {
"order_id": "ORD-456",
"product": "Premium Plan"
}
}
Response:
{
"success": true,
"payment": {
"session_id": "A1B2C3D4E5F67890",
"requested_amount": 100,
"payable_amount": 99.00,
"status": "pending",
"checkout_url": "http://localhost:3000/checkout/A1B2C3D4E5F67890",
"upi_id": "yourupi@bank",
"upi_deeplink": "upi://pay?...",
"expires_at": "2026-04-14 01:10:00"
}
}
GET /api/v1/payment/{session_id}
X-API-Key: pgk_your_api_key
GET /api/v1/payments?status=success&limit=50 X-API-Key: pgk_your_api_key
POST /api/v1/cancel/{session_id}
X-API-Key: pgk_your_api_key
When a payment succeeds or expires, PayGate sends a POST to your webhook URL:
POST https://yoursite.com/webhook
Content-Type: application/json
X-Webhook-Signature: hmac_sha256_hex_signature
X-Webhook-Event: payment.success
{
"event": "payment.success",
"session_id": "A1B2C3D4E5F67890",
"requested_amount": 100,
"payable_amount": 99.00,
"status": "success",
"customer_name": "John Doe",
"merchant_ref": "ORDER-123",
"utr": "103100084802",
"metadata": { "order_id": "ORD-456" },
"timestamp": "2026-04-14T01:05:00.000Z"
}
// Node.js example
const crypto = require('crypto');
function verifyWebhook(body, signature, secret) {
const expected = crypto
.createHmac('sha256', secret)
.update(body)
.digest('hex');
return signature === expected;
}
// In your Express route:
app.post('/webhook', (req, res) => {
const sig = req.headers['x-webhook-signature'];
const valid = verifyWebhook(
JSON.stringify(req.body), sig, 'your_webhook_secret'
);
if (!valid) return res.status(401).send('Invalid signature');
const { event, session_id, status } = req.body;
// Process the payment event...
res.json({ received: true });
});
<script>
async function createPayment() {
const res = await fetch('http://localhost:3000/api/v1/create-payment', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': 'pgk_your_api_key'
},
body: JSON.stringify({
amount: 100,
customer_name: 'Customer',
merchant_ref: 'ORD-001'
})
});
const data = await res.json();
// Redirect to checkout page
window.location.href = data.payment.checkout_url;
// Or open UPI app directly on mobile
// window.location.href = data.payment.upi_deeplink;
}
</script>