Active Sessions
0
Completed
0
Expired
0
Total Revenue
₹0

Create Payment Session

Payment Sessions

Session ID Requested Payable Customer Source Status Created Actions
📋
No sessions yet

Create API Key

API Keys

ID Label Key Permissions Webhook Requests Revenue Status Actions
🔑
No API keys yet

Gateway Settings

Google Account -> Security -> 2-Step Verification -> App Passwords

Integration Guide

🔗 Base URL

http://localhost:3000

🔑 Authentication

Include your API key in every request header:

X-API-Key: pgk_your_api_key_here

📤 Create Payment

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"
  }
}

📥 Check Payment Status

GET /api/v1/payment/{session_id}
X-API-Key: pgk_your_api_key

📋 List Payments

GET /api/v1/payments?status=success&limit=50
X-API-Key: pgk_your_api_key

❌ Cancel Payment

POST /api/v1/cancel/{session_id}
X-API-Key: pgk_your_api_key

🔔 Webhooks

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"
}

🔒 Verify Webhook Signature

// 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 });
});

⚡ Quick Integration (HTML + JS)

<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>