MoonPay webhooks in production: duplicates, ordering, retries and timeouts
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
| Problem | What to do | With Event Gateway |
|---|---|---|
| Timeouts | Return a 2xx within 5 seconds; process in a background job | Accepts each event at once, then queues it for your service |
| Duplicates | Deduplicate on webhook-id, or on type, data.id and data.updatedAt | Drops repeats you define before they reach your handler |
| Ordering | Compare updatedAt with your stored state | Logs every request and attempt, so you can see arrival order |
| Retries | Reconcile from MoonPay's API after any outage | Accepts events during your outage, then retries on your schedule |
| Choosing events | Match events to your integration; surface requotes in-app | Filters out event types a destination doesn't need |
| Testing | Use test mode, and forward to your machine | Forwards requests to localhost |
| Other limits | Check one Platform delivery; allow the IPv4 addresses | Keeps 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:
- Verify the signature, store the event and return
200. - Do the work from a queue. See why to process webhooks asynchronously.
- 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:
- For Platform events, key on the
webhook-idheader, which stays the same on every redelivery. On the KYC event it matches the body'sid. - For widget transactions, follow MoonPay's suggestion: key on
type, plusdata.idanddata.updatedAt. - For virtual account events, MoonPay suggests no key. They carry their fields in
body, with noidorupdatedAt, so the closest you can get istype, the account or transaction ID,statusandtimestamp.
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:
- Store each transaction's latest
updatedAtand status, and ignore anything older. - On the Platform KYC event, compare
timestamp, as MoonPay says to. On virtual account events, comparetimestamp, 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:
- Keep the endpoint highly available, and watch your error rate, because a deploy that fails for ten minutes can outlast the schedule.
- 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.
- Record
externalTransactionIdwhen 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:
- Use
identity_check_updatedfor KYC changes in a widget integration, andcustomer.identity_on the Platform API.status_ updated - Leave
swap_*types unselected on widget accounts. MoonPay says they never fire there. - Handle
sell_in your product. The customer can accept or decline a new price, andtransaction_ requote_ required data.quoteExpiresAtsays when that quote ends. MoonPay's own guide recommends an in-app prompt, because email alone is easy to miss. - Route
*_failedevents separately.data.failureReasonis set when a transaction fails, anddata.stagesis only sent ontransaction_createdandtransaction_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:
- Create a test mode setting and run a real test transaction, or trigger a test requote for the off-ramp flow.
- Save the first real delivery of each event you handle and use it as a fixture, because the shapes differ by event.
- Accept a body with no
type. MoonPay's Platform OpenAPI file describes a test webhook that carries onlyeventTime, though it doesn't say how to trigger one. - 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-V2keyed with your webhook API key, and points to the widgettransaction_updatedpage for buy updates. The Platform OpenAPI file declares anX-Signatureheader computed with your secret key, and shows buy updates as{eventTime, data}with notype. Send one test mode delivery and read its headers and body, and don't assumetypeis 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 carrybody. Status values differ too: virtual account transactions usePending,CompletedandFailed, while the virtual account itself uses lowercasepending,completedandfailed. - 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.
GETrequests aren't webhooks: MoonPay also makes signedGETrequests 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.