Stripe returning duplicate

0
Hi communityWe have built a webhook receiver in Mendix as a published REST endpoint. Our upstream provider (Stripe) sometimes delivers the same event more than once. We are seeing duplicate records being created. What is the best pattern to implement idempotency in Mendix webhook processing?
asked
1 answers
1

Hi Rakesh,


This is not complicated think stripe also just like other GET API where it might return the status of payment. For each it will have a trans ID so Implement an idempotency key table to track processed events. Just by using a stored object and a Logic.


For example :

Entity: WebhookEventLog

- EventId (String, Unique indexed)

- Source (String)

- ReceivedOn (DateTime)

- ProcessingStatus (Enum: Received/Processing/Completed/Failed)


Microflow logic: extract EventId from payload, retrieve WebhookEventLog by EventId, if found and Completed return HTTP 200 immediately, if not found create record with Processing status, execute business logic, update to Completed, on error set Failed and return HTTP 500 so the provider retries.

  • Always return HTTP 200 immediately after validation, then process asynchronously.
  • Use the Mendix Process Queue module for async processing with built-in retry logic.
  • Add a cleanup scheduled event to purge records older than 30 days to prevent table bloat.


I hope this helps



answered