What Is a Webhook? How It Differs from an API
A webhook sends an automatic notification to another system the moment an event happens. We explain how it is used in order, payment and shipping integrations and how it differs from an API.

A webhook is when a system sends an automatic HTTP request to a predefined address after a specific event occurs in it (a new order, a confirmed payment, a changed shipping status). With an API, you ask for the data; with a webhook, the data comes to you as soon as the event happens. That is why webhooks are the cornerstone of real-time integration.
What Is a Webhook and How Does It Work?
A webhook is a simple mechanism that lets two pieces of software notify each other about events. When something happens inside a system (for example, when a payment is confirmed), it sends an HTTP request, usually a POST request, to a URL you specify. The details of the event are generally in the request body, in JSON format.
This structure is sometimes also called a reverse API or an event trigger, because the party that starts the communication is not the one requesting the data but the system producing it. You say once, "when this event happens, notify me at this address," and the rest happens automatically.
To understand how a webhook works, it helps to first know the answer to what an API is. A webhook is part of the API world, but the direction is reversed.
- The event happens: a new order, a return request, an out-of-stock item, a payment confirmation.
- The source system sends a POST request to the registered webhook address.
- The receiving system validates the request, processes the data and returns a response such as 200.
- If no response arrives, the source system usually retries the request at set intervals.
The Difference Between a Webhook and an API
In classic API use, the client asks the server at regular intervals, "is there anything new?" This method is called polling. If there's no new data, every request is wasted; if there is, you have to wait until the next query.
This is exactly where the difference between a webhook and an API shows: with a webhook there is no asker, only a notifier. The notification arrives the moment the event happens, and no unnecessary traffic is created. However, a webhook doesn't replace everything; you still need an API to list, filter or update historical records.
| Criterion | API (polling) | Webhook |
|---|---|---|
| Who starts the communication | The system requesting the data | The system producing the data |
| Timing | Depends on the polling interval | At the moment of the event |
| Unnecessary requests | Many (empty queries) | Almost none |
| Best suited for | Listing, searching, updating | Notification, triggering, syncing |
| Setup | Code on the client side | Needs a publicly reachable endpoint |
Webhook Use Cases
Webhook usage turns up in almost every digital job. Payment providers, shipping companies, marketplaces, email services, code repositories and communication tools mostly deliver event notifications through webhooks.
E-commerce and payments
When a customer completes a payment, the payment infrastructure sends a "payment successful" notification to your store and the order is confirmed automatically. In redirect-based payments such as 3D Secure, this is what keeps the order from being lost even if the browser closes. The order flow is at the heart of any e-commerce integration.
Shipping and marketplaces
When a shipment departs or is delivered, the shipping system can report the status, and an automatic SMS or email goes to the customer. Likewise, in shipping integration and marketplace integration projects, events such as new orders, cancellations and returns are processed instantly.
Software development and team tools
Typical webhook scenarios include starting tests and the release process when a new commit is pushed to a code repository, posting a notification to the team's messaging channel when a form is filled in, or updating the calendar when a reservation comes in.
An Example Webhook Request
A webhook request usually carries the type of the event, its time and the data of the record concerned. The example below is a typical body that might be sent when an order is created. Field names differ for every service; rely on the service's own documentation.
On the receiving side, a small endpoint that handles this request is enough. Below you see a simple example written with Node.js and Express. In a real project, signature verification and a queue structure must be added.
{
"event": "order.created",
"created_at": "2026-01-15T10:24:00Z",
"data": {
"order_id": "10458",
"total": 1249.90,
"currency": "TRY",
"status": "paid"
}
}const express = require('express');
const app = express();
app.post('/webhooks/siparis', express.json(), (req, res) => {
const olay = req.body;
// 1) Verify the signature 2) Add to the queue 3) Return a response immediately
console.log('Gelen olay:', olay.event);
res.sendStatus(200);
});
app.listen(3000);How to Secure a Webhook
A webhook address is an endpoint open to the internet. Anyone who knows the address can send a fake request to it. That is why you should trust no incoming request without signature verification.
Most serious services sign the request with a shared secret key and send the signature in an HTTP header. The receiving system performs the same calculation and compares the signatures; a request that doesn't match is rejected.
- Use HTTPS addresses only; don't send data over plain HTTP.
- Always apply verification methods such as an HMAC signature.
- Check the timestamp in the request to prevent old requests from being replayed.
- Don't write the secret key into the code repository; store it in an environment variable.
- Check the schema of incoming data before writing it directly to the database.
Common Mistakes and Fixes
Setting up a webhook is easy, but running it reliably takes care. The most common problems in projects are repeated requests and slow responses.
The same event processed twice
When the source system gets no response, it sends the request again, so the same order can arrive twice. The solution is an idempotent operation design: record each event's unique ID, and if an already processed ID arrives, just return a success response and move on.
Timeouts
If the endpoint tries to do long jobs such as issuing an invoice or sending an email while handling the request, the response is delayed and the source system counts an error. The right method is to take the request, add it to a job queue and respond immediately; the heavy work runs in the background.
Out-of-order events
Events may not always arrive in the order they occurred; a "shipped" notification can arrive before a "paid" notification. Store the event time in your records and evaluate status transitions according to that time.
Webhook or Ready-Made Automation Tool?
In simple scenarios, automation tools that listen for webhooks without code can do the job. We covered the strengths and weaknesses of these tools in detail in our article on what low-code is. But for the flows at the heart of the business, such as orders, payments and stock, it is important that you stay in control.
If your business rules are specific, several systems are connected to each other or data volume is growing, it is more reliable to build the webhook architecture inside your own software. In this respect, a custom software development approach reduces dependence on intermediate layers.
Our software solutions and integrated solutions approach is also based on this principle: systems talk to each other directly, and unnecessary layers in between are removed.
Checklist Before Setting Up a Webhook
Answering the questions below before setting up an automatic notification infrastructure prevents most later problems from the start.
- Which events are really needed? Subscribing to every event creates unnecessary load.
- Is the endpoint reachable over HTTPS, and does it verify signatures?
- Is a unique ID record kept for repeated events?
- Are failed requests logged and traceable?
- Is there a backup check that recovers the data through the API if a webhook doesn't arrive?
- In critical steps such as accounting and invoicing, is the risk of double entry checked through accounting integration?
Frequently Asked Questions
01Is a webhook a paid technology?
No, a webhook is a method and requires no separate license. Services that offer webhooks mostly provide it as a standard feature. The cost comes from the server that will host the receiving endpoint and the development effort.
02What do you use to test a webhook?
During development, you use request-catching services that display incoming requests, or tunneling tools that temporarily expose your local server to the internet. Many services also let you send a sample event from their dashboard.
03Is data lost if a webhook doesn't arrive?
Most services retry failed requests for a certain period, but that period isn't unlimited. That's why, for critical flows, collecting missing events with a periodic API check is a good safety net.
04Are a webhook and a WebSocket the same thing?
No. A WebSocket is a two-way connection that stays open continuously between a browser and a server. A webhook, on the other hand, is a single HTTP request sent from server to server, once per event.
A webhook lets your systems notify each other instantly, eliminating manual checks and delays. With the right security and retry design, your order, payment and shipping flows run on their own. If you'd like to build a solid e-commerce integration for your store or software, take a look at our software solutions and talk to our team.


