KeldroveOpen dashboard
Keldrove / Developer guide

Payment idempotency keys for invoice retries

A crypto checkout needs an idempotency key when a store retries invoice creation after losing the first response. The same purchase attempt should recover the same invoice, whether the buyer selected USDC, Bitcoin or Monero. Keldrove’s proposed contract separates this safeguard from duplicate webhook handling and fulfillment.

By the Published · Updated

A response goes missing after the invoice exists

A shop sells a pair of notebooks for $48. It persists order FW-1048 and sends an invoice request. The gateway accepts the request and creates the invoice. Before the response reaches the shop, the connection closes. The store knows the buyer still needs payment instructions, but it cannot tell from the timeout whether the first request succeeded.

Issuing another unrelated request could leave two payable quotes for one basket.

The safe repeat operation starts with a value the store saved before the first request. That value names this attempt to collect payment for FW-1048. Sending the same request under the same key gives the gateway the information it needs to recover the existing result. This is especially important when an invoice reserves capacity under a volume limit or allocates a unique receiving address. A duplicate can consume both resources even if the buyer pays only once.

Persist the purchase attempt before making the request

Create a durable attempt record containing the merchant’s store ID, order reference, currency, decimal price, selected asset and network. Assign it a unique idempotency key and commit those fields together. When a browser refreshes or a worker restarts, read the attempt record.

Generating a fresh key per network call defeats the purpose because each transmission would appear to be a separate business action.

Keep the key independent of a buyer’s personal details. A random identifier, stored with the attempt, is easier to manage than a value derived from an email address. A store that uses the same order number across two shops needs to scope it by store. A retry worker should also know which environment created the attempt. Tests and live invoice attempts have different credentials and must never share an operation record.

What should the second request contain?

Use the original key and send the same commercial payload. Preserve decimal values as strings where the API specifies them. If the first request asked for USDC on Ethereum, a subsequent request for USDT on Tron is a different choice even if the merchandise is still $48.

The proposed contract returns a conflict when the same key is attached to changed parameters. A conflict needs an investigation or an explicitly new attempt.

Order          FW-1048
Attempt        A1
Requested      USD 48.00 / USDC / Ethereum
Request 1      key A1 → invoice created, response lost
Request 2      key A1 + original payload → original invoice
Changed asset  key A1 + new payload → conflict

Once the original invoice is retrieved, inspect its status and expiry. If the buyer returns to the shop after the quote expired, the old invoice can explain what happened but may no longer be payable. Use a new attempt with an explicit link to the previous one when the business rules permit issuing a replacement. Keep earlier references for a payment that might still arrive late.

Protect against simultaneous requests

Two browser tabs can submit the same order before either sees a response. Store-side uniqueness on the active purchase attempt prevents two independent checkout handlers from inventing different attempts. The gateway should also enforce atomic uniqueness for the idempotency scope.

A lookup followed later by an unprotected insert has a race in which both requests see an empty result and both create an invoice.

Treat invoice creation and the associated capacity reservation as a single durable outcome. If a process exits halfway through, the recovery path has to decide what happened to each part. A test should exercise a worker stopping immediately after the invoice record is written. The expected result is one recoverable invoice, one reserved amount and a stable relation to the merchant order. Reconciliation should reveal any mismatch before another payable quote is exposed.

Handle webhook retries at a different boundary

An invoice key suppresses duplicate invoice creation. A webhook delivery has its own event identifier because several legitimate events can belong to one invoice. A receiver can verify the signature, persist the event ID once, and then read the current invoice.

A later event with a new ID and a higher revision may carry new information about that same sale. Dropping every event after the first one would miss legitimate status changes.

A fulfillment worker should additionally record delivery against the store order. Consider two independently processed notifications reporting the same confirmed invoice. Both may be valid. Only one should issue a digital license or release a parcel. Recording the fulfillment decision before acknowledging work and making parcel or license creation recoverable prevents a retry from delivering the order twice. Include support for manual review when a confirmed payment is later affected by a chain reorganization.

What should the release test demonstrate?

Run a short exercise with a local fixture and record the observable result. Interrupt the connection after invoice creation, replay the original payload, then send a separate request with the same key and a changed amount. Check the returned identity and verify that only one valid invoice exists.

Repeat with two simultaneous clients, then expire the original invoice and request a replacement. Document whether a late payment to the former invoice reaches review.

Read the provider’s published rules for how long keys are retained and which errors can be recovered. For instance, Walley’s idempotent requests reference describes a provider-specific key header and retention window. The Keldrove design has no published production retention guarantee. A merchant should keep its own durable order-to-invoice mapping even after any provider-side retry window has elapsed.

Questions merchants ask

Can one key identify every renewal for a subscription?

Give each authorized collection period its own business attempt. A retry of that period should reuse its key. A new period should be distinguishable from the prior one.

Does a checkout retry send another transfer from the wallet?

The proposed creation request only asks for an invoice. The buyer authorizes an on-chain transfer separately. The store should still avoid presenting several payable invoices for the same purchase.

Merchant terms at a glance
Subscription currencies
BTC, LTC, ETH, SOL, USDC on Ethereum, USDT on Ethereum or Tron, and Monero (XMR).
Account
Register with an email and password or a private account code. No identity document is requested.
Price on 2026-11-27
$25 for Starter per 30 days. Keldrove charges only the subscription, with 0% transaction fees on every plan. The subscription funding minimum is $25. Customer invoices have separate network limits.
Activation
Create an order at checkout. Activation follows payment verification.
Compare three published gateway fee models
Provider pricing checked November 27, 2026, excluding network costs
ProviderService fee basis
CryptAPI1% in the entry volume band.
BitPay2% plus 25¢ per transaction under $500,000 monthly volume. Higher-risk industries may pay more.
BTCPay Server0% software processing fee. Operating or renting a server carries separate costs.