Bill Payment QR Code Generator API
The Bill Payment QR Code Generator API allows developers to generate QR codes for payment transactions. This API returns:
- QR Code image as Base64-encoded PNG
- EMVCo Payload string
Bill Payment QR Code Generator API คือเครื่องมือที่ช่วยให้นักพัฒนาสามารถสร้าง QR Code สำหรับการชำระเงินได้อย่างง่ายดาย API นี้จะคืนค่า:
- รูปภาพ QR Code ในรูปแบบ PNG ที่เข้ารหัส Base64
- ข้อความ Payload ตามมาตรฐาน EMVCo
Base URL
https://bill-payment-api.easyslip.com- Data format: JSON (UTF-8)
Endpoint
Generate QR Code
- URL: /
- Method: POST
- Headers:
- Content-Type: application/json (required)
- Description: Generate QR Code and Payload for payment
Request Body Structure
Required Fields
type (string, required): Payment type. Must be one of the following (case-insensitive):
PROMPTPAY
amount (number, optional): Payment amount. Must be positive and have at most 2 decimal places.
Type-Specific Fields
For PROMPTPAY
You must provide exactly one of the following:
- msisdn (string): Thai mobile number (10 digits starting with 0, e.g., 0812345678)
- natId (string): Thai national ID (13 digits)
- eWalletId (string): e-Wallet ID (15 digits)
Important
You cannot send more than one identifier field at the same time.
Request Examples
PROMPTPAY with Mobile Number
curl -s -X POST "https://bill-payment-api.easyslip.com/" \
-H "Content-Type: application/json" \
-d '{"type":"PROMPTPAY","msisdn":"0812345678","amount":10}'PROMPTPAY with National ID
curl -s -X POST "https://bill-payment-api.easyslip.com/" \
-H "Content-Type: application/json" \
-d '{"type":"PROMPTPAY","natId":"1101700203451"}'PROMPTPAY with eWallet ID
curl -s -X POST "https://bill-payment-api.easyslip.com/" \
-H "Content-Type: application/json" \
-d '{"type":"PROMPTPAY","eWalletId":"123456789012345","amount":99.99}'Note
For PROMPTPAY with msisdn, the system automatically normalizes the number to format 0066XXXXXXXXX (removes leading 0 and adds 0066 prefix).
Response Type
type SuccessResponse = {
image_base64: string // Base64-encoded PNG image
mime: string // "image/png"
payload: string // EMVCo payload string
}
type ErrorResponse = {
code: string
message: string
}Response Examples
Success (HTTP 200)
{
"image_base64": "iVBORw0KGgoAAAANSUhEUgAA...",
"mime": "image/png",
"payload": "000201010212...6304ABCD"
}Error Responses
invalid_input (HTTP 400)
{
"code": "INVALID_INPUT",
"message": "type: required"
}Causes:
- Missing required field
type
Solution:
- Ensure
typefield is included in request body
{
"code": "INVALID_INPUT",
"message": "type: must be one of: PROMPTPAY"
}Causes:
- Invalid payment type
Solution:
- Use only supported payment types:
PROMPTPAY
{
"code": "INVALID_INPUT",
"message": "amount: must be positive and have at most 2 decimal places"
}Causes:
- Invalid amount format
Solution:
- Ensure amount is positive and has maximum 2 decimal places (e.g., 10.50, 99.99)
{
"code": "INVALID_INPUT",
"message": "one of msisdn, natId, eWalletId is required"
}Causes:
- No identifier provided for PROMPTPAY
Solution:
- Provide exactly one of:
msisdn,natId, oreWalletId
{
"code": "INVALID_INPUT",
"message": "please provide exactly one of: msisdn, natId, eWalletId"
}Causes:
- Multiple identifiers provided
Solution:
- Send only one identifier field
{
"code": "INVALID_INPUT",
"message": "msisdn: must be a Thai mobile number (10 digits starting with 0)"
}Causes:
- Invalid mobile number format
Solution:
- Use Thai mobile number format: 10 digits starting with 0 (e.g., 0812345678)
{
"code": "INVALID_INPUT",
"message": "natId: must be exactly 13 digits"
}Causes:
- Invalid national ID format
Solution:
- Provide exactly 13 digits for national ID
{
"code": "INVALID_INPUT",
"message": "eWalletId: must be exactly 15 digits"
}Causes:
- Invalid eWallet ID format
Solution:
- Provide exactly 15 digits for eWallet ID
unsupported_media_type (HTTP 415)
{
"code": "UNSUPPORTED_MEDIA_TYPE",
"message": "Content-Type must be application/json"
}Causes:
- Missing or incorrect Content-Type header
Solution:
- Set
Content-Type: application/jsonin request headers
method_not_allowed (HTTP 405)
{
"code": "METHOD_NOT_ALLOWED",
"message": "Method not allowed"
}Causes:
- Using unsupported HTTP method on endpoint
Solution:
- Use POST method for this endpoint
not_found (HTTP 404)
{
"code": "NOT_FOUND",
"message": "Not found"
}Causes:
- Invalid endpoint path
Solution:
- Check endpoint URL is correct
internal_server_error (HTTP 500)
{
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal server error"
}Causes:
- Server-side error during processing (e.g., QR code rendering failed)
Solution:
- Retry the request
- Contact support if problem persists
Validation Rules Summary
- Content-Type: Must be
application/json - type: Must be
PROMPTPAY - amount: Must be positive number with maximum 2 decimal places
- PROMPTPAY: Must provide exactly one of
msisdn/natId/eWalletIdwith correct format