Status Polling

How the frontend learns about transaction status changes

Phase 2
Frontend
1.

The Problem

After the player sends crypto, the frontend does not know when confirmation will arrive. Blockchain transactions take anywhere from seconds to minutes. The frontend needs some way to learn when the backend received a webhook from PassimPay and the transaction status changed.

2.

Ways to Receive Status

Polling

Frontend sends GET /transaction/:id/status every N seconds and updates the UI when the status changes.

+Simple to implement
+Works over plain HTTP
+Reliable fallback for any environment
Extra load on backend (N req/sec × active sessions)
Delay up to one poll interval

WebSocket / SSE

Backend pushes an event to the frontend as soon as a webhook from PassimPay arrives. The UI updates instantly.

+Instant update — no delay
+No unnecessary requests
+Better UX for the player
More complex to implement and maintain
Requires persistent connection (WS) or streaming (SSE)

Combo (recommended)

WebSocket or SSE as the primary channel for instant updates, plus polling every 5–10 seconds as a fallback in case the push event was lost.

+Instant when push works
+Reliable even if connection drops
+Industry standard for payment UX
Most effort to implement
3.

General Flow

01

Player submits crypto address

02

Frontend shows "Awaiting payment…"

Start polling OR open WebSocket

03

PassimPay sends webhook to backend

confirmations=1 → PROCESSING; confirmations=2 → COMPLETED

04

Backend updates transaction status in DB

05

Frontend detects status change

via poll response OR pushed event

06

UI updates: "Deposit confirmed"

4.

Implementation Notes

Recommended poll interval: 5–10 seconds. Do not poll faster than 3s — it adds unnecessary load.

Stop polling after terminal statuses: COMPLETED, FAILED, TIMED_OUT, CANCELLED.

Also stop polling if the player leaves the page — avoid orphaned requests.

WebSocket: backend emits event on webhook receipt. Frontend subscribes by transaction ID.

DEPO44 | PAYMENT MODULE | PHASE 2 | FRONTEND