Stop One Payment Update From Changing Your App Twice
Payment services sometimes send the same update again. Learn how your app can recognize the repeat and make only one customer-facing change.
before you start
One payment should create one order, one receipt, and one access change, even when the same update arrives again.
Understand why the same update can arrive twice
in plain words
An outside service may repeat an update when it is unsure whether your app received the first copy.
Imagine that a customer pays once. A few seconds later, your app receives the same payment update again. The payment service still shows one charge, but your app might create two orders, send two receipts, add store credit twice, or grant two months of paid access. The repeat does not necessarily mean anything is broken. It often means the payment service did not receive a clear confirmation from your app and is trying again so the original update is not lost.
An automatic message sent from one service to another after something happens is what developers call a webhook. Payment completion, subscription changes, refunds, and delivery updates are common examples. Repeated delivery is normal because networks can be slow or briefly unavailable. Your app therefore must not assume that every arriving webhook describes a new event. The useful rule is simple: one real payment or account change should produce one intended result, even if its message arrives several times.
- ▸Review updates that can create orders, issue refunds, change credits, send email, or unlock paid access.
- ▸Treat a repeated delivery as expected behavior, not as proof that the payment service failed.
common risk
A customer buys one month of access, but two matching deliveries make the app grant two months and send two receipts.
what to do now
Write down every outside service that sends updates to your app and the exact customer-facing change caused by each update.
ask your AI
Review my app without changing it. Find every place that receives a webhook, which means an automatic update from another service. Create a table with the sending service, event type, customer-facing action, unique event reference, and what could happen if the same update arrives twice. Do not contact outside services, reveal payment keys, or read or change live customer records.
Give each update a one-time receipt
in plain words
Save the update’s unique reference and check it before changing an order, balance, email, or access level.
Think of the service’s event reference as the number on a receipt. When an update arrives, the app first asks, “Have I already accepted this receipt?” If the answer is yes, it confirms receipt without sending another email or changing anything again. If the answer is no, it records the reference and performs the intended work. The technical name for making repeated requests leave the same final result is idempotency. It is the main protection against accidental duplicate actions.
The organized storage used by an app is what developers call a database. Store the service name, its unique event reference, the processing status, and useful times in that database. Add a uniqueness rule covering the service and reference together. This matters because two copies can arrive almost simultaneously: both might check before either has finished saving. The database rule allows only one copy to claim the work. Use the reference supplied by the service, not a customer email, current time, or reference invented by a visitor’s browser.
- ▸Record statuses such as processing, completed, and failed so an interrupted attempt can be understood safely.
- ▸Plan the important change and its receipt together so a failure does not leave unclear or repeated work.
common risk
Two matching refund updates arrive together. Both see no earlier receipt and both issue a refund unless the storage rule rejects the second claim.
what to do now
Ask your AI builder or developer to propose a processed-events record with one unique service-and-event-reference rule.
ask your AI
Design idempotency for every webhook that changes money, orders, credits, email, or customer access. Use the sending service’s unique event reference, a database uniqueness rule covering the service and reference, and processing, completed, and failed statuses. Explain how an interrupted attempt can safely continue. Show the proposed records, steps, and pseudocode only. Do not run changes, contact services, use live data, or display payment keys or storage passwords.
Reject copied or outdated messages
in plain words
Confirm who sent an update and when it was sent before allowing it to change money, access, or customer information.
Avoiding duplicates solves only part of the problem. Your app must also confirm that the message really came from the named service and was not altered. Many services attach a proof calculated from the message and a signing key shared with the protected part of your app. Developers call that proof a digital signature. The protected part is the app process visitors cannot download. Keep its signing key there, never in public settings, screenshots, logs, or browser-delivered files.
The service usually includes the time when it created the message. Developers call this value a timestamp. The app should verify the digital signature using the original, unchanged message and apply the service’s documented acceptable time window. The technical name for refusing an old valid message when someone submits it again is replay protection. It works alongside idempotency: signature and time checks help reject an untrusted or stale copy, while the stored event reference prevents a trusted repeated delivery from repeating its effect.
- ▸Use the service’s official verification method and its documented time allowance instead of inventing your own.
- ▸Never print the signing key while diagnosing a failed verification.
common risk
An old but once-valid payment-completed message is submitted months later and restores paid access because the app checks neither its time nor its stored event reference.
what to do now
Confirm that every receiving process checks the original message, its digital signature, its creation time, and its unique event reference before making changes.
ask your AI
Inspect my existing webhook verification without running or changing it. For each receiving process, report whether it verifies the provider’s digital signature from the original unchanged message, applies the provider’s documented timestamp allowance, and checks the stored unique event reference before changing money, access, orders, email, or customer information. Propose precise code changes, but do not reveal, print, copy, or move any signing key, payment key, password, or live customer record.
Prove that a repeat changes nothing twice
in plain words
Use fictional accounts and test payment settings to confirm that two matching updates create only one result.
Create a separate test setup with fictional customers, test products, test payment settings, and separate storage. Ask the payment service’s testing feature to deliver the same approved event twice. If that feature is unavailable, have your AI builder or developer use a prepared fictional message created for testing. Check the actual results, not only the success message: there should be one order, one receipt, one credit adjustment, and one access change. Repeat the test with two deliveries sent close together.
Also test an interruption after the event reference is recorded but before the customer-facing work finishes. A later attempt should complete unfinished work without repeating completed work. Keep a short record of the test, expected result, observed result, and date. Run it again after changing payments, subscriptions, refunds, order creation, email delivery, or access rules. Use no live payment keys or real customer information. Passing this test shows what happened in that test setup; it does not prove that every part of the app is safe.
VibeCodeWall’s free public check can look for risks exposed through the public app, but it cannot see the private instructions that make the app work, which developers call source code, or prove this message-handling logic is correct. Ongoing Pro monitoring is separate: it must be activated and uses the technologies and versions actually listed in its inventory. If that inventory is incomplete, monitoring coverage is limited. This monitoring complements your duplicate-delivery tests; it does not replace them or repair the app automatically.
- ▸Verify orders, access levels, credit balances, email records, and the payment service’s test dashboard after each run.
- ▸Save evidence from the separate test setup without including payment keys, passwords, or real customer information.
common risk
A test checks only that the app reports success, while two receipts, two credit changes, and two access updates remain unnoticed.
what to do now
Run one duplicate-delivery test in the separate setup now, then repeat it whenever the related payment or account flow changes.
ask your AI
Create a step-by-step test plan for a separate test setup. Send the same fictional webhook event twice, including a test where both copies arrive almost together and a test with a temporary interruption. Verify that orders, refunds, customer access, credits, and emails each change no more than once and that unfinished work can continue safely. Use only fictional accounts, test payment settings, and separate test storage. Do not access or change live data, contact real customers, or use live payment keys.
Quick checklist
- 01List every outside-service update that changes money, orders, access, email, credits, or customer information.
- 02Identify the unique reference number supplied with each update.
- 03Record that reference before making an important customer-facing change.
- 04Make a repeated update finish successfully without repeating the change.
- 05Add a storage rule that rejects the same service and reference number twice.
- 06Test two identical deliveries with fictional accounts and test payment settings.
- 07Test recovery after an interruption without using live customer records.
- 08Keep payment keys, signing keys, and storage passwords out of files visitors can download.
FAQ
Does a repeated payment message mean the payment service is broken?
Usually not. Services repeat deliveries when a response is delayed, lost, or unclear. Your app should be designed to accept that repeat without repeating the customer-facing result.
Can the customer’s email identify a repeated event?
No. One customer can make several valid purchases. Use the unique event reference supplied by the sending service for that specific update.
Is checking the sender’s digital signature enough?
No. That check helps confirm where the message came from and whether it changed. You still need idempotency so a trusted repeated delivery cannot repeat the action.
Where should payment updates be processed?
Use the protected app process that visitors cannot download. That keeps signing keys, payment keys, storage passwords, and one-time receipt rules away from browser-delivered files.