Asking versus being told

Checking a parcel’s status through an API is like calling the delivery company. A webhook is like the company sending an update when the parcel arrives.

An online shop might use a payment service’s API to start a payment. The shop gives the service a web address for updates. When the payment finishes, the service sends a webhook to that address, telling the shop what happened. This message travels between the services.

Why use both

Webhooks reduce repeated checks, called polling. The shop should confirm each update came from the payment service and avoid acting on it twice if it is resent. The API remains useful when the shop needs to ask for the current status.