A payment gateway knows the instant a charge succeeds; a merchant's order system finds out only if it asks. Polling for that answer every few seconds burns requests on every check that comes back "nothing yet" and still leaves a gap between the real event and the merchant noticing it. A webhook flips the direction: the merchant registers a URL in advance, and the gateway calls that URL the moment the charge succeeds, so the notification and the event happen within moments of each other instead of within one polling interval of each other.
That speed comes at a cost a function call inside one process never pays: an HTTP request over the open internet can be delivered but have its response lost, can arrive alongside a retry of itself, and can arrive out of sequence relative to another event fired moments earlier. None of that is a defect in a particular implementation — it is what sending events between two independent systems over an unreliable network actually guarantees, and a webhook design has to be built around those guarantees rather than around the guarantees a single in-process call would offer.