{
  "id": 7969847,
  "title": "Two Webhooks, One Rank: Race-Safe Payments with Postgres Advisory Locks",
  "url": "https://urgent.news/2026/09/17/two-webhooks-one-rank-race-safe-payments-with-postgres-advisory-locks",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-17T06:31:07.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/pr0biex/two-webhooks-one-rank-race-safe-payments-with-postgres-advisory-locks-4n4e"
  },
  "original_language": "en",
  "account": "Two webhooks ensure race-safe payments using Postgres advisory locks. Payment webhooks may be retried, causing double applications and incorrect rankings. Steal the Spot, a pay-to-rank leaderboard, uses Supabase Postgres and Dodo webhooks to maintain a correct board. Three components are involved: serializing with an advisory lock, making the webhook idempotent, and locking rows to compute rank. Advisory locks prevent stale snapshots and auto-release on commit or rollback. A service-role key executes the function, preventing client manipulation of ranks. The pattern successfully protects stealthespot.lol, a free ranking platform where users pay to climb.",
  "summary": "Two Webhooks, One Rank: Race-Safe Payments with Postgres Advisory Locks Payment webhooks get retried. Users double-click. Two rivals outbid each other in the same second. If your \"apply payment\" path isn't concurrency-safe, you get double-applied bids, phantom ranks, and money that doesn't match the leaderboard. I run Steal the Spot — a pay-to-rank leaderboard where every bid is money and every…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}