MoonPay webhooks in production: duplicates, ordering, retries and timeouts

Published · Updated

This guide covers the problems MoonPay webhooks cause in production and how to handle each one. How deliveries work is on the MoonPay webhooks overview, every event is listed on MoonPay webhook events, and checking the signature is on Verify MoonPay webhooks.

At a glance

ProblemWhat to doWith Event Gateway
TimeoutsReturn a 2xx within 5 seconds; process in a background jobAccepts each event at once, then queues it for your service
DuplicatesDeduplicate on webhook-id, or on type, data.id and data.updatedAtDrops repeats you define before they reach your handler
OrderingCompare updatedAt with your stored stateLogs every request and attempt, so you can see arrival order
RetriesReconcile from MoonPay's API after any outageAccepts events during your outage, then retries on your schedule
Choosing eventsMatch events to your integration; surface requotes in-appFilters out event types a destination doesn't need
TestingUse test mode, and forward to your machineForwards requests to localhost
Other limitsCheck one Platform delivery; allow the IPv4 addressesKeeps the headers and body of every request

MoonPay webhook timeouts and slow handlers

Return a 2xx within 5 seconds and do the work afterwards, because MoonPay counts anything else as a failed delivery.

Why it happens: A non-2xx response, a timeout or a connection error all count as failures. A handler that updates balances or calls MoonPay's API before responding can run out of time even though the work succeeds, and the event is then sent again.

Fix it in your handler:

  1. Verify the signature, store the event and return 200.
  2. Do the work from a queue. See why to process webhooks asynchronously.
  3. Make the slow path safe to repeat, since a delivery that timed out will come back.

With Event Gateway: Hookdeck accepts each MoonPay event as it arrives, then queues it and delivers it at a rate your service can handle, so your handler doesn't have to finish inside MoonPay's 5 seconds.

Duplicate MoonPay webhooks

MoonPay delivers at least once, so the same event can arrive twice. Deduplicate before you act on it, because these events move money.

Why it happens: A delivery that fails on MoonPay's side, even after your handler did the work, is retried. MoonPay says duplicates can occur and that a repeat must not change the result of the first delivery.

Fix it in your handler:

  1. For Platform events, key on the webhook-id header, which stays the same on every redelivery. On the KYC event it matches the body's id.
  2. For widget transactions, follow MoonPay's suggestion: key on type, plus data.id and data.updatedAt.
  3. For virtual account events, MoonPay suggests no key. They carry their fields in body, with no id or updatedAt, so the closest you can get is type, the account or transaction ID, status and timestamp.

See our guide to webhook idempotency.

With Event Gateway: Hookdeck can deduplicate on a header such as webhook-id or on the body fields you choose, before events reach your endpoint.

Out-of-order MoonPay webhooks

MoonPay events can arrive out of order, so use the timestamp in the payload to decide which is newer.

Why it happens: A failed delivery waits for its retry while newer events go out, so an earlier pending update can arrive after completed. MoonPay says this is especially likely when retries are involved.

Fix it in your handler:

  1. Store each transaction's latest updatedAt and status, and ignore anything older.
  2. On the Platform KYC event, compare timestamp, as MoonPay says to. On virtual account events, compare timestamp, which is in Unix milliseconds.

With Event Gateway: Hookdeck logs every request and delivery attempt, so when state looks wrong you can see the order events arrived in and replay them.

MoonPay webhook retries and what happens after them

MoonPay stops after 10 attempts and doesn't redeliver the event, so a short outage can lose events for good.

Why it happens: MoonPay retries a failed delivery up to 9 times, with exponential backoff that starts at 1 second and roughly doubles. If every delay doubled exactly, the last retry would come about 8.5 minutes after the first failure. That's our arithmetic, as MoonPay doesn't state a total. It also documents no manual resend and doesn't mention disabling an endpoint.

