Build with the AS Tech API.
Everything you need to integrate the Same Trend / SaaS Lottery suite — Wingo, K3, 5D, TRX & Moto Racing — into any PHP or Node.js project. Multi-currency, fully documented, plug-and-play.
Endpoints (all games)
GET /api/public/v1/{game}/state[?duration=30|60|180|300|600]
POST /api/public/v1/{game}/bet
Authorization: Bearer <public_key>:<secret>
{game} = wingo | k3 | 5d | trx | moto
Body for /bet:
{ "duration": 60,
"selection_type": "color", // see selection rules per game
"selection_value": "red",
"stake": 10,
"currency": "USD", // optional, any ISO-4217 code
"idempotency_key": "u_842::r_8821" }PHP — Color Prediction site
Use the auto-generated PHP kit from the console, OR call the API directly:
<?php
// Place a Wingo bet from any PHP page
$ch = curl_init('https://YOUR_DOMAIN/api/public/v1/wingo/bet');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('ACHA_BEARER'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'duration' => 60,
'selection_type' => 'color',
'selection_value' => 'red',
'stake' => 10,
'currency' => 'PKR', // any ISO code
]),
]);
$resp = json_decode(curl_exec($ch), true);
// → ['bet_id'=>..., 'round_no'=>..., 'stake'=>10, 'new_balance'=>..., 'status'=>'pending']Node.js — Color Prediction & Casino
Works for color-prediction frontends AND server-side casino backends that need to settle rounds programmatically.
// lib/astech.js — minimal fetch client (Node 18+, no deps)
const BASE = process.env.ACHA_BASE_URL;
const BEARER = process.env.ACHA_BEARER;
export async function bet(game, payload) {
const r = await fetch(`${BASE}/api/public/v1/${game}/bet`, {
method: 'POST',
headers: { Authorization: 'Bearer ' + BEARER, 'Content-Type': 'application/json' },
body: JSON.stringify({ currency: 'USD', ...payload }),
});
return r.json();
}
export async function state(game, duration) {
const url = `${BASE}/api/public/v1/${game}/state` + (duration ? '?duration=' + duration : '');
const r = await fetch(url, { headers: { Authorization: 'Bearer ' + BEARER } });
return r.json();
}
// Color-prediction site:
const round = await bet('wingo', { duration: 60, selection_type: 'color',
selection_value: 'green', stake: 100, currency: 'INR' });
// Casino backend — TRX number bet pays 9x:
const spin = await bet('trx', { duration: 60, selection_type: 'number',
selection_value: '7', stake: 50, currency: 'EUR' });
console.log(spin.status); // 'pending' → settles on round lockSelection rules & payouts
| Game | selection_type | selection_value | Payout |
|---|---|---|---|
| wingo | color / number / size | red·green·violet · 0-9 · big·small | 2x · 9x · 2x (1.5x on violet hit) |
| k3 | size / parity / sum | big·small · odd·even · 3-18 | 2x · 2x · 10x |
| 5d | size | big·small | 2x |
| trx | color / size / number | red·green·violet · big·small · 0-9 | 2x · 2x · 9x (violet 4.5x) |
| moto | winner | 8 racers | 7x |
Multi-currency
Every /bet call accepts an optional currency (ISO-4217). Stakes are recorded in the wallet's base unit; the currency code is preserved on the transaction ledger so your frontend can render the right symbol and locale.
| Code | Currency | Symbol | Example body |
|---|---|---|---|
| USD | US Dollar | $ | "currency":"USD" |
| EUR | Euro | € | "currency":"EUR" |
| GBP | Pound | £ | "currency":"GBP" |
| INR | Indian Rupee | ₹ | "currency":"INR" |
| PKR | Pakistani Rupee | ₨ | "currency":"PKR" |
| BRL | Brazilian Real | R$ | "currency":"BRL" |
| NGN | Naira | ₦ | "currency":"NGN" |
| AED | UAE Dirham | د.إ | "currency":"AED" |
| SAR | Saudi Riyal | ﷼ | "currency":"SAR" |
| TRY | Turkish Lira | ₺ | "currency":"TRY" |
| JPY | Yen | ¥ | "currency":"JPY" |
| CNY | Yuan | ¥ | "currency":"CNY" |
| IDR | Rupiah | Rp | "currency":"IDR" |
| PHP | Peso | ₱ | "currency":"PHP" |
| ZAR | Rand | R | "currency":"ZAR" |
| MXN | Mexican Peso | $ | "currency":"MXN" |
| CAD | CA Dollar | $ | "currency":"CAD" |
| AUD | AU Dollar | $ | "currency":"AUD" |
The field is validated as a 3-letter ISO-4217 code (regex /^[A-Z]{3}$/i) and stored on the transaction's metadata.currency.
Per-game bet examples
Copy-paste ready JSON bodies for every endpoint. Pair with POST /api/public/v1/{game}/bet.
# Wingo — bet GREEN for 1m (USD)
{ "duration": 60, "selection_type": "color", "selection_value": "green", "stake": 10, "currency": "USD" }
# Wingo — exact number 7 (9x payout, INR)
{ "duration": 30, "selection_type": "number", "selection_value": "7", "stake": 5, "currency": "INR" }
# K3 — size BIG for 3m (PKR)
{ "duration": 180, "selection_type": "size", "selection_value": "big", "stake": 20, "currency": "PKR" }
# K3 — exact sum 11 (10x payout, EUR)
{ "duration": 60, "selection_type": "sum", "selection_value": "11", "stake": 2, "currency": "EUR" }
# 5D — SMALL for 5m (BRL)
{ "duration": 300, "selection_type": "size", "selection_value": "small", "stake": 50, "currency": "BRL" }
# TRX — color RED for 1m (AED)
{ "duration": 60, "selection_type": "color", "selection_value": "red", "stake": 12, "currency": "AED" }
# TRX — number 3 (9x, NGN)
{ "duration": 60, "selection_type": "number", "selection_value": "3", "stake": 4, "currency": "NGN" }
# Moto Racing — bike "Vortex" wins (7x, IDR)
{ "duration": 60, "selection_type": "winner", "selection_value": "Vortex","stake": 15000, "currency": "IDR" }Error reference & fixes
| HTTP | Body.error | Cause | Fix |
|---|---|---|---|
| 400 | Invalid input | Body failed schema validation | Check duration ∈ [30,60,180,300,600], selection rules per game, stake > 0. |
| 400 | selection_value must be … | Wrong value for selection_type | See Selection rules table above; e.g. K3 size = big|small. |
| 401 | Missing or malformed Authorization header | No / wrong Authorization header | Send `Authorization: Bearer <public>:<secret>`. |
| 401 | Invalid API key / API key revoked | Wrong bearer or revoked key | Regenerate from the Sandbox & Debug page. |
| 402 | Insufficient balance | Wallet balance < stake | Top up the operator's main wallet. |
| 402 | Subscription expired or account blocked | Plan lapsed or admin block | Renew subscription from console. |
| 403 | Key not authorized for API '…' | Bearer's scopes don't include this game | Generate a new key with that game's scope (or use Select All). |
| 404 | Unknown game '…' | Wrong path segment | URL must be /api/public/v1/{wingo|k3|5d|trx|moto}/bet |
| 409 | No open round for that duration | Round just locked / not started | Retry after 1-2 seconds, or use a shorter duration. |
| 422 | Main wallet not found | Operator has no main wallet | Auto-provisioned on first sign-in — re-login or contact support. |
| 500 | (varies) | DB / server failure | Retry; if persistent, open a support ticket with the request id. |
Open the Sandbox & Debug page to reproduce any of these against a sandbox bearer and see the exact request/response trace.