Developer documentation

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.

1. Generate a key
Console → API Keys → select games + currency → bearer issued.
2. Download a kit
Pick PHP or Node.js. Bearer, base URL & currency are pre-filled.
3. Upload & go
PHP: drop into htdocs. Node: `npm install && npm start`. Done.

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 lock

Selection rules & payouts

Gameselection_typeselection_valuePayout
wingocolor / number / sizered·green·violet · 0-9 · big·small2x · 9x · 2x (1.5x on violet hit)
k3size / parity / sumbig·small · odd·even · 3-182x · 2x · 10x
5dsizebig·small2x
trxcolor / size / numberred·green·violet · big·small · 0-92x · 2x · 9x (violet 4.5x)
motowinner8 racers7x

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.

CodeCurrencySymbolExample body
USDUS Dollar$"currency":"USD"
EUREuro"currency":"EUR"
GBPPound£"currency":"GBP"
INRIndian Rupee"currency":"INR"
PKRPakistani Rupee"currency":"PKR"
BRLBrazilian RealR$"currency":"BRL"
NGNNaira"currency":"NGN"
AEDUAE Dirhamد.إ"currency":"AED"
SARSaudi Riyal"currency":"SAR"
TRYTurkish Lira"currency":"TRY"
JPYYen¥"currency":"JPY"
CNYYuan¥"currency":"CNY"
IDRRupiahRp"currency":"IDR"
PHPPeso"currency":"PHP"
ZARRandR"currency":"ZAR"
MXNMexican Peso$"currency":"MXN"
CADCA Dollar$"currency":"CAD"
AUDAU 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

HTTPBody.errorCauseFix
400Invalid inputBody failed schema validationCheck duration ∈ [30,60,180,300,600], selection rules per game, stake > 0.
400selection_value must be …Wrong value for selection_typeSee Selection rules table above; e.g. K3 size = big|small.
401Missing or malformed Authorization headerNo / wrong Authorization headerSend `Authorization: Bearer <public>:<secret>`.
401Invalid API key / API key revokedWrong bearer or revoked keyRegenerate from the Sandbox & Debug page.
402Insufficient balanceWallet balance < stakeTop up the operator's main wallet.
402Subscription expired or account blockedPlan lapsed or admin blockRenew subscription from console.
403Key not authorized for API '…'Bearer's scopes don't include this gameGenerate a new key with that game's scope (or use Select All).
404Unknown game '…'Wrong path segmentURL must be /api/public/v1/{wingo|k3|5d|trx|moto}/bet
409No open round for that durationRound just locked / not startedRetry after 1-2 seconds, or use a shorter duration.
422Main wallet not foundOperator has no main walletAuto-provisioned on first sign-in — re-login or contact support.
500(varies)DB / server failureRetry; 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.

SDKs & tooling

PHP kit (.zip)
Auto-generated from console with bearer + currency pre-filled.
Node.js kit (.zip)
Express server + static frontend, plug-and-play.
OpenAPI spec
Served live at /api/public/openapi — import into Postman/Insomnia.
Playground
Try every endpoint in-browser with your live bearer.