QR API
Create Dynamic QR Ph
Generate a Dynamic QR Ph code for Consumer Scans Business transactions
POST
How it works: Generate a unique QR code → Customer scans with banking app → Payment completed → Webhook notification sent
Authentication
This endpoint requires HTTP Basic Authentication using your Secret Key.Encrypted Payload Structure
TheToken field must contain a JWE-encrypted JSON payload with the following fields:
| Field | Type | Required | Description |
|---|---|---|---|
activationCode | string | Yes | Activation Code from Modulus Labs. Format: XXXX-XXXX-XXXX-XXXX |
currency | string | Yes | ISO 4217 currency code (3 chars). Currently only PHP supported |
amount | string | Yes | Payment amount with 2 decimals. Range: 1.00 to 99999.99 |
merchantReferenceNumber | string | Yes | Your unique reference (1-36 chars, alphanumeric and hyphens) |
activationCode
activationCode
Activation Code assigned to your sub-merchant account by Modulus Labs.
- Format:
XXXX-XXXX-XXXX-XXXX(19 characters including hyphens) - Example:
A9X4-B7P2-Q6Z8-M3L5
currency
currency
ISO 4217 currency code.
- Length: Exactly 3 characters
- Supported:
PHP - Example:
PHP
amount
amount
Payment amount in decimal format.
- Min:
1.00(₱1.00) - Max:
99999.99(₱99,999.99) - Format: String with exactly 2 decimal places
- Example:
"500.00","1234.56"
merchantReferenceNumber
merchantReferenceNumber
Your unique reference number for this transaction.
- Min Length: 1 character
- Max Length: 36 characters
- Allowed: Alphanumeric characters and hyphens
- Example:
"ORDER-12345","5e91bc6c-f7e2-4a39-ae0e-5e93985c94a4"
Example Payload (Before Encryption)
Decrypted Response
When you decrypt the responseToken, you’ll get:
| Field | Type | Description |
|---|---|---|
id | string | Unique transaction identifier generated by Modulus Labs |
qrBody | string | Base64-encoded PNG image of the QR code |
Using the QR Code
After receiving theqrBody, you need to convert it to an image that customers can scan:
Display in Web Application
Save as File
Best Practices
Use UUIDs
Use UUIDs for
merchantReferenceNumber to ensure uniquenessValidate Amount
Validate amount format and range before sending to API
Handle Errors
Implement proper error handling for all possible scenarios
Store Transaction ID
Save the returned
id for reconciliation and supportCommon Issues
JWE Token Decryption Fails
JWE Token Decryption Fails
Symptoms:
- Cannot decrypt response token
- “Invalid token” errors
- Verify you’re using the correct Encryption Key
- Check encryption algorithms match (A256KW, A256CBC-HS512)
- Ensure no whitespace in keys
Amount Validation Error
Amount Validation Error
Symptoms:
- API returns “Invalid amount” error
- Request rejected with 400 status
- Ensure amount is a string, not a number:
"500.00"not500 - Always include 2 decimal places:
"5.00"not"5" - Stay within min/max range (1.00 to 99999.99)
QR Code Won't Display
QR Code Won't Display
Symptoms:
- Base64 decode fails
- Invalid image format
- Ensure full Base64 string was received (not truncated)
- Check for proper Base64 padding
- Verify you’re decoding as PNG format
Next Steps
Testing Guide
Learn how to test QR code generation and payment simulation
Webhooks
Set up webhooks to receive payment notifications
Error Handling
Handle errors gracefully in your application
Go Live
Deploy your integration to production
Authorizations
HTTP Basic Authentication using your Secret Key as the username and an empty password
Body
application/json
JWE-encrypted token containing the payment payload. Algorithm: A256KW | Encryption: A256CBC-HS512. See the Encryption Guide for how to create this token.
Response
QR code generated successfully. Response contains an encrypted JWE token.
JWE-encrypted response token. When decrypted, contains the transaction ID and QR code image.