Documentation / Game Flow

API Game Flow

เส้นทางครบตั้งแต่ตรวจ player และ launch เกม ไปจนถึง bets, wins, game rounds, rollbacks และ financial reconciliation

Game API integration
Session
player และ game launch
Balance
bets และ wins
Rounds
game session flow
Rollback
operation recovery
Game lifecycle

จาก launch จนปิด round

01
สร้าง game session

Player, game, currency, language, country, mode และ return URL

02
Launch เกม

Temporary access key, launch URL และ game availability check

03
ประมวลผล financial operations

Balance check, bet, win, combined operation และ platform responses

04
ปิดและ reconcile round

Final result, rollbacks, financial ledger และ provider report

ภาพรวม

Game API เชื่อม player, round และ fund movement

Game launch และ fund movement เป็นคนละส่วนของ flow เดียวกัน Session ระบุ player และ launch conditions, round เชื่อม provider actions และ platform API ยืนยัน debit, credit และ rollback ทุกครั้ง

Game session data

Player, brand, game, currency, country, language, mode, jurisdiction และ access expiry

Balance control

Platform ตรวจ available funds และใช้แต่ละ bet, payout หรือ rollback เพียงครั้งเดียว

Game financial ledger

Operation ID, round ID, operation type, amount และ balance ก่อน/หลัง ถูกเก็บไว้เพื่อ control และ reconciliation

Game launch

Typical game launch flow

Platform ตรวจ player และ game availability ก่อน จากนั้นสร้าง time-limited session และรับ launch URL จาก provider

01

ตรวจ player และ game availability

Platform ตรวจ account status, currency, country, restrictions, limits, real/demo mode และ game availability

02

สร้าง internal session

สร้าง session ID พร้อมข้อมูล player, game, brand, currency, language, IP และ expiry

03

รับ game launch URL

Provider รับ session key, notification/return URLs, device type, jurisdiction และ interface parameters

04

เปิดเกมใน browser

Player เปิด URL ที่ได้รับ จากนั้น financial operations ทำแบบ server-to-server โดยตรง

Balance operations

Balance operations หลัก

ชื่อ methods ของแต่ละ provider อาจต่างกัน แต่ logic เหมือนกัน: balance check, bet debit, win credit และ rollback ของ operation ที่ยืนยันแล้ว

Balance check

คืน available player balance ใน currency ของ active session โดยไม่เปลี่ยน financial ledger

Bet debit

ตรวจ player, session, currency และ available funds แล้วหัก bet ที่ยืนยันเพียงครั้งเดียว

Win credit

เครดิต win ด้วย unique operation ID และ round ID รวมถึง zero-result

Bet และ result ใน request เดียว

ใช้ bet และ game result พร้อมกันเมื่อ provider รองรับ flow นี้

Rollback operation

สร้าง corrective operation แยกสำหรับ bet หรือ payout ที่ยืนยันก่อนหน้า โดยไม่ลบ original record

Bonuses และ Free Spins

ส่ง bonus campaign และ game round data โดยแยก real money และ bonus funds

Currency และ amount precision

ทุก operation ตรวจ currency, amount units, decimal places และ rounding rules

Platform response

คืน operation status, internal ID, current balance และ unified error code

Round lifecycle

Game round lifecycle

หนึ่ง round อาจมีหลาย bets และ results สถานะของ round ขึ้นอยู่กับ game rules ไม่ใช่แค่ลำดับ network requests

Round created

Platform ได้ round ID ครั้งแรกและสร้าง internal record

Round active

Round อาจมี additional bets, game actions และ intermediate wins

Bet accepted

Platform ยืนยัน debit และเชื่อมกับ unique provider operation ID

Result received

ได้รับ win หรือ zero result แต่ round อาจยังเปิดอยู่ตาม game rules

Round closed

Provider ยืนยันว่า round เสร็จและ expected financial operations ทั้งหมดถูกประมวลผลแล้ว

Operations rolled back

หนึ่งหรือหลาย operations ถูกแก้ไขโดยยังเก็บ original history ครบถ้วน

หนึ่ง round อาจมีหลาย operations

Round ID ไม่ควรเป็น duplicate-protection key เพียงตัวเดียว แต่ละ bet, payout และ rollback ต้องมี unique ID ของตัวเอง

Reliability และ reconciliation

Duplicate protection และ financial reconciliation

Game API ต้องจัดการ repeated requests, response delays, out-of-order operations และ provider recovery หลัง failure อย่างปลอดภัย

Safe idempotent processing

Provider operation ID ต้อง unique สำหรับแต่ละ financial action type
Repeated request คืน original result และ current balance โดยไม่ขยับเงินซ้ำ
Retry ด้วย amount, currency หรือ player ต่างกัน ต้องถูกปฏิเสธเป็น data conflict
Rollback อ้างถึง original operation ที่เจาะจงและมี unique ID ของตัวเอง

Round ledger และ reconciliation

เก็บ session ID, round ID, provider operation ID และ platform operation ID
บันทึก operation type, amount, currency, balance ก่อน/หลัง และ processing time
อย่าแก้ posted records แต่ให้สร้าง corrective operation แยก
Reconcile provider reports, game rounds, balance movements, GGR และ discrepancies ที่พบ
Testing

สิ่งที่ต้องทดสอบใน test environment

Testing ต้องครอบคลุม game launch, player restrictions, insufficient balance, repeated operations, response delays, rollbacks และ closed-round reconciliation

Launch และ game session

Real/demo modes, wrong currency, blocked country, expired access และ unavailable game

Balance และ bet decline

Insufficient funds, blocked player, currency mismatch และ limit exceeded

Delay และ unknown result

Provider ไม่ได้รับ response หลัง debit เกิดขึ้นจริง และ resend operation ด้วย ID เดิม

Repeated bets และ wins

ID เดิมเข้ามาก่อนหรือหลัง processing เสร็จ รวมถึงกรณี parameters ขัดแย้ง

Operation rollbacks

Bet rollback, win rollback, repeated rollback และ reference ไปยัง unknown original operation

Round reconciliation

Bet, win และ rollback amounts, final status, balance movement และ provider report ต้องตรงกัน

Checklist ก่อน launch

Launch หลังตรวจ game sessions, balance operations, duplicate protection, rollbacks และ reporting แล้ว

Test และ production ใช้ access, API endpoints และ launch settings ต่างกัน
Game session key มีเวลาจำกัดและผูกกับ player, game, currency และ brand
ทุก balance operation ป้องกันด้วย unique provider ID
Repeated bets, wins และ rollbacks ไม่เปลี่ยน balance ซ้ำ
Posted records ไม่ถูกลบ และแก้ด้วย corrective operations แยก
ตั้ง event logs, notifications, provider reports และ round reconciliation process แล้ว

ต้องการตั้งค่า API Game Flow ไหม

ส่ง provider documentation, รายการ balance operations, game round model, currencies และ reporting requirements มาให้ APIACE จะช่วยวาง game launch, bets, wins, rollbacks และ financial reconciliation