SShortSingh.
Back to feed

Why Payment APIs Double-Charge Customers and How Idempotency Keys Prevent It

0
·1 views

A user who clicks an upgrade button twice during a network lag can trigger two separate card charges, creating duplicate ledger entries and corrupting billing state. The article explains that distributed web networks are unreliable, so a request can succeed on the server while the client sees a timeout and retries. It uses the Two Generals' Problem to illustrate why retries are unavoidable and cannot be treated as rare edge cases. Because HTTP POST is non-idempotent by design, repeated payment requests spawn new charges, unlike GET requests that can be safely repeated. The piece introduces idempotency keys as a way to bring retry safety to payment operations.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Self-improving agent's apparent gains were noise; author publishes null result

The author built ALMA, a governance layer for self-improving agents that proposes changes to itself under a frozen validator and pre-registered experiments. Re-measuring with larger selection panels and a recalibrated threshold showed the apparent improvements were selected noise, reversing 7 of 7 times on held-out data. Re-testing all 58 in-scope configurations found none beat the base, so the meta-loop adopted zero changes and the search was closed. The author chose to publish this as a certified null result rather than keep tuning, and plans future reviewer runs on ReviewBench with a manifest for each run to prevent cherry-picked scores.

0
ProgrammingDEV Community ·

Team splits AI coding work across four models and logs what each catches

A developer team stopped relying on a single model after its subscriptions kept hitting usage limits and the model was checking its own work. Claude now plans and reviews, Grok attacks Claude's drafts, Codex builds larger components, and a router called Tīrtha handles routine building. A ledger from Sep 25 to Oct 17 shows Grok raised 519 findings, of which 309 held up on manual re-check and 207 were absent from Claude's draft, while Codex raised 50 findings with 39 holding up. The team reports Grok reviews cost a median of about two cents each, though Codex runs are token-heavy and hit usage limits seven times in the same period. The authors acknowledge that Tīrtha's track record is only a few weeks old and that the ledger was partly graded by Claude itself, so the benefits remain unproven.

0
ProgrammingDEV Community ·

Detecting Website Tech Stacks for 500 Sites in One Run for About $2.50

A developer describes using an Apify actor called Website Tech Stack Detector to identify the technologies behind hundreds of websites, such as CMS platforms, ecommerce systems, and analytics tools. The tool sends one plain HTTP request per URL without running a browser or JavaScript, checking response headers, script sources, HTML markers, and cookie names. It recognises about 60 technologies and includes the evidence for each detection, and it respects robots.txt by default. Pricing is $0.005 per successfully fetched URL, so a 500-site batch costs roughly $2.50, with failed requests not charged. The author notes the approach is coarse, since missing detections do not prove a technology is absent and client-side rendered tools can be missed.

0
ProgrammingDEV Community ·

MedReachAI Team Closes Usability Testing and Readies Production Polish

The MedReachAI capstone team has closed its usability testing window after collecting testing kits and completing think-aloud sessions. They are now compiling survey results and synthesizing feedback into a UX research report to guide final interface changes. On the backend, the team fixed a Firebase Auth emulator issue, connected the FastAPI server to the React frontend, and plans to merge NLP feature branches after a final code review. Engineers are also removing placeholder data, wiring up unfinished buttons, and overhauling authentication state with dynamic components and logout functionality. The team says these updates aim to produce a production-ready application before graduation next month.