> For the complete documentation index, see [llms.txt](https://docs.tip4serv.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tip4serv.com/webhooks-developers-only/how-do-webhooks-work.md).

# How do webhooks work?

Instead of constantly polling the API, you automatically receive an **HTTP POST** request containing a **JSON payload** describing the event.

With webhooks, you can for example:

* Automatically grant items/roles after a successful payment
* Remove access when a subscription expires
* Send a message on a Discord server
* Trigger your own custom business logic

***

### How it works

1. You set up an **HTTP endpoint** (URL) in your application.
2. When an event occurs, our system sends a **payload** to this URL.
3. Your server must respond with a **2xx HTTP code** to confirm receipt.
4. You process the data as needed (database, integrations, logs, etc.).

***

### Example events

* `payment.success` → A payment was successfully completed
* `payment.failed` → A payment attempt failed
* `payment.refund` → A payment was refunded
* `subscription.created` → A new subscription was created
* `subscription.renewed` → A subscription was renewed
* `subscription.expired` → A subscription expired


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tip4serv.com/webhooks-developers-only/how-do-webhooks-work.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
