POST /verify/truewallet
Verify a TrueMoney Wallet transfer slip by uploading an image or sending the text of its QR code.
The API reads the TrueMoney P2P transfer QR on the slip and checks it with TrueMoney. It does not read the text printed on the slip, so the image must contain that QR. A bank transfer QR is rejected with invalid_wallet_qr.
Endpoint
POST /verify/truewalletFull URL: https://api.thunder.in.th/v1/verify/truewallet
v2 Available
TrueMoney Wallet verification is now also available in API v2 with additional features like Base64, URL input, account matching, and amount matching.
Authentication
Required. See Authentication Guide.
Authorization: Bearer YOUR_API_KEY
Content-Type: multipart/form-dataRequest
Parameters
Send exactly one of file or payload. file goes in multipart/form-data. payload can go in a JSON body or as a form field.
| Parameter | Type | Required | Description |
|---|---|---|---|
file | File | One of | Slip image file |
payload | string | One of | Text of the TrueMoney QR code (1-256 characters) |
checkDuplicate | boolean | No | Check for duplicate slip |
Image Requirements
| Requirement | Value |
|---|---|
| Maximum size | 4 MB |
| Supported formats | JPEG, PNG, GIF, WebP |
| QR code | Must contain a readable TrueMoney P2P transfer QR |
Type Definitions
// Request: exactly one of file (multipart/form-data) or payload
interface VerifyTrueMoneyRequest {
file?: File; // Image file
payload?: string; // TrueMoney QR text (1-256 chars)
checkDuplicate?: boolean;
}
// Response
interface VerifyTrueMoneyResponse {
status: 200;
data: TrueMoneySlipData;
}
interface TrueMoneySlipData {
transactionId: string;
date: string; // ISO 8601
amount: number;
sender?: { // Only when TrueMoney returns the sender phone
phone: string; // Masked mobile, e.g. 08-xxx-2345
};
receiver?: { // Only when TrueMoney returns the receiver phone
phone: string; // Masked mobile, e.g. 08-xxx-4567
};
}
// Error Response
interface ErrorResponse {
status: number;
message: string;
data?: TrueMoneySlipData; // Included when duplicate_slip
}Examples
curl -X POST https://api.thunder.in.th/v1/verify/truewallet \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@/path/to/truemoney-slip.jpg" \
-F "checkDuplicate=true"curl -X POST https://api.thunder.in.th/v1/verify/truewallet \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"payload": "TRUEMONEY_QR_TEXT", "checkDuplicate": true}'const verifyTrueMoney = async (file, checkDuplicate = false) => {
const formData = new FormData();
formData.append('file', file);
formData.append('checkDuplicate', String(checkDuplicate));
const response = await fetch(
'https://api.thunder.in.th/v1/verify/truewallet',
{
method: 'POST',
headers: { 'Authorization': 'Bearer YOUR_API_KEY' },
body: formData
}
);
const result = await response.json();
if (result.status !== 200) {
throw new Error(result.message);
}
return result.data;
};
// Usage
const fileInput = document.getElementById('slipFile');
fileInput.addEventListener('change', async (e) => {
const file = e.target.files[0];
const slip = await verifyTrueMoney(file, true);
console.log('Transaction ID:', slip.transactionId);
console.log('Amount:', slip.amount);
});function verifyTrueMoney(string $filePath, bool $checkDuplicate = false): array
{
$apiKey = getenv('THUNDER_API_KEY');
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://api.thunder.in.th/v1/verify/truewallet',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
CURLOPT_POSTFIELDS => [
'file' => new CURLFile($filePath),
'checkDuplicate' => $checkDuplicate ? 'true' : 'false'
]
]);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
if ($result['status'] !== 200) {
throw new Exception($result['message']);
}
return $result['data'];
}
// Usage
$slip = verifyTrueMoney('/path/to/truemoney-slip.jpg', true);
echo "Transaction ID: " . $slip['transactionId'];
echo "Amount: " . $slip['amount'];import requests
import os
def verify_truemoney(file_path: str, check_duplicate: bool = False) -> dict:
with open(file_path, 'rb') as f:
response = requests.post(
'https://api.thunder.in.th/v1/verify/truewallet',
headers={'Authorization': f'Bearer {os.environ["THUNDER_API_KEY"]}'},
files={'file': f},
data={'checkDuplicate': 'true' if check_duplicate else 'false'}
)
result = response.json()
if result['status'] != 200:
raise Exception(result['message'])
return result['data']
# Usage
slip = verify_truemoney('./truemoney-slip.jpg', check_duplicate=True)
print(f"Transaction ID: {slip['transactionId']}")
print(f"Amount: {slip['amount']}")Response
Success (200)
{
"status": 200,
"data": {
"transactionId": "12345678901234",
"date": "2024-01-15T14:30:00+07:00",
"amount": 500.00,
"sender": {
"phone": "08-xxx-2345"
},
"receiver": {
"phone": "08-xxx-4567"
}
}
}Response Fields
| Field | Type | Description |
|---|---|---|
transactionId | string | TrueMoney transaction ID |
date | string | Transaction timestamp (ISO 8601) |
amount | number | Transfer amount |
sender.phone | string | Sender's masked mobile, e.g. 08-xxx-2345 |
receiver.phone | string | Receiver's masked mobile, e.g. 08-xxx-4567 |
The API returns what TrueMoney returns for the transfer QR. There are no names. sender and receiver contain only a masked mobile in the form 0X-xxx-NNNN, and each object appears only when TrueMoney returns that phone.
Error Responses
Invalid Image (400)
{
"status": 400,
"message": "invalid_image"
}Image Size Too Large (400)
{
"status": 400,
"message": "image_size_too_large"
}No TrueMoney QR (400)
{
"status": 400,
"message": "invalid_wallet_qr"
}Invalid Input (400)
Sent neither file nor payload, or sent both, or payload is empty or longer than 256 characters.
{
"status": 400,
"message": "invalid_input"
}Slip Not Found (404)
{
"status": 404,
"message": "slip_not_found"
}Duplicate Slip (400)
{
"status": 400,
"message": "duplicate_slip",
"data": {
"transactionId": "12345678901234",
"date": "2024-01-15T14:30:00+07:00",
"amount": 500.00,
"receiver": {
"phone": "08-xxx-4567"
}
}
}TrueMoney Unavailable (502/503)
The message is the code, e.g. {"status": 503, "message": "wallet_provider_busy"}. Try again later. When the response has a Retry-After header, wait at least that many seconds.
| Status | Message | When |
|---|---|---|
| 503 | wallet_provider_busy | Too many requests to TrueMoney right now |
| 503 | wallet_provider_unavailable | TrueMoney did not answer in time |
| 503 | wallet_provider_not_configured | TrueMoney checking is not set up on our side |
| 502 | wallet_provider_invalid_response | TrueMoney sent a response the API could not use |
Notes
- Ensure the QR code is clearly visible
- Quota is consumed for each verification request
- Duplicate slips from same service don't consume quota
- TrueMoney transfers typically have shorter validity periods
