TrueMoney Wallet API 🎁
ระบบตรวจสอบข้อมูลและกดรับเงินจากซองของขวัญ (Voucher / อั่งเปา) TrueMoney Wallet อัตโนมัติ
POST
/tmn/verify
🔍 ตรวจสอบซองตรวจสอบข้อมูลซองของขวัญ TrueMoney Wallet เพื่อดูยอดเงินรวม, ชื่อผู้สร้างซอง, จำนวนคนที่รับได้ และสถานะความถูกต้อง โดยที่ยังไม่กดรับเงินจริง
พารามิเตอร์ (JSON / Form-Data)
| Field | Type | Description |
|---|---|---|
voucher จำเป็น |
String | ลิงก์ซองของขวัญเต็ม (เช่น https://gift.truemoney.com/campaign/?v=xxxxxx) หรือรหัส hash ท้ายลิงก์ |
phone จำเป็น |
String | เบอร์โทรศัพท์ TrueMoney Wallet 10 หลัก (เช่น "0812345678") |
จำเป็นต้องระบุ
X-API-Key (สิทธิ์ tmn)
cURL
curl -X POST https://api.nearbyshop.xyz/tmn/verify \
-H "X-API-Key: nb_live_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"voucher": "https://gift.truemoney.com/campaign/?v=a1b2c3d4e5", "phone": "0812345678"}'
Node.js (Axios)
const axios = require('axios');
async function checkVoucher() {
try {
const response = await axios.post('https://api.nearbyshop.xyz/tmn/verify', {
voucher: 'https://gift.truemoney.com/campaign/?v=a1b2c3d4e5',
phone: '0812345678'
}, {
headers: { 'X-API-Key': 'nb_live_your_api_key_here' }
});
console.log(response.data);
} catch (error) {
console.error(error.response?.data || error.message);
}
}
checkVoucher();
Python (Requests)
import requests
url = "https://api.nearbyshop.xyz/tmn/verify"
headers = {"X-API-Key": "nb_live_your_api_key_here"}
payload = {
"voucher": "https://gift.truemoney.com/campaign/?v=a1b2c3d4e5",
"phone": "0812345678"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
PHP (cURL)
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nearbyshop.xyz/tmn/verify",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
"X-API-Key: nb_live_your_api_key_here",
"Content-Type: application/json"
],
CURLOPT_POSTFIELDS => json_encode([
"voucher" => "https://gift.truemoney.com/campaign/?v=a1b2c3d4e5",
"phone" => "0812345678"
])
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>
ตัวอย่างผลลัพธ์ (Response 200 OK)
{
"status": "success",
"success": true,
"data": {
"voucher_hash": "a1b2c3d4e5",
"owner_name": "สมชาย ใจดี",
"amount": "100.00",
"total_amount": "100.00",
"available_tickets": 1,
"redeemed_tickets": 0,
"is_expired": false,
"status": "ACTIVE"
}
}
POST
/tmn/redeem
💰 กดรับเงินเข้าเบอร์กดรับเงินจากซองของขวัญ TrueMoney Wallet โอนเข้าเบอร์โทรศัพท์ที่ระบุทันที พร้อมรองรับโหมดจำลองการทำงาน (dryRun: true) เพื่อทดสอบระบบโดยไม่กดรับเงินจริง
พารามิเตอร์ (JSON / Form-Data)
| Field | Type | Description |
|---|---|---|
voucher จำเป็น |
String | ลิงก์ซองของขวัญเต็ม หรือรหัส hash ท้ายลิงก์ |
phone จำเป็น |
String | เบอร์โทรศัพท์ TrueMoney Wallet 10 หลักที่จะให้เงินเข้า |
dryRun ไม่บังคับ |
Boolean | ใส่ true หากต้องการทดสอบระบบโดยยังไม่กดรับเงินจริง (Default: false) |
จำเป็นต้องระบุ
X-API-Key (สิทธิ์ tmn)
cURL
curl -X POST https://api.nearbyshop.xyz/tmn/redeem \
-H "X-API-Key: nb_live_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"voucher": "https://gift.truemoney.com/campaign/?v=a1b2c3d4e5", "phone": "0812345678"}'
Node.js (Axios)
const axios = require('axios');
async function redeemVoucher() {
try {
const response = await axios.post('https://api.nearbyshop.xyz/tmn/redeem', {
voucher: 'https://gift.truemoney.com/campaign/?v=a1b2c3d4e5',
phone: '0812345678'
}, {
headers: { 'X-API-Key': 'nb_live_your_api_key_here' }
});
console.log(response.data);
} catch (error) {
console.error(error.response?.data || error.message);
}
}
redeemVoucher();
Python (Requests)
import requests
url = "https://api.nearbyshop.xyz/tmn/redeem"
headers = {"X-API-Key": "nb_live_your_api_key_here"}
payload = {
"voucher": "https://gift.truemoney.com/campaign/?v=a1b2c3d4e5",
"phone": "0812345678"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
PHP (cURL)
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nearbyshop.xyz/tmn/redeem",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
"X-API-Key: nb_live_your_api_key_here",
"Content-Type: application/json"
],
CURLOPT_POSTFIELDS => json_encode([
"voucher" => "https://gift.truemoney.com/campaign/?v=a1b2c3d4e5",
"phone" => "0812345678"
])
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>
ตัวอย่างผลลัพธ์ (Response 200 OK)
{
"status": "success",
"success": true,
"message": "รับเงินจากซองสำเร็จ",
"data": {
"voucher_hash": "a1b2c3d4e5",
"owner_name": "สมชาย ใจดี",
"received_amount": 100.00,
"phone": "0812345678",
"redeemed_at": "2026-09-05T00:20:00.000Z"
}
}
⚠️ รหัสข้อผิดพลาดของซอง (TrueMoney Error Codes)
รหัสข้อผิดพลาดเฉพาะที่อาจเกิดขึ้นระหว่างการตรวจสอบหรือกดรับซองของขวัญ TrueMoney Wallet:
| HTTP Status | Error Code | สาเหตุ / ความหมาย |
|---|---|---|
| 400 Bad Request | VOUCHER_EXPIRED |
ซองของขวัญหมดอายุแล้ว (ซอง TrueMoney มีอายุ 72 ชั่วโมงหลังจากสร้าง) |
| 400 Bad Request | VOUCHER_OUT_OF_STOCK |
ซองของขวัญถูกกดรับเงินไปจนครบจำนวนสิทธิ์แล้ว |
| 400 Bad Request | CANNOT_GET_OWN_VOUCHER |
ไม่สามารถใช้เบอร์โทรศัพท์ของผู้สร้างซองในการกดรับซองของตัวเองได้ |
| 400 Bad Request | INVALID_PHONE_NUMBER |
เบอร์โทรศัพท์ไม่ถูกต้อง หรือไม่ใช่เบอร์ TrueMoney Wallet ที่ลงทะเบียนไว้ |
| 404 Not Found | VOUCHER_NOT_FOUND |
ไม่พบลิงก์หรือรหัสซองของขวัญนี้ในระบบ TrueMoney |