POST /qr/generate
Create PromptPay and merchant QR codes to receive payments.
Endpoint
POST /qr/generateFull URL: https://api.easyslip.com/v1/qr/generate
v1 Only
QR code generation is only available in API v1.
Authentication
Required. See Authentication Guide.
Authorization: Bearer YOUR_API_KEY
Content-Type: application/jsonRequest
QR Types
| Type | Description |
|---|---|
PROMPTPAY | PromptPay QR code: mobile number, national ID, e-wallet ID, or your registered Biller ID (Tag 30) |
KSHOP | Kasikorn K-Shop merchant QR code for a K SHOP shop id (KB + 12 digits) |
MAE_MANEE | Mae Manee merchant QR code for a 15-digit Mae Manee shop id |
TUNGNGERN | Tungngern merchant QR code for a merchant code, with an optional English shop name |
BILL_PAYMENT | Legacy, still supported: Biller ID QR, the same QR as PROMPTPAY with billerId |
Type Definitions
// Request Types
type QRGenerateRequest =
| PromptPayRequest
| KShopRequest
| MaeManeeRequest
| TungngernRequest | BillPaymentRequest;
interface PromptPayRequest {
type: 'PROMPTPAY';
// Exactly one of msisdn, natId, eWalletId, billerId
msisdn?: string; // Mobile number (0xxxxxxxxx)
natId?: string; // National ID (13 digits)
eWalletId?: string; // E-wallet ID (15 digits)
billerId?: string; // Biller ID: 15 digits, including the suffix; preserve leading zeroes
ref1?: string; // Required with billerId: 1-20 printable ASCII characters, case preserved
ref2?: string; // Only with billerId: same format as ref1; omit when unused
terminalId?: string; // Only with billerId: terminal ID printed in tag 62 (sub 07); 1-25 printable ASCII characters
referenceLabel?: string; // Only with billerId: reference label in tag 62 (sub 05); 1-25 printable ASCII characters
amount?: number; // Max 2 decimals; with billerId 0.01 to 9999999999.99
}
// Legacy, still supported: gives the same QR as PROMPTPAY with billerId
interface BillPaymentRequest {
type: 'BILL_PAYMENT';
billerId: string; // 15 digits, including the suffix; preserve leading zeroes
ref1: string; // 1-20 printable ASCII characters, case preserved
ref2?: string; // Same format as ref1; omit when unused
terminalId?: string; // Terminal ID (tag 62 sub 07); 1-25 printable ASCII characters
referenceLabel?: string; // Reference label (tag 62 sub 05); 1-25 printable ASCII characters
amount?: number; // 0.01 to 9999999999.99, at most 2 decimals
}
interface KShopRequest {
type: 'KSHOP';
ref1: string; // K SHOP shop id: KB + 12 digits, any case; a leading KPS004 is removed
amount?: number;
}
interface MaeManeeRequest {
type: 'MAE_MANEE';
ref1: string; // Mae Manee shop id: 15 digits
amount?: number;
}
interface TungngernRequest {
type: 'TUNGNGERN';
ref1: string; // Tungngern merchant code (1-20 alphanumeric, uppercase)
merchantName?: string; // Optional: English shop name from the Tungngern app, kept as A-Z0-9, max 20; omitted: ref1 is used
amount?: number;
}
// Response
interface QRGenerateResponse {
status: 200;
data: QRData;
}
interface QRData {
image: string; // Base64-encoded PNG image
mime: string; // MIME type (image/png)
payload: string; // QR code payload string
}
// Error Response
interface ErrorResponse {
status: number;
message: string;
details?: string | Array<{ field: string; message: string }>;
}Examples
PromptPay (Biller ID)
Use type PROMPTPAY with the 15-digit Biller ID registered with your bank or payment provider. This endpoint generates a payment QR; it does not issue or register a Biller ID, or check whether that ID is active.
{
"type": "PROMPTPAY",
"billerId": "010555123456701",
"ref1": "INV20261014001",
"ref2": "CUSTOMER001",
"amount": 125.50
}The example ID is illustrative; replace it with your own registered Biller ID.
| Field | Required | Format |
|---|---|---|
type | Yes | "PROMPTPAY" |
billerId | Yes | String of exactly 15 digits including the suffix; leading zeroes preserved |
ref1 | Yes | 1-20 printable ASCII characters; not whitespace-only |
ref2 | No | Same format as ref1; omit when unused |
terminalId | No | 1-25 printable ASCII characters; not whitespace-only. See Shops with a payment terminal |
referenceLabel | No | 1-25 printable ASCII characters; not whitespace-only. Sent with terminalId when the shop's own QR has it |
amount | No | Positive number, at most 2 decimals, 0.01 to 9999999999.99 THB |
Do not send msisdn, natId or eWalletId together with billerId (400). References are preserved exactly, including case and spaces. Use the reference format required by your bank for your Biller ID. Omitting amount lets the payer enter it. The response (image, mime, payload) is unchanged from the existing QR types.
Payload structure follows the Bank of Thailand Thai QR Code standard, page 15.
Shops with a payment terminal
Some shops have a payment terminal, and their own QR carries extra data (tag 62): a reference label (sub tag 05) and a terminal ID (sub tag 07). A QR made without them can be rejected by the bank app at payment ("the merchant cannot accept this payment"). Copy both values from the shop's own QR and send them as referenceLabel and terminalId. Both are optional and apply only to PROMPTPAY with billerId and to BILL_PAYMENT. When you omit them the payload is exactly the same as before.
{
"type": "PROMPTPAY",
"billerId": "040556800491515",
"ref1": "DEHENG",
"amount": 1,
"terminalId": "23035360",
"referenceLabel": "23035360"
}Returns this payload (tag 62 comes after tag 58, sub tag 05 before sub tag 07):
00020101021230490016A00000067701011201150405568004915150206DEHENG530376454041.005802TH62240508230353600708230353606304E955Bill Payment (legacy)
BILL_PAYMENT is still supported with the same fields (billerId, ref1, ref2, amount, terminalId, referenceLabel) and the same validation. For the same input it returns exactly the same QR and payload as PROMPTPAY with billerId. New integrations should use PROMPTPAY.
{
"type": "BILL_PAYMENT",
"billerId": "010555123456701",
"ref1": "INV20261014001",
"ref2": "CUSTOMER001",
"amount": 125.50
}PromptPay
curl -X POST https://api.easyslip.com/v1/qr/generate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "PROMPTPAY",
"msisdn": "0812345678",
"amount": 100.00
}'const generateQR = async (config) => {
const response = await fetch('https://api.easyslip.com/v1/qr/generate', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify(config)
});
const result = await response.json();
if (result.status !== 200) {
throw new Error(result.message);
}
return result.data;
};
// Generate PromptPay QR
const qr = await generateQR({
type: 'PROMPTPAY',
msisdn: '0812345678',
amount: 100.00
});
// Display QR code
const img = document.createElement('img');
img.src = `data:${qr.mime};base64,${qr.image}`;
document.body.appendChild(img);function generateQR(array $config): array
{
$apiKey = getenv('EASYSLIP_API_KEY');
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://api.easyslip.com/v1/qr/generate',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json'
],
CURLOPT_POSTFIELDS => json_encode($config)
]);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
if ($result['status'] !== 200) {
throw new Exception($result['message']);
}
return $result['data'];
}
// Generate PromptPay QR
$qr = generateQR([
'type' => 'PROMPTPAY',
'msisdn' => '0812345678',
'amount' => 100.00
]);
// Save as file
$imageData = base64_decode($qr['image']);
file_put_contents('qr-code.png', $imageData);
// Or display inline
echo '<img src="data:' . $qr['mime'] . ';base64,' . $qr['image'] . '">';import requests
import base64
import os
def generate_qr(config: dict) -> dict:
response = requests.post(
'https://api.easyslip.com/v1/qr/generate',
headers={
'Authorization': f'Bearer {os.environ["EASYSLIP_API_KEY"]}',
'Content-Type': 'application/json'
},
json=config
)
result = response.json()
if result['status'] != 200:
raise Exception(result['message'])
return result['data']
# Generate PromptPay QR
qr = generate_qr({
'type': 'PROMPTPAY',
'msisdn': '0812345678',
'amount': 100.00
})
# Save as file
image_data = base64.b64decode(qr['image'])
with open('qr-code.png', 'wb') as f:
f.write(image_data)
print(f"Payload: {qr['payload']}")K-Shop
{
"type": "KSHOP",
"ref1": "KB000001234567",
"amount": 250.00
}ref1 is your K SHOP shop id: KB followed by 12 digits. Case does not matter, and a leading KPS004 (as in KPS004KB000001234567) is removed. Anything else returns 400.
Mae Manee
{
"type": "MAE_MANEE",
"ref1": "014000123456789",
"amount": 500.00
}ref1 is your 15-digit Mae Manee shop id. The QR carries tag 30 only, with no KBank tag 31.
Tungngern
{
"type": "TUNGNGERN",
"ref1": "ORDER12345",
"merchantName": "MY STORE",
"amount": 750.00
}merchantName is optional. If you have the English shop name shown in the Tungngern app, send it: English letters and digits only count. It is changed to uppercase, everything except A-Z and 0-9 is removed, and it is cut to 20 characters, so MY STORE goes into the QR as MYSTORE. If you leave it out, or nothing is left after that (for example a Thai-only name), the QR uses ref1 as the shop name. The QR also carries tag 62 with sub-tag 07 set to 0000.
Response
Success (200)
{
"status": 200,
"data": {
"image": "iVBORw0KGgoAAAANSUhEUgAA...",
"mime": "image/png",
"payload": "00020101021230..."
}
}Response Fields
| Field | Type | Description |
|---|---|---|
image | string | Base64-encoded PNG image |
mime | string | MIME type (image/png) |
payload | string | QR code payload string |
Error Responses
Invalid Request (400)
{
"status": 400,
"message": "invalid_request",
"details": [
{ "field": "ref1", "message": "ref1 must be KB followed by 12 digits" }
]
}| Case | field | message |
|---|---|---|
KSHOP ref1 is not KB + 12 digits | ref1 | ref1 must be KB followed by 12 digits |
MAE_MANEE ref1 is not 15 digits | ref1 | ref1 must be the 15-digit Mae Manee shop id |
TUNGNGERN merchantName is not a string | merchantName | merchantName: use the English shop name shown in the Tung Ngern app |
PROMPTPAY requests with msisdn, natId or eWalletId return details as a single message:
{
"status": 400,
"message": "invalid_request",
"details": "ref1 and ref2 are only allowed with billerId"
}Unauthorized (401)
{
"status": 401,
"message": "unauthorized"
}Parameter Reference
PromptPay
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | "PROMPTPAY" |
msisdn | string | One of | Mobile number (0xxxxxxxxx) |
natId | string | One of | National ID (13 digits) |
eWalletId | string | One of | E-wallet ID (15 digits) |
billerId | string | One of | Biller ID (15 digits including the suffix, leading zeroes preserved) |
ref1 | string | With billerId | Reference 1 (1-20 printable ASCII characters, case preserved); required with billerId |
ref2 | string | No | Reference 2, only with billerId (same format as ref1) |
terminalId | string | No | Terminal ID (tag 62 sub 07), only with billerId; 1-25 printable ASCII characters |
referenceLabel | string | No | Reference label (tag 62 sub 05), only with billerId; 1-25 printable ASCII characters |
amount | number | No | Amount (max 2 decimals; with billerId 0.01 to 9999999999.99) |
TIP
Provide exactly one of: msisdn, natId, eWalletId, or billerId. ref1 and ref2 are only allowed with billerId; sending them with another identifier returns 400.
Bill Payment (legacy)
Same fields as PROMPTPAY with billerId (type "BILL_PAYMENT", billerId, ref1, ref2, amount), same QR.
K-Shop
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | "KSHOP" |
ref1 | string | Yes | K SHOP shop id: KB + 12 digits, any case; a leading KPS004 is removed |
amount | number | No | Amount (0.01 to 9999999999.99, at most 2 decimals) |
Mae Manee
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | "MAE_MANEE" |
ref1 | string | Yes | Mae Manee shop id: 15 digits |
amount | number | No | Amount (0.01 to 9999999999.99, at most 2 decimals) |
Tungngern
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | "TUNGNGERN" |
ref1 | string | Yes | Tungngern merchant code (1-20 alphanumeric, uppercase) |
merchantName | string | No | English shop name from the Tungngern app, English letters and digits only (changed to uppercase A-Z0-9, cut to 20 characters). Omitted or empty: ref1 is used |
amount | number | No | Amount (0.01 to 9999999999.99, at most 2 decimals) |
Notes
- QR code generation does not consume verification quota
- Generated QR codes are valid indefinitely
- Amount is optional - customer can enter amount when paying
- KSHOP
ref1is a K SHOP shop id (KB+ 12 digits) and MAE_MANEEref1is a 15-digit shop id. TUNGNGERNref1is alphanumeric and normalized to uppercase. Biller ID references (PROMPTPAYwithbillerId, andBILL_PAYMENT) preserve case and support printable ASCII.