Return a HTTP 200 when a webhook is received on endpoint

Hi, I am using Mercado Pago as a payment processor and I am using webhooks for the notifications endpoint.

My problem is that Mercado Pago says:

“When you receive a notification on your platform, Mercado Pago waits for a response to validate that you received it correctly. For this, you must return an HTTP STATUS 200 (OK) or 201 (CREATED) .”

How can I return this HTTP 200 response?

You can add a ‘Return data from API’ action in your API workflow.
It should return a 200 by default from this action.

So I add no parameters?

Just like this?

Yes, that should work

Unfortunately it is not working.

I tried this:

I tried also this:

And also tried this:

None of them have worked, so I keep receiving the same webhook notification many times (if I don’t respond with a HTTP 200 it keeps retrying) :unamused:

That’s strange.

One way to debug is to actually see what response your API endpoint provides.
You can do this by testing it with Postman.
https://www.postman.com/

I use this for testing API connections.
You can call the webhook just like you expect Mercado Pago to and it will show you the response - what it looks like to MP.

Thanks for the recommendation! I just tried Postman and the response is working ok. I will try to contact Mercado Pago to see if there is something wrong on their end. Thanks for your help!

1 Like

@pachocastillosr were you able to resolve this?

The HTTP 200 was being returned correctly with the solution that @blurapps gave me but it was still not working so I contacted mercado pago.

Mercado Pago replied this to me:

“Remember that by default we sent you both protocols: IPN and Webhooks. Both are redundant you can listen to one of them or the other, no need to listen both. If you do not want to receive both protocol, you can add the parameter source_news to the notification url. Ref: https://www.mercadopago.com.co/developers/en/guides/notifications/webhooks (at the very bottom).
For that specific payment, Webhook approved notification will still be sent a couple more times, completing the re-notification cycle or until a 200 is received for it.”

So I did what they said and it was fixed.

1 Like