Skip to main content

Build a Bet Settlement Engine with Automatic Market Resolution

FieldFunded’s market resolution API settles bets automatically — poll resolved markets, match by ID, pay out winners. No manual checking, no missed results. This guide builds a production-ready settlement engine in under 100 lines of TypeScript.

What You’ll Use

Architecture

Step 1: Set Up the SDK

Step 2: Poll for Settlements

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.

Step 3: Match Bets Against Resolved Markets

The key is matching by market_id and selection_id — these are unique identifiers that guarantee you’re resolving the correct bet.

Step 4: Resolve and Pay

Step 5: Handle Parlays

For parlays, use checkParlay(). The API handles void legs automatically (void leg = odds 1.0, recalculates combined odds).

Step 6: Edge Cases

Postponed Games

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.

Cancelled / Walkover

Immediate refund. The getEventResult() endpoint returns status: 'walkover' or status: 'cancelled'.

Timeout Protection

If some markets haven’t resolved after 30 minutes, they auto-refund. Your settlement loop simply picks up the refund status on the next poll.

Step 7: Run the Loop

Production Checklist

  • Use market_id + selection_id for matching (not market names)
  • Make resolution idempotent (re-processing won’t double-pay)
  • Log every resolution for audit trail
  • Handle SDK errors (RateLimitError, ServiceUnavailableError)
  • Set up alerts if settlement polling stops

Settlement API Reference

See full endpoint documentation →

Get Your Free API Key

Start building in 5 minutes — 10,000 free requests/month

See Pricing

All plans compared side by side