SShortSingh.
Back to feed

Idempotency Keys: How Retries Prevent Double Charges on Payments

0
·5 views

A payment can be charged to a card even when the response never reaches the browser, such as during a network drop or timeout. Because the interface treats a timeout as a failure, a user who clicks Pay again may be billed twice. Idempotency keys solve this by giving each payment attempt a unique ID that the backend uses to recognize repeat requests and return the saved result instead of charging again. The interface generates the key once, stores it in session storage, and resends it on every retry, while the backend records each key and its outcome. The guide also recommends disabling the Pay button during processing and loading the amount on the server rather than trusting the browser.

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 ·

Python Decorators Explained: How Functions Wrap Other Functions

A beginner-focused guide breaks down Python decorators, a feature often seen as confusing at first. It shows how repeated logging code across functions can be replaced by a decorator that wraps each function. The article explains that the @ symbol is shorthand for passing a function into a decorator and reassigning the result. It also covers how *args and **kwargs let a decorator work with any function, and lists common uses such as logging, timing, caching, authentication, and retry logic.

0
ProgrammingDEV Community ·

Scanner Probed a Site for 400 Secret Files in One Minute; None Were Exposed

A single client sent about 1,180 requests to a domain in one minute, requesting roughly 400 sensitive file paths such as environment files, WordPress configs, and cloud credentials. The client identified itself as tlm-scanner/2.0, and the site returned no sensitive files, with only the home page and redirects or refusals for the rest. Shortly afterward, a slower sweep disguised with browser user agents targeted a subdomain and included a path tied to AI provider keys. The author argues that such scans are routine and that site owners should check their own logs, since successful probes often go unnoticed.

0
ProgrammingDEV Community ·

AI Student Launches Personal Developer Portfolio Showcasing Projects and Interests

A student studying AI and Data Science has launched a personal developer portfolio to consolidate their work in one place. Rather than just listing languages and frameworks, the site is meant to reflect their learning journey and the projects they are building. The creator also used the project as a way to experiment with presenting technical work through a polished web experience. Their next focus is Generative AI, LLM-powered applications, and AI agents, with plans to turn ideas into practical projects. They have invited other developers working on AI engineering to connect and share their work.

0
ProgrammingHacker News ·

Wild boar and deer in the Netherlands adapt their behavior to the return of wolves

Wildlife cameras in the Netherlands have recorded wild boar and deer changing their habits in response to the presence of wolves. The footage suggests the animals are adjusting instinctively to the returning predator. The report is based on a video published by Dutch broadcaster NOS. Details beyond the observed behavioral changes are limited in the available source material.