Status Polling
How the frontend learns about transaction status changes
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.
Ways to Receive Status
Polling
Frontend sends GET /transaction/:id/status every N seconds and updates the UI when the status changes.
WebSocket / SSE
Backend pushes an event to the frontend as soon as a webhook from PassimPay arrives. The UI updates instantly.
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.
General Flow
Player submits crypto address
Frontend shows "Awaiting payment…"
Start polling OR open WebSocket
PassimPay sends webhook to backend
confirmations=1 → PROCESSING; confirmations=2 → COMPLETED
Backend updates transaction status in DB
Frontend detects status change
via poll response OR pushed event
UI updates: "Deposit confirmed"
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.