I am using a custom payment gateway from the gateway vendor. Could this be the issue?
Possibly, try using the dummy test gateway or maybe offline gateway and see if it has same issue.
Can you give me a pointer to the potential source of issue so that I can take it up with the vendor?
We can't assist you with code we didn't write. So if we didn't write the gateway there's nothing we can really do beyond suggesting comparing to existing gateways and their IPN handling to see where things could be going wrong.