BucksBox Developer DocsBucksBox Developer Docs
Getting Started
Merchant API
Partner API
SDK
GitHub
Getting Started
Merchant API
Partner API
SDK
GitHub
  • Quick Start
  • Configuration
  • Auth
  • DMT
  • AEPS
  • QR
  • Vendor
  • Commission
  • Crypto Utilities

SDK — QR Module

client.qr.* — UPI QR code generation and payment status polling.

generateQr(body)

const res = await client.qr.generateQr({
  amount:     250,
  merchantId: 'M-uuid',
  orderId:    'ORD-001',      // your internal order ID
  remarks:    'Table 4',
});

// res.data.qrString  → "upi://pay?pa=merchant@bucksbox&am=250..."
// res.data.qrImage   → base64 PNG (display to customer)
// res.data.expiresAt → ISO timestamp (QR valid for ~5 min)

checkQrStatus(body)

const status = await client.qr.checkQrStatus({ orderId: 'ORD-001' });
// status.data.paymentStatus: "PENDING" | "SUCCESS" | "FAILED" | "EXPIRED"
// status.data.utr            → bank UTR on success
// status.data.payerVpa       → customer UPI ID on success

Polling Pattern

async function waitForPayment(orderId, timeoutMs = 300_000) {
  const deadline = Date.now() + timeoutMs;
  while (Date.now() < deadline) {
    const res = await client.qr.checkQrStatus({ orderId });
    if (res.data.paymentStatus !== 'PENDING') return res;
    await new Promise(r => setTimeout(r, 4000));
  }
  throw new Error('QR payment timed out');
}

const payment = await waitForPayment('ORD-001');
if (payment.data.paymentStatus === 'SUCCESS') {
  console.log('Paid! UTR:', payment.data.utr);
}
Prev
AEPS
Next
Vendor