Get Invoice QR Code
Get Invoice QR Code API
Retrieve the QR code associated with a specific invoice, including encrypted invoice data and base64-encoded QR code image.
Quick Reference
| Method | Endpoint | Response Format |
|---|---|---|
| GET | https://api-dev.nairainvoice.com/dev/external/businesses/:businessId/invoices/:invoiceIrn/qr |
JSON with base64 QR code |
Request Structure
Path Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
businessId |
string | ✅ | Unique identifier of the business | 26ede24b-ac50-475f-aacc-5ea6339f0863 |
invoiceIrn |
string | ✅ | Invoice Reference Number | INV237-1070ECE8-20250826 |
📤 Response Format
Success Response (200)
Response Fields
| Field | Type | Description |
|---|---|---|
data |
object | Container for QR code data |
data.encryptedDataBase64 |
string | Base64 encoded encrypted invoice data |
data.irn |
string | Invoice Reference Number |
data.qrCodeBase64 |
string | Base64 encoded QR code image (PNG format) |
data.timestamp |
number | Unix timestamp of response generation |
responseCode |
string | Status code of the operation |
responseMessage |
string | Human-readable response message |
📝 Example Usage
Get QR Code for Invoice
🖼️ Working with QR Code Data
Displaying the QR Code Image
The qrCodeBase64 field contains a PNG image encoded in base64. Here’s how to use it:
HTML Display
JavaScript Usage
Saving to File (Node.js)
Decrypting Invoice Data
The encryptedDataBase64 contains encrypted invoice information that can be decrypted using appropriate keys:
✅ Validation Rules
Path Parameter Validation
businessIdmust be a valid UUID formatinvoiceIrnmust exist and belong to the specified business
Business Logic Validation
- Invoice must be in a valid state to generate QR code
- Business must have QR code generation enabled
- Invoice must not be cancelled or deleted
⚠️ Error Responses
Common Error Codes
Error Codes
| Error Code | Message | Description | Solution |
|---|---|---|---|
| 404 | Invoice not found | Invoice IRN doesn’t exist for the business | Verify invoice IRN and business ID |
| 403 | QR code generation disabled | Business doesn’t have QR code feature enabled | Contact support to enable QR code feature |
| 422 | Invoice not eligible | Invoice state doesn’t allow QR code generation | Ensure invoice is finalized and not cancelled |
Example Error Response
🔐 Security Considerations
Data Encryption
- Encrypted data: The
encryptedDataBase64contains sensitive invoice information - Secure transmission: Always use HTTPS for QR code requests
- Access control: Verify business ownership before generating QR codes
QR Code Security
- Limited data: QR code contains minimal information to reduce exposure
- Tamper detection: Generated QR codes include checksums for validation
- Expiration: QR codes may have built-in expiration mechanisms
💡 Use Cases
Common Implementation Scenarios
1. Invoice Display
2. Mobile App Integration
3. Print Materials
4. Payment Gateway Integration
📊 Response Time & Caching
Performance Considerations
- Response time: Typically 200-500ms for QR code generation
- Caching: QR codes are generated on-demand and not cached
- Rate limiting: Standard API rate limits apply
Optimization Tips
- Cache client-side: Store QR codes locally to reduce API calls
- Batch requests: Consider batching if multiple QR codes needed
- Image optimization: Compress base64 images for storage
🔗 Related Endpoints
Invoice Management
- GET
/invoices/– Get invoice details - POST
/invoices– Create new invoice - POST
/invoices/update-payment/– Update payment status
QR Code & Digital Features
- GET
/invoices//pdf– Get invoice PDF - POST
/invoices//send– Send invoice via email - GET
/businesses//qr-settings– QR code configuration
🔧 Integration Examples
React Component Example
This endpoint enables seamless QR code generation for invoices, facilitating modern payment workflows and enhancing customer payment experience.
Request
Path Params
| Parameter | Type | Required | Example |
|---|---|---|---|
| stage | string | ✅ | |
| businessId | string | ✅ |
Header Params
| Header | Type | Required | Description | Example |
|---|---|---|---|---|
| X-Business-Key | string | ✅ | (Required) X-Business-Key | BK-26EDE24BAC50475FAACC5EA6339F0863-DEV-B2Z6QCEHI3X9 |
| Accept | string | ✅ | Accept header type | */* |










