PayQube

PayQube API

A simple REST API to accept UPI, card and net-banking payments. All requests use JSON over HTTPS. Base URL: /api/v1 on your PayQube domain.

Flow: your server creates a payment → redirect the customer to payment_url → customer pays → we redirect back to your return_url and send a signed webhook to your server. Always trust the webhook (or a server-side fetch), never the browser redirect alone.

Prefer ready-made code? Download the Node.js & PHP SDKs, Postman collection and WooCommerce plugin →

Authentication

Generate a key pair under Dashboard → API keys. Send it with HTTP Basic auth: Key ID as username, Secret as password. Secrets are shown once — keep them on your server only.

curl /api/v1/payments -u pq_test_xxxxxxxx:sk_test_xxxxxxxxxxxxxxxx

Rate limit: 120 requests per minute per IP. Exceeding it returns 429.

POST/v1/payments

Creates a payment and returns a hosted checkout URL.

FieldTypeDescription
amountnumberRequired. INR, ₹1 – ₹5,00,000, up to 2 decimals.
order_idstringYour reference (max 60). Duplicate live order IDs are rejected.
customer.namestringRequired.
customer.emailstringRequired. Receipt is sent here.
customer.phonestringRequired. 10-digit Indian mobile.
descriptionstringShown on checkout (max 100).
return_urlhttps URLWhere the customer lands after paying.
curl -X POST /api/v1/payments \
  -u KEY_ID:SECRET -H "Content-Type: application/json" \
  -d '{"amount": 499, "order_id": "ORD-1001", "description": "Blue T-shirt",
       "customer": {"name": "Rohan Mehta", "email": "rohan@example.com", "phone": "9876543210"},
       "return_url": "https://yourstore.in/thank-you"}'

// 201 Created
{ "id": "PQ9F2C…", "order_id": "ORD-1001", "amount": 499, "currency": "INR",
  "status": "initiated", "payment_url": "https://…/pay/…", "created_at": "2026-11-18T10:21:04.000Z" }

GET/v1/payments/:id

Returns the latest status. Statuses: initiated, pending, success, failed, partially_refunded, refunded.

{ "id": "PQ9F2C…", "status": "success", "amount": 499, "fee": 9.98, "net": 489.02,
  "payment_mode": "UPI", "gateway_reference": "E2600013", "refunded_amount": 0, … }

GET/v1/payments?limit=20 lists your latest payments.

POST/v1/payments/:id/refunds

Full or partial refund of a successful payment. Body: { "amount": 199 }. Multiple partial refunds are allowed up to the paid amount.

{ "refund_id": "RF4A1B…", "payment": { "id": "PQ9F2C…", "status": "partially_refunded", "refunded_amount": 199, … } }

Webhooks

Set your endpoint in Dashboard → Webhooks. We send POST with JSON body and headers X-PayQube-Event and X-PayQube-Signature = HMAC-SHA256 of the raw body using your signing secret. Respond 2xx within 8 seconds.

Events: payment.success, payment.failed, refund.processed, ping.

// Node.js / Express — verify before trusting
const crypto = require('crypto');
app.post('/payqube/webhook', express.raw({ type: 'application/json' }), (req, res) => {
  const expected = crypto.createHmac('sha256', process.env.PAYQUBE_WEBHOOK_SECRET)
    .update(req.body).digest('hex');
  const given = req.get('X-PayQube-Signature') || '';
  if (given.length !== expected.length ||
      !crypto.timingSafeEqual(Buffer.from(given), Buffer.from(expected))) return res.sendStatus(400);
  const event = JSON.parse(req.body);
  if (event.event === 'payment.success') markOrderPaid(event.data.order_id, event.data.id);
  res.sendStatus(200);
});
<?php // PHP
$body = file_get_contents('php://input');
$sig  = hash_hmac('sha256', $body, getenv('PAYQUBE_WEBHOOK_SECRET'));
if (!hash_equals($sig, $_SERVER['HTTP_X_PAYQUBE_SIGNATURE'] ?? '')) { http_response_code(400); exit; }
$event = json_decode($body, true);

Errors

{ "error": { "code": "request_invalid", "message": "Enter a valid 10-digit mobile number." } }
400Validation failed — see message
401Invalid key ID or secret
403Merchant account inactive or suspended
404Payment not found (or belongs to another merchant)
409Duplicate order_id
429Rate limit exceeded
502Gateway rejected or unreachable — safe to retry

Testing

Test-mode keys (pq_test_…) run on the gateway sandbox. No real money moves. Use the sandbox test cards provided in your gateway test kit.