# 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
