Trace one purchase through the merchant’s records.
A customer buys a digital report and receives access. A second message then arrives about the same invoice. The merchant needs to establish whether a new payment occurred or an old notification was delivered again. The order record should make the distinction clear enough for a support colleague to answer without granting another entitlement.
Consider a hypothetical merchant selling a report for a fixed price. Its application creates an internal order and requests a Bitcoin invoice from the payment provider. Once the configured payment checks pass, the customer receives access to the report. This article proposes developer acceptance tests; it does not claim that a particular installed integration has passed them.
Assign separate identifiers to the internal order, provider invoice, relevant payment, and fulfillment action. The order records what the customer bought. The invoice records the payment request. The payment evidence records what happened to funds. The fulfillment record identifies the access or delivery action. Their relationship should be explicit and durable.
A notification also has an identity or delivery context, but deduplicating that message alone may be insufficient. Different notifications can refer to the same invoice, and a later status may arrive after an earlier one. The application needs a rule about what the order is entitled to do, not merely a list of message identifiers it has already seen.
State the business invariant in ordinary language: one qualifying paid order may create one initial report entitlement. Repeating a notification, refreshing the browser, or retrying a worker must not create another entitlement. If the product legitimately supports multiple deliveries or replacements, define those separately with their own authority and record.
The invariant gives everyone a shared test target. The owner can understand why duplicate access is wrong, the developer can design controls around a stable order reference, and support can distinguish a resend of an existing entitlement from a second purchase. The implementation details should serve that clear business rule.
Authenticate the message and verify the relevant state.
A webhook is an automated message from one system to another. A valid signature can identify the sender of the message. The merchant still needs to check which invoice the event concerns, what state the payment reached, and whether this order has already released the report.
Authentication answers whether the message is valid for the expected channel. It does not alone answer whether this order is eligible for delivery now. The handler should verify the authoritative invoice information and its binding to the merchant order, including the expected store, amount, currency, and payment method as appropriate to the integration.
A browser redirect is a different signal. A customer returning to a success URL may have completed checkout, closed it early, or manipulated the URL. The server should read the order’s authoritative state before enabling delivery. The browser can request a status check; it should not decide that the payment succeeded by sending a boolean field.
Define how unavailable evidence is handled. If the provider cannot be reached, the integration should retain an unresolved state and retry or route review under its design. It should not convert a failed status request into a new unpaid order or assume that an authenticated event contains every fact needed for release.
Treat manual provider status changes carefully. A human may mark an invoice for a reason that requires review. The merchant’s release policy should identify what evidence is sufficient and how manual intervention is recorded. A convenient status label should not bypass the checks that protect the customer and the business from a mistaken delivery or refund.
Keep logs useful but bounded. Record internal references, event type, verification outcome, and the reason an action was held or released. Avoid storing authentication secrets, unnecessary customer details, or full sensitive request bodies. The person investigating a duplicate needs a traceable decision history, not a new repository of credentials.
Make repetition safe at the order boundary.
The important control sits where a verified paid order becomes a fulfillment action. The application should persist that transition in a way that competing handlers cannot both create the same initial entitlement. The exact database and queue design depends on the system, but the acceptance test should prove the result under concurrent delivery.
A common design uses a durable order state and a unique fulfillment reference. The handler records the eligible action once, then a worker carries it out. The design must also recover if the process stops after saving the action but before dispatching it. Otherwise, duplicate prevention can leave a paid order permanently undelivered. Repeated events find the existing action and resume its permitted recovery instead of creating another. This is a design pattern to evaluate, not a claim that adding a particular database column guarantees correctness.
External delivery creates another uncertain boundary. Suppose the application asks a provider to create an entitlement, the provider does so, and the response is lost. Blindly retrying with a fresh reference can duplicate the action. Use the external service’s supported idempotency or recovery mechanism where available, and hold uncertain attempts for reconciliation where it is not.
Distinguish retrying the same action from creating a new action. A stable idempotency key should represent the intended business operation, not a new random value on every request. Persist enough information to recover after a process restart. In-memory flags may disappear precisely when a failure makes duplicate processing most likely.
Keep payment and fulfillment states separate. The order can be paid while delivery is pending, failed or under review. Do not rewrite the payment as unpaid because an email service is unavailable. The customer needs a recovery path for the paid order, and the operations team needs to know which stage actually needs work.
For the report example, a resend should normally reference the existing entitlement or link, subject to the product’s rules. If the business approves a replacement or additional license, record it as a distinct authorized action. This keeps ordinary customer support from weakening the initial one-order, one-entitlement guarantee.
Test delayed, conflicting, and interrupted processing.
Begin with the ordinary case, then repeat the same valid event sequentially and concurrently. The expected fulfillment count remains one. Record the order state and durable fulfillment record after each test. A visual check of one browser tab is insufficient to establish what two server handlers did at the same time.
Test out-of-sequence events. An earlier processing notification may arrive after the order is already verified as paid. The application should use its defined state rules and authoritative evidence rather than blindly replacing a later state with whichever message arrived last. Ask the developer to demonstrate that a delayed event cannot reopen checkout or trigger a second release.
Test conflicting evidence. Use a validly structured event for the wrong store, wrong invoice, wrong amount, or unsupported payment method. The expected result is a held or rejected transition with no fulfillment, according to the documented design. Do not merely test a malformed signature and conclude that all binding checks are covered.
Interrupt the process at meaningful points: after payment verification but before recording the action, after recording it but before dispatch, and after the external action but before the response is saved. Restart the application and inspect recovery. These tests expose gaps that a successful uninterrupted run cannot reveal.
Test customer recovery independently. Refresh the paid page, reopen the same order and lose the browser callback. The customer should recover the existing state without being invited to pay again. If an order reference or session is invalid, the interface should explain the recovery route without treating uncertainty as proof that no order exists.
Use synthetic data or an approved test environment, and record exactly what was tested. A staging pass supports a claim about that version and configuration. Production permissions, external provider behavior, and deployment differences require their own controlled verification. The acceptance report should not compress all of those boundaries into a single statement that payments work.
| Test | Expected order position | Initial fulfillment count | Evidence |
|---|---|---|---|
| Same valid event twice | Paid; existing action reused | 1 | Stable order and action references |
| Concurrent valid events | One durable transition | 1 | Database and worker trace |
| Action saved; dispatch interrupted | Paid; existing action recovered after restart | 1 after recovery | Saved action, resumed dispatch, confirmed entitlement |
| Wrong amount or invoice binding | Held or rejected under policy | 0 | Recorded verification reason |
| Provider unavailable | Unresolved; no false success | 0 until verified | Recovery state and retry evidence |
| External delivery response lost | Paid; delivery uncertain until reconciled | No blind second action | Provider recovery or manual decision |
| Earlier event arrives late | No unsafe state reversal | 1 maximum | State transition log |
Give support a record it can act on.
When a customer says they paid but received no report, support needs to locate the order and see payment and delivery states separately. The record should show whether verification completed, whether a fulfillment action exists, and whether its outcome is confirmed or uncertain. That lets staff investigate without asking the customer to purchase again.
A duplicate notification should usually leave an auditable no-op result: the existing order and action were recognized, so no new fulfillment was created. That result is useful evidence, not an error that needs to be hidden. A genuinely conflicting event should retain its review reason and assigned owner.
Define the manual recovery procedure. Who can reconcile an uncertain delivery, confirm the provider’s result, or approve a replacement? What evidence must they inspect? How is the decision recorded? A button labeled retry can be dangerous if it always creates a new external action. Its meaning should be clear to the person using it.
Include accounting in the review. Repeated notifications must not create duplicate sales entries, receipts, or refund records. The order’s accounting reference should remain stable, while any legitimate later adjustment is recorded separately. Payment notification volume is not transaction volume and should not become the basis of a revenue total.
Keep the developer test matrix with the release evidence. Record expected and observed order state, fulfillment count, relevant logs, and unresolved cases. Repeat the affected tests when changing the provider adapter, queue, database transaction boundaries, or delivery service. A cosmetic page edit does not justify rerunning every payment test, but a changed state transition does.
The desired result is deliberately uneventful: repeated messages produce the same correct order outcome. Customers receive what they bought once, support can recover interrupted work, and the business can explain each decision from durable records. Reliability here comes from treating delivery as a controlled business action rather than a side effect of whichever notification happened to arrive.
The whole picture
The Bitcoin Lawyer take
Release the purchase once against the verified order and retain the delivery record where support staff can find it. A repeated message should lead staff back to that record, even if the first acknowledgment was lost.
Ask the developer to demonstrate the same event arriving twice, two events arriving together, and delivery failing after the payment was recorded. One order should still produce one commercial delivery and an explanation of any unresolved exception.


