# Webhooks Introduction

## 🔔 Webhooks

Webhooks provide a powerful way for your application to receive **real-time updates** from the PayNow API. Instead of polling for changes, you can **subscribe to specific events**, and PayNow will send a **POST request** to your server when those events occur.

***

### ⚙️ How Webhooks Work

When you subscribe to a webhook event:

1. You provide a URL endpoint.
2. PayNow sends a `POST` request to that URL whenever the subscribed event occurs.
3. The request body contains relevant event data.
4. Your server processes this data and returns an appropriate HTTP status.

***

### 🚀 Setting Up Webhooks

You can configure webhook subscriptions in two ways:

* **Via the Dashboard**\
  Use the built-in user interface to manage subscriptions.
* **Via the API**\
  Programmatically register webhook endpoints with desired settings.

#### Required Setup Details

| Parameter | Description                                        |
| --------- | -------------------------------------------------- |
| `event`   | The event you want to subscribe to                 |
| `url`     | The full URL where the POST request should be sent |
| `type`    | Payload format (see Webhook Types below)           |

***

### 📦 Webhook Types

Currently, PayNow supports the following **two** webhook types:

| Type           | Format        | Description                                                                                                    |
| -------------- | ------------- | -------------------------------------------------------------------------------------------------------------- |
| `JSON (v1)`    | JSON          | Sends a structured JSON payload. Fully documented under **Webhook Integration**                                |
| `Discord (v1)` | Discord Embed | Sends a Discord-friendly embed. Simply plug in a Discord webhook URL and customize the message using templates |

> ⚠️ Only the **JSON v1** webhook is covered in the Webhook Integration documentation.\
> The **Discord webhook** works by copying your Discord webhook URL into PayNow and setting your event and message template.

***

### 📣 Event Types

PayNow supports various event types that can trigger a webhook. For the full list of supported events, refer to the Webhook Events documentation.

***

### 📬 Handling Webhook Notifications

When your server receives a webhook:

* **It should return a `2xx` status code** if the event was received and processed successfully.
* If your server responds with **a non-successful status code (`>299`)**, PayNow will **retry automatically**.

#### Retry Behavior

* Retries use **exponential backoff**, meaning delays will increase between attempts.
* Delivery attempts will continue for a reasonable period before being marked as failed.

***

### 📘 Further Reading

* Webhook Integration – Detailed setup and payload structure
* Webhook Events – Complete list of supported webhook triggers


---

# Agent Instructions: 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.paynow.gg/webhooks/webhooks-introduction.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.
