Discussions

Ask a Question
Back to All

How to Handle Webhook Retries for Failed Payment Notifications in PayMongo API?

Hey everyone,

I’m currently integrating PayMongo’s API into an e-commerce app I’m building, and I’ve run into a bit of a challenge with webhooks. I’ve set up a webhook to listen for payment status updates (like payment.paid and payment.failed), and it’s working fine for most transactions. However, I’ve noticed that if my server is down or there’s a timeout when PayMongo sends the webhook, I miss the notification, and the payment status doesn’t get updated in my app.

I read in the PayMongo docs that webhooks have a retry mechanism, but I’m not sure how to properly handle retries on my end to ensure I don’t miss any payment updates. Has anyone dealt with this before? Specifically:

How many times does PayMongo retry sending a webhook if it fails initially?
What’s the best way to set up my server to handle these retries without duplicating payment updates (like accidentally marking a payment as “paid” twice)?
Are there any best practices for logging or queuing these webhook events to make sure I don’t lose any data?
I’m using Node.js with Express for my backend, if that helps. Any advice, code snippets, or resources would be super appreciated! Thanks in advance for the help. 😊

Cheers,ragdoll hit

Alex