ktruemoney_voucher
v1.0.0
Published
TrueMoney Wallet Voucher Redeemer bypassing Cloudflare using Playwright
Maintainers
Readme
ktruemoney_voucher
Bypass Cloudflare and redeem/verify TrueMoney Wallet gift vouchers with ease.
A powerful Playwright-based solution for automated TrueMoney Voucher management.
Installation
npm install ktruemoney_voucher
# or install globally for CLI access
npm install -g ktruemoney_voucherRequires Node.js ≥ 14 and Playwright browser binaries.
Command Line Interface (CLI)
After installing globally, you can use the ktruemoney command:
# Redeem a voucher
ktruemoney redeem 08XXXXXXXX https://gift.truemoney.com/campaign/vouchers/XXXXX/redeem
# Verify voucher info
ktruemoney verify XXXXX
# Using a proxy
ktruemoney verify XXXXX --proxy http://myproxy.com:3128Quick Start
1. Redeem a Voucher
The simplest way to redeem a voucher to your phone number.
import { redeem } from 'ktruemoney_voucher';
try {
const result = await redeem('08XXXXXXXX', 'https://gift.truemoney.com/campaign/vouchers/YOUR_CODE/redeem');
console.log('Success:', result.amount, 'THB');
} catch (error) {
console.error(`Redeem Failed (${error.code}): ${error.message}`);
}2. Verify Voucher (Info Only)
Fetch voucher details without redeeming it.
import { verify } from 'ktruemoney_voucher';
try {
const info = await verify('YOUR_CODE');
console.log('Voucher Owner:', info.owner_profile.full_name);
} catch (error) {
console.error(`Verify Failed: ${error.message}`);
}API Reference
Core Methods
| Method | Description |
|---|---|
| redeem(phone, voucher) | Validates and redeems a voucher to a mobile number |
| verify(voucher) | Fetches voucher metadata (amount, owner, status) |
| extractCode(data) | Staticaly extracts 35-char code from URLs or strings |
Advanced Usage (Custom Client)
import { VoucherClient } from 'ktruemoney_voucher';
const client = new VoucherClient({
headless: false, // Show browser for debugging
userAgent: 'Mozilla/5.0 ...',
proxy: {
server: 'http://myproxy.com:3128',
username: 'user', // Optional
password: 'pwd' // Optional
}
});
// Static Validation (No browser needed)
if (VoucherClient.isValidPhone('0812345678')) {
const code = VoucherClient.extractCode(URL);
const info = await client.verify(code);
}Error Handling
All errors are instances of VoucherError.
| Code | Description |
|---|---|
| INVAILD_PHONE | The phone number format is incorrect |
| INVAILD_VOUCHER | 35-character voucher code not found in input |
| BROWSER_ERROR | Playwright or Chromium execution failure |
| VOUCHER_OUT_OF_STOCK | The voucher has already been fully redeemed |
| VOUCHER_EXPIRED | The voucher has reached its expiration date |
Features
- Cloudflare Bypass — Uses Playwright to navigate protection layers automatically.
- Simple API — Shorthand functions for common tasks like
redeemandverify. - Robust Extraction — Automatically finds voucher codes in URLs or raw text.
- Custom Errors — Catch specific issues with typed error codes.
- Mobile Optimized — Uses mobile user agents for better compatibility.
License
MIT © Watcharapong Namsaeng
