Stripe documentation points out that:
Because properly acknowledging receipt of the webhook notification is so important, your endpoint should return a 2xx HTTP status code prior to any complex logic could cause a timeout.
In the web hook I'm developing with PHP this is exactly the case — there is some complex logic involved after the event is received.
Currently I'm returning the response code with a simple call
to http_response_code()
. But how can I send the response
headers (with the code) before proceeding? Would a flush()
call force the headers to be sent?