AI Build South Africa
A fundamentals guide, written for someone whose AI agent writes and deploys the actual webhook receiver, not someone learning to build one by hand.

Quick answer

A webhook is the reverse of an API call. Instead of your app asking a service for information, the service calls your app on its own, the moment something happens on its end: a payment completing, a WhatsApp message arriving. Your AI agent writes and deploys a small piece of backend code, a webhook receiver, that waits for that call and reacts to it. Every payment and messaging integration this site documents relies on exactly this pattern, and every one of them treats verifying who actually sent it as the one non-negotiable step.

The one-sentence version: they call you, you don't call them

An ordinary API call runs on your schedule: your app decides it needs something and asks for it. A webhook flips that around entirely. You give a service (PayFast, Yoco, WhatsApp) a URL belonging to your own app, and from that point on, the service calls that URL itself, whenever a specific event happens, without you asking first. You're not checking in to see if a payment went through; the payment platform tells you the instant it does.

This is also the practical reason a webhook exists at all rather than your app just asking repeatedly. Constantly polling "has this payment completed yet?" wastes requests, adds delay, and doesn't scale once you have real traffic. A webhook is push instead of pull: near-instant, and only as much traffic as events actually happening.

API call vs. webhook

An API call

Your app initiates:

You ask a question, get an answer right away

A webhook

The other service initiates:

It tells you something happened, whenever it happens

AI Build · aibuild.co.za

Why your AI builder needs a real backend to receive one

A service calling your webhook has to reach it over the open internet, the same way a visitor reaches your homepage. That means your webhook receiver has to be deployed somewhere with a real, public address before it can catch anything, not sitting on your own machine during a preview session. This is why an AI builder's in-browser preview usually can't receive a webhook on its own, and why the receiver lives in a backend function with a public address instead. Our guide to adding a payment gateway shows where that receiver fits in a real checkout.

The one thing every webhook receiver has to do: verify the signature

A webhook URL is a public address, which means it's also something anyone who finds it can call, not just the platform you set it up for. Every service that sends webhooks solves this the same way: it signs each request with a secret only the two of you know, and your receiver has to recompute that signature and check it matches before trusting anything in the payload. PayFast signs with MD5 over the field values, Yoco and WhatsApp both use HMAC-SHA256, Peach Payments signs the checkout request and the webhook independently, different exact mechanics per platform, same underlying rule every time: recompute, compare, only act on a match.

Skipping this step is the single most expensive mistake a webhook receiver can make, and it's an easy one to make by accident, since an unverified webhook that trusts every incoming request looks identical to a properly verified one in a quick test. The gap only shows up once someone deliberately sends a fabricated request, at which point a fraudulent order can get marked paid, or a forged message treated as a real customer contact. Build the signature check into the first version of every webhook receiver; never leave it as a follow-up step to add "once it's working."

What you'll actually see: event, payload, retries

A handful of words show up on almost every webhook, worth recognising rather than treating as new each time. The event is what actually happened, a completed payment, a received message, and most platforms send a specific event type so your receiver knows which one it's looking at. The payload is the data describing that event, sent along with the call. A retry is what happens if your receiver doesn't respond in time or errors out, most platforms attempt delivery again on a schedule, though exactly how many times and over what window differs by service.

Not every webhook behaves the same way

Two webhooks that look similar on the surface can still differ in ways worth checking before you assume either one. Some platforms send a test event automatically the moment you register a URL, purely to confirm it's reachable, separate from the real event webhooks that follow, which is why a receiver built to expect only one payload shape can fail on that very first call. Retry behaviour, how many attempts and how far apart, isn't standardised across platforms either. And a webhook's own payload format can change between a platform's API versions, which is why this site's own integration guides name the date they were last checked against the platform's current documentation, the same honesty this site's guide to APIs already covers in more depth.

Where to go next

Not affiliated with the platforms we write about

AI Build South Africa is an independent resource. We're not endorsed by, or an official partner of, PayFast, Yoco, Peach Payments, Ozow, Meta, Lovable, Base44, Bolt.new or Anthropic. We do participate in affiliate and referral programmes with some of these providers, including Base44. See our Disclaimer for the full disclosure and our Terms of Service for the wider terms.

Frequently asked questions

Is a webhook the same thing as an API?

Related, not the same. Calling an API is your app asking another service to do something right now. A webhook runs the other direction: the other service calls your app, unprompted, when something happens on its end. Same underlying request-and-response mechanics, opposite direction.

Why does my webhook need a public URL to work?

A service calling your webhook has to reach it over the open internet, the same way a visitor reaches your website. A URL only your own machine can see, like one running on your laptop during development, is invisible to PayFast, Yoco or WhatsApp's own servers. This is exactly why a webhook receiver has to be deployed somewhere reachable, a Supabase Edge Function or a Base44 backend function, before it can actually receive anything.

What happens if my webhook receiver is down when the event fires?

It depends entirely on the platform sending it. Most payment and messaging platforms retry a failed delivery a set number of times over a set window, but the exact schedule differs by service, and none retry forever. Check the specific platform's own webhook documentation rather than assuming every service behaves the same way.

Do I really need to verify the signature on every webhook, even a simple one?

Yes, without exception. A webhook URL is a public address, by definition something anyone who finds it can call. Without checking that an incoming request genuinely came from the platform it claims to, using a secret only the two of you know, nothing stops someone from sending a fabricated event straight to your endpoint. Every payment and messaging integration this site documents treats this as the one non-negotiable step.

Can I test a webhook without a real payment or message going through?

Usually yes. PayFast, Yoco and most other platforms this site documents offer a sandbox or test mode that fires real webhook calls without moving real money or sending a real message, letting you build and check the full flow before switching to live credentials. Ozow is one exception: it warns that its staging environment moves real money unless you pay with Ozow Demo Bank.

What's the difference between a webhook and the redirect URL a payment sends me back to?

They're not interchangeable, and confusing them is a common, costly mistake. A redirect URL sends the buyer's browser back to your site, which only proves the browser landed there, not that a payment actually succeeded. A webhook is a separate, server-to-server call the platform itself makes, verified by its signature, which is the only one of the two you can actually trust to confirm what happened.

Related reading