Skip to content

Verify by Image

Verify a TrueMoney Wallet slip by uploading an image file.

Endpoint

http
POST /verify/truewallet

Full URL: https://api.easyslip.com/v2/verify/truewallet

Authentication

Required. See Authentication Guide.

http
Authorization: Bearer YOUR_API_KEY
Content-Type: multipart/form-data

Request

Parameters

ParameterTypeRequiredDescription
imageFileYesSlip image file
remarkstringNoCustom remark (1-255 characters)
matchAccountbooleanNoMatch receiver with registered accounts
matchAmountnumberNoExpected amount to validate
checkDuplicatebooleanNoCheck if this branch already verified this slip — branch-scoped, not global

Image Requirements

RequirementValue
Maximum size4 MB (4,194,304 bytes)
Supported formatsJPEG, PNG, GIF, WebP
QR code visibilityMust be clear and readable

Type Definitions

typescript
// Request (multipart/form-data)
interface VerifyByImageRequest {
  image: File;              // Image file
  remark?: string;          // 1-255 chars
  matchAccount?: boolean;
  matchAmount?: number;
  checkDuplicate?: boolean;
}

// Response
interface VerifyTrueWalletResponse {
  success: true;
  data: VerifyTrueWalletData;
  message: string;
}

// See POST /verify/truewallet for full type definitions

Examples

bash
curl -X POST https://api.easyslip.com/v2/verify/truewallet \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "image=@/path/to/truemoney-slip.jpg" \
  -F "checkDuplicate=true"
javascript
const verifyTrueWallet = async (file, options = {}) => {
  const formData = new FormData();
  formData.append('image', file);

  Object.entries(options).forEach(([key, value]) => {
    formData.append(key, String(value));
  });

  const response = await fetch('https://api.easyslip.com/v2/verify/truewallet', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY'
    },
    body: formData
  });

  const result = await response.json();

  if (!result.success) {
    throw new Error(result.error.message);
  }

  return result.data;
};

// Usage with file input
const fileInput = document.getElementById('slipImage');
fileInput.addEventListener('change', async (e) => {
  const file = e.target.files[0];

  try {
    const slip = await verifyTrueWallet(file, { checkDuplicate: true });
    console.log('Transaction ID:', slip.rawSlip.transactionId);
    console.log('Amount:', slip.rawSlip.amount);
  } catch (error) {
    console.error('Error:', error.message);
  }
});
javascript
import fs from 'fs';
import FormData from 'form-data';

const verifyTrueWallet = async (filePath, options = {}) => {
  const formData = new FormData();
  formData.append('image', fs.createReadStream(filePath));

  Object.entries(options).forEach(([key, value]) => {
    formData.append(key, String(value));
  });

  const response = await fetch('https://api.easyslip.com/v2/verify/truewallet', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${process.env.EASYSLIP_API_KEY}`,
      ...formData.getHeaders()
    },
    body: formData
  });

  const result = await response.json();

  if (!result.success) {
    throw new Error(result.error.message);
  }

  return result.data;
};

// Usage
const slip = await verifyTrueWallet('./truemoney-slip.jpg', { checkDuplicate: true });
console.log('Amount:', slip.rawSlip.amount);
php
function verifyTrueWallet(string $filePath, array $options = []): array
{
    $apiKey = getenv('EASYSLIP_API_KEY');

    $postFields = ['image' => new CURLFile($filePath)];

    foreach ($options as $key => $value) {
        $postFields[$key] = is_bool($value) ? ($value ? 'true' : 'false') : $value;
    }

    $ch = curl_init();
    curl_setopt_array($ch, [
        CURLOPT_URL => 'https://api.easyslip.com/v2/verify/truewallet',
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_POST => true,
        CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
        CURLOPT_POSTFIELDS => $postFields
    ]);

    $response = curl_exec($ch);
    curl_close($ch);

    $result = json_decode($response, true);

    if (!$result['success']) {
        throw new Exception($result['error']['message']);
    }

    return $result['data'];
}

// Usage
$slip = verifyTrueWallet('/path/to/truemoney-slip.jpg', ['checkDuplicate' => true]);
echo "Amount: " . $slip['rawSlip']['amount'];
python
import requests
import os

def verify_truewallet(file_path: str, **options) -> dict:
    with open(file_path, 'rb') as f:
        files = {'image': f}
        data = {k: str(v).lower() if isinstance(v, bool) else v for k, v in options.items()}

        response = requests.post(
            'https://api.easyslip.com/v2/verify/truewallet',
            headers={'Authorization': f'Bearer {os.environ["EASYSLIP_API_KEY"]}'},
            files=files,
            data=data
        )

    result = response.json()

    if not result['success']:
        raise Exception(result['error']['message'])

    return result['data']

# Usage
slip = verify_truewallet('./truemoney-slip.jpg', checkDuplicate=True)
print(f"Amount: {slip['rawSlip']['amount']}")

Response

Success (200)

json
{
  "success": true,
  "data": {
    "isDuplicate": false,
    "amountInSlip": 500.00,
    "rawSlip": {
      "transactionId": "12345678901234",
      "date": "2024-01-15T14:30:00+07:00",
      "amount": 500.00,
      "sender": {
        "name": "นาย ผู้โอน ทดสอบ"
      },
      "receiver": {
        "name": "นาย รับเงิน ทดสอบ",
        "phone": "08x-xxx-4567"
      }
    }
  },
  "message": "TrueMoney Wallet slip verified successfully"
}

Error Responses

Image Size Too Large (400)

json
{
  "success": false,
  "error": {
    "code": "IMAGE_SIZE_TOO_LARGE",
    "message": "Image size exceeds 4MB limit"
  }
}

Invalid Image (400)

json
{
  "success": false,
  "error": {
    "code": "INVALID_IMAGE",
    "message": "Image is not a valid TrueMoney Wallet slip"
  }
}

Slip Not Found (404)

json
{
  "success": false,
  "error": {
    "code": "SLIP_NOT_FOUND",
    "message": "TrueMoney Wallet slip not found or invalid"
  }
}

Notes

  • Ensure the QR code is clearly visible and not blurry
  • Crop the image to focus on the QR code area for faster processing

Bank Slip Verification API for Thai Banking