Fix it in your handler:

  1. Keep the endpoint highly available, and watch your error rate, because a deploy that fails for ten minutes can outlast the schedule.
  2. After any outage, reconcile from MoonPay's API. Widget integrations can use Get Buy transaction and Get Sell transaction, and Platform integrations can use Get a transaction.
  3. Record externalTransactionId when you create transactions, so you can look them up without MoonPay's IDs.

With Event Gateway: Hookdeck accepts each MoonPay event as it arrives, so MoonPay's schedule only has to cover the short path to Hookdeck. Hookdeck then retries delivery to your service on your own schedule, and you can replay any event.

Choosing MoonPay webhook events

Subscribe per endpoint to the events your integration sends, and always handle requotes if you use the off-ramp.

Why it happens: Each setting receives all event types or the ones you pick, and the two integrations use different names for the same idea. The list in the dashboard can also include types that don't apply to you.

Fix it in your handler:

  1. Use identity_check_updated for KYC changes in a widget integration, and customer.identity_status_updated on the Platform API.
  2. Leave swap_* types unselected on widget accounts. MoonPay says they never fire there.
  3. Handle sell_transaction_requote_required in your product. The customer can accept or decline a new price, and data.quoteExpiresAt says when that quote ends. MoonPay's own guide recommends an in-app prompt, because email alone is easy to miss.
  4. Route *_failed events separately. data.failureReason is set when a transaction fails, and data.stages is only sent on transaction_created and transaction_failed.

With Event Gateway: Hookdeck filters can drop the event types a destination doesn't need and route the rest, so one webhook URL can feed several services.

Testing MoonPay webhooks

Build against test mode first. MoonPay keeps test and live webhook settings separate, so you can give the test setting its own URL.

Why it's awkward: MoonPay publishes schemas but no complete example body, and it documents no button that sends a test event. Its widget docs suggest a simulated POST from Postman or curl, and that request won't carry a valid signature unless you compute one yourself.

Test your handler:

  1. Create a test mode setting and run a real test transaction, or trigger a test requote for the off-ramp flow.
  2. Save the first real delivery of each event you handle and use it as a fixture, because the shapes differ by event.
  3. Accept a body with no type. MoonPay's Platform OpenAPI file describes a test webhook that carries only eventTime, though it doesn't say how to trigger one.
  4. Test a failure by returning a 500, then watch for the retry about a second later.

With Event Gateway: hookdeck listen 3000 moonpay --path /webhooks/moonpay with the Hookdeck CLI gives you a public HTTPS URL that forwards to your machine. Use it as your test mode endpoint.

Other MoonPay webhook limits

Check one real Platform delivery before you build on the docs, and plan for a few differences between events.

  • Platform docs that disagree: The Platform overview says deliveries carry Moonpay-Signature-V2 keyed with your webhook API key, and points to the widget transaction_updated page for buy updates. The Platform OpenAPI file declares an X-Signature header computed with your secret key, and shows buy updates as {eventTime, data} with no type. Send one test mode delivery and read its headers and body, and don't assume type is present until you have. Every request is stored in Hookdeck with its headers and body, so one delivery settles it.
  • Different shapes: Widget transaction and identity events carry data, and virtual account events carry body. Status values differ too: virtual account transactions use Pending, Completed and Failed, while the virtual account itself uses lowercase pending, completed and failed.
  • Network: Endpoints must use HTTPS. MoonPay sends from eight published IPv4 addresses, and stopped sending over IPv6 on July 15, 2026, so an allowlist has to cover all eight.
  • GET requests aren't webhooks: MoonPay also makes signed GET requests to some partner endpoints, where the signature covers the query string. Keep them on a separate route from your webhook handler.
  • No version: MoonPay documents no payload version, so read only the fields you use and ignore the rest.

Keep a short outage from losing your MoonPay events.

Event Gateway verifies the signature and answers MoonPay as soon as it accepts each delivery, so a slow handler or a failed deploy doesn't use up MoonPay's retries, and your events wait in its queue until your service recovers.

Not affiliated with MoonPay. Facts are compiled from public sources and linked inline.