inflearn logo

Preventing Duplicate Charges: Learning Safe Payment Design Through Hands-On Exercises in Idempotency, Retries, and Webhooks

A payment button lock alone can’t prevent incidents where a card gets charged twice just because someone taps the button twice quickly or resends after a slow response. In a small online bookstore payment app, we’ll reproduce duplicate charges firsthand, then add server code, database constraints, idempotency keys, retry rules, webhook verification, an outbox and reconciliation process, and operational monitoring, step by step, preventing them through hands-on exercises in all 36 lessons across 7 parts.

4 learners are taking this course

Level Basic

Course period Unlimited

Node.js
Node.js
SQL
SQL
Node.js
Node.js
SQL
SQL

What you will gain after the course

  • You can trace the flow of order, payment, and webhook requests behind a single payment button through logs and database tables, and reproduce five types of duplicate incidents firsthand: double-clicks, automatic retries, timeouts, duplicate webhooks, and rerunning jobs. (Part 1)

  • You can establish the basic safeguards for payments with order status transition rules, server-side amount recalculation, inventory and coupon reservations at the time of ordering, partial cancellations, and validation of payment window return URLs. (Part 2)

  • You can move idempotency keys from memory to a database table, add locks during processing and request fingerprint validation, and clean up stale keys so that even if the same request comes in multiple times, the payment is processed only once. (Part 3)

  • Treat timeouts as an “unknown outcome” rather than a failure, and implement a flow that confirms the result through backoff and jitter retries, error classification, and payment status checks. Also test how much locking the UI button actually prevents. (Part 4)

  • You can validate webhook signatures and timestamps, filter out duplicates by event number, and use reconciliation to make up for out-of-order or missing webhooks. (Part 5)

  • We can work through the discrepancy where payment succeeds but no order is created using attempt logs and outbox patterns, and explore consumer-side deduplication, automatic refund compensation, daily reconciliation, and a comparison of database locks and distributed locks. (Part 6)

  • You can complete a payment app that creates append-only audit logs and duplicate-payment detection alerts, finds and fixes hidden bugs through random fault injection, and passes all 14 checklist tests. (Part 7)

Recommended for
these people

Who is this course right for?

  • For anyone who has built a service with AI tools and added—or is trying to add—payments, and is worried about duplicate charges or payments with an unknown outcome.

  • For anyone who thought locking just the payment button would be enough, then felt stuck when faced with refreshes, two tabs, and automatic retries

  • A backend beginner who has heard terms like idempotency keys, webhooks, and outbox, but wants to see in code where and how they’re actually applied.

  • For those who want to learn through hands-on practice rather than conceptual explanations—reproducing an incident themselves, fixing it, and running it again to check whether it’s been prevented.

Need to know before starting?

  • It’s enough if you can roughly follow the flow of short code snippets (Node.js or SQL). It’s okay if you can’t write them on your own from scratch yet.

  • You need Docker Desktop on your computer. It starts the bookstore app, database, and fake payment server all at once. Lessons 1, 21, and 36, where you click browser buttons directly, also use Python 3, Playwright, and Chrome.

Hello
This is haeyeomiso

724

Learners

26

Reviews

42

Answers

4.7

Rating

22

Courses

Nice to meet you!

I am Haeyeo, someone who explores the infinite possibilities of AI and computer science and wishes to share that journey with all of you.

During my undergraduate years, my passion for my major was so intense that I was nicknamed a 'Computer Science Addict.' I graduated at the top of my class with a major GPA of over 4.4. I then earned my Master's degree in AI from Seoul National University and further deepened my expertise through a doctoral program.

However, as I felt as much of a fascination for solving real-world problems with AI as I did for theoretical exploration, I took a break from my doctoral studies to gain valuable hands-on experience by working on AI-based LLM and video analysis projects at a startup.

Currently, I am working as an LLM project developer and PM at one of the top three conglomerates in Korea, contributing to creating positive changes that AI technology will bring to our lives. I will generously share with you the challenges I faced, the problem-solving processes I went through, and the vivid know-how I gained in the field. I will be your reliable guide on this journey into the exciting world of AI.

Inquiries and Proposals: haeyeo.open@gmail.com

More

Curriculum

All

36 lectures ∙ (6hr 27min)

Published: 
Last updated: 

Reviews

Not enough reviews.
Please write a valuable review that helps everyone!

haeyeomiso's other courses

Check out other courses by the instructor!

Similar courses

Explore other courses in the same field!

Limited time deal

$409,819.00

59%

$38.50