📖 Overview
The PromptPay QR Generator API creates EMV-compliant QR codes for Thailand's PromptPay payment system. Generate QR codes for mobile numbers, tax IDs, or e-Wallet IDs with optional payment amounts.
📱 Multiple ID Types
Support for mobile numbers, tax IDs, and e-Wallet IDs
💰 Optional Amounts
Generate QR codes with or without predefined payment amounts
🔧 EMV Compliant
Follows EMV QR Code specification for payment systems
🖼️ Multiple Formats
Base64 image output and raw QR code data
🌐 Base URL
🔐 Authentication
No authentication required. This is a public API that can be accessed without any API keys or tokens.
📡 API Endpoints
POST / Generate PromptPay QR Code
Generate a PromptPay QR code for the specified recipient and optional amount.
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
target |
string | Required | PromptPay target (phone number, tax ID, or e-wallet ID) |
amount |
number | Optional | Payment amount in Thai Baht (THB) |
size |
integer | Optional | QR code size in pixels (50-1000, default: 300) |
format |
string | Optional | Output format: "image", "json", "base64" (default: "image") | format |
string | Optional | Output format: "base64" or "data" (default: "base64") |
ID Format Guidelines
ID Type | Format | Example |
---|---|---|
Mobile Number | +66XXXXXXXXX or 0XXXXXXXXX | +66812345678 or 0812345678 |
Tax ID | 13-digit number | 1234567890123 |
e-Wallet ID | 15-digit number | 123456789012345 |
Example Request - Mobile Number with Amount
Example Request - Tax ID without Amount
Example Request - e-Wallet ID with Large Amount
📊 Response Format
Success Response (Base64 Format)
Success Response (Data Format)
Error Response
🔧 EMV QR Code Structure
The generated QR codes follow the EMV® QR Code Specification for Payment Systems. The data format includes:
Field | Description | Example Value |
---|---|---|
Payload Format Indicator | Version of the QR code format | 01 |
Point of Initiation Method | Static or dynamic QR code | 11 (Static), 12 (Dynamic) |
Merchant Account Information | PromptPay identification data | Contains PromptPay ID |
Transaction Amount | Payment amount (if specified) | 100.50 |
Transaction Currency | ISO 4217 currency code | 764 (THB) |
Country Code | ISO 3166-1 country code | TH |
CRC | Checksum for data integrity | 4-digit checksum |
📋 Usage Guidelines
Best Practices
- ID Validation: Ensure mobile numbers and tax IDs are valid Thai formats
- Amount Precision: Use up to 2 decimal places for amounts
- QR Code Size: Use appropriate sizes for display medium (300px for web, 500px+ for print)
- Error Handling: Always check the response for errors before displaying QR codes
- Testing: Test QR codes with actual PromptPay apps before production use
Mobile Number Formats
- Thai mobile numbers start with 06, 08, or 09
- Can include +66 country code or start with 0
- Total length: 10 digits (with 0) or 11 digits (with +66)
⚠️ Error Codes
Code | Description |
---|---|
INVALID_ID |
PromptPay ID format is invalid |
INVALID_AMOUNT |
Amount is negative or exceeds maximum limit |
INVALID_SIZE |
QR code size is outside valid range (50-1000px) |
QR_GENERATION_ERROR |
Error occurred during QR code generation |
MISSING_PARAMETER |
Required parameter is missing |
🔗 Integration Examples
HTML Image Display
JavaScript Integration
🚦 Rate Limits
Currently, there are no rate limits imposed on this API. However, please use it responsibly and avoid excessive requests that might impact service availability for other users.
🎯 Ready to Try?
Test the PromptPay QR Generator API with our interactive web interface or start integrating it into your application.
Try Web Interface Test API Endpoint