Manual settlement breaks at scale. Every time a game ends, someone has to check results, match them against bets, handle edge cases (postponed, cancelled, retired), and process payouts. This guide shows you how to automate all of it.
FieldFunded’s settlement is gradual. Simple markets (1x2, Winner) resolve within 2-5 minutes of game end. Complex markets (player props, correct score) take 10-30 minutes.
async function pollSettlements() { const data = await client.getSettlements({ limit: 20 }); for (const settlement of data.settlements) { console.log( `Event ${settlement.event_id}: ${settlement.settlement_status}`, `— ${settlement.resolved_markets_count}/${settlement.total_markets_count} markets`, `(${settlement.pending_markets_count} pending)` ); // Process only when we have resolved markets if (settlement.resolved_markets_count > 0) { await processSettlement(settlement); } }}
The key is matching by market_id and selection_id — these are unique identifiers that guarantee you’re resolving the correct bet.
async function processSettlement(settlement: any) { // Get all unresolved bets for this event from your database const pendingBets = await db.query( 'SELECT * FROM bets WHERE event_id = $1 AND status = $2', [settlement.event_id, 'pending'] ); for (const bet of pendingBets) { // Use checkBet for precise resolution const result = await client.checkBet({ selections: [{ event_id: bet.event_id, market: bet.market_name, outcome: bet.outcome, odds: bet.odds, stake: bet.stake, market_id: bet.market_id, // Use IDs for 100% accuracy selection_id: bet.selection_id, }], }); const betResult = result.results[0]; if (betResult.result === 'pending') continue; // Not yet resolved await resolveBet(bet, betResult); }}
FieldFunded follows the 48-hour rule: if a game is postponed but resumes within 48 hours, bets remain active. After 48 hours, all markets are refunded.