💳 PromptPay QR Generator API

Generate EMV-compliant PromptPay QR codes for Thai payment system

📖 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

About PromptPay: PromptPay is Thailand's national e-payment system that allows real-time money transfers using mobile numbers or tax identification numbers.

🌐 Base URL

https://api.lorwongam.com/api/promptpay-qr-generator/

🔐 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

curl -X POST "https://api.lorwongam.com/api/promptpay-qr-generator/" \ -H "Content-Type: application/json" \ -d '{ "target": "0812345678", "amount": 100.50, "size": 300, "format": "json" }'

Example Request - Tax ID without Amount

curl -X POST "https://api.lorwongam.com/api/promptpay-qr-generator/" \ -H "Content-Type: application/json" \ -d '{ "target": "1234567890123", "size": 400, "format": "json" }'

Example Request - e-Wallet ID with Large Amount

curl -X POST "https://api.lorwongam.com/api/promptpay-qr-generator/" \ -H "Content-Type: application/json" \ -d '{ "target": "123456789012345", "amount": 2500, "size": 500, "format": "base64" }'

📊 Response Format

Success Response (Base64 Format)

{ "success": true, "data": { "qr_code": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...", "promptpay_id": "0812345678", "amount": 100.50, "currency": "THB", "emv_qr_data": "00020101021129370016A000000677010111011300...", "size": 300, "format": "base64" }, "message": "PromptPay QR code generated successfully", "timestamp": "2025-09-09T12:00:00Z" }

Success Response (Data Format)

{ "success": true, "data": { "emv_qr_data": "00020101021129370016A00000067701011101130081234567803021.02540TH63041234", "promptpay_id": "0812345678", "amount": null, "currency": "THB", "size": 300, "format": "data" }, "message": "PromptPay QR data generated successfully", "timestamp": "2025-09-09T12:00:00Z" }

Error Response

{ "success": false, "error": "Invalid PromptPay ID format", "code": "INVALID_ID", "timestamp": "2025-09-09T12:00:00Z" }

🔧 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

Important: Always validate PromptPay IDs before generating QR codes. Invalid IDs may result in failed payments.

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

<img src="data:image/png;base64,{base64_data}" alt="PromptPay QR Code" />

JavaScript Integration

fetch('https://api.lorwongam.com/api/promptpay-qr-generator/', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ id: '0812345678', amount: 100.50 }) }) .then(response => response.json()) .then(data => { if (data.success) { document.getElementById('qr-image').src = data.data.qr_code; } });

🚦 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