Validate the payload signature as soon as you receive it, before any processing or data reading. Do the validation directly on the byte array, without parsing the content.
Request with extra spaces
Check the example of a request with payload equivalent to the first example, just with some extra spaces that affect the signature, but equally valid:
Send a response with 202 Accepted status code within 5 seconds to confirm event receipt. The system considers this response as successful and will not attempt to resend the event. We ignore the response body, except in internal audits for delivery failures. In those cases, send the response in the specified format.
Error cases
The purpose of the webhook request is to integrate the event successfully. Use error responses only to indicate integration failure, i.e., when the server did not receive or process the event correctly.The webhook recognizes HTTP 5xx errors as reception or processing failures. The system only retries for this class of errors.Error responses impact the retry flow and should only be used when it's necessary to attempt delivery again.When returning an error, send the payload specified below to detail the reason in internal audit. We ignore any other formats or fields, like XML.
{"error": "error message"}
If all delivery attempts fail, the webhook discards the event. The system will not make new delivery attempts for that event.
iFood defines the maximum number of attempts, the interval between them, and the timeout time. We will inform any updates in advance. We consider timeout for requests with more than 5 seconds response time and try to resend events for up to 15 minutes. If the endpoint responds with 202 after 5 seconds, the system will still attempt to resend the event.