Generate QR Code API
This API generates a static QR code for merchant payments. (Dynamic QR is under construction.)
Endpoint
POST /payments/generateqr
Headers
| Header | Value | Required | Description |
|---|---|---|---|
| Authorization | Basic | Yes | Base64-encoded merchant API key |
| Content-Type | application/json | Yes |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| processorCode | string | Yes | Example: QRPH-RBG |
| initMethod | string | Yes | Use "static" |
| currency | string | Yes | Example: "PHP" |
| amount | number | Yes | Amount to encode in QR |
| merchantReferenceNumber | string | Yes | Unique ID (e.g. UUID) |
Example:
json
{
"processorCode": "QRPH-RBG",
"initMethod": "static",
"currency": "PHP",
"amount": 2,
"merchantReferenceNumber": "<uuid>"
}Response
| Field | Type | Description |
|---|---|---|
| rawQrString | string | The QR string output |
Example:
json
{
"rawQrString": "000201010211...5303704..."
}Sample Node.js Code
js
const fetch = require('node-fetch');
const crypto = require('crypto');
const token = Buffer.from('<your_api_key>:').toString('base64');
async function generateStaticQR() {
const response = await fetch('<api_base_url>/payments/generateqr', {
method: 'POST',
headers: {
Authorization: `Basic ${token}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
processorCode: 'QRPH-RBG',
initMethod: 'static',
currency: 'PHP',
amount: 2,
merchantReferenceNumber: crypto.randomUUID(),
}),
});
const data = await response.json();
console.log('QR String:', data.rawQrString);
}
generateStaticQR();Note
⏳ Dynamic QR support is coming soon.