# Webhook

A webhook can be set up to receive notifications of events that occur on a plan.

## Set a webhook

<mark style="color:orange;">`PUT`</mark> `https://api.8pay.network/v1/:chain/variable-recurring/plans/:planId/webhook`

#### Path Parameters

| Name   | Type   | Description                                                   |
| ------ | ------ | ------------------------------------------------------------- |
| planId | string | ID of the plan                                                |
| chain  | string | [chain identifier](https://docs.8pay.network/overview#chains) |

#### Headers

| Name          | Type   | Description       |
| ------------- | ------ | ----------------- |
| Authorization | string | Bearer \<api-key> |

#### Request Body

| Name    | Type   | Description |
| ------- | ------ | ----------- |
| webhook | string | webhook url |

{% tabs %}
{% tab title="200 " %}

```
{
    "webhook": "http://mywebhook.com/path/file.php"
}
```

{% endtab %}
{% endtabs %}

## Get a webhook

<mark style="color:blue;">`GET`</mark> `https://api.8pay.network/v1/:chain/variable-recurring/plans/:planId/webhook`

#### Path Parameters

| Name   | Type   | Description                                                   |
| ------ | ------ | ------------------------------------------------------------- |
| planId | string | ID of the plan                                                |
| chain  | string | [chain identifier](https://docs.8pay.network/overview#chains) |

#### Headers

| Name          | Type   | Description       |
| ------------- | ------ | ----------------- |
| Authorization | string | Bearer \<api-key> |

{% tabs %}
{% tab title="200 " %}

```
{
    "webhook": "http://mywebhook.com/path/file.php"
}
```

{% endtab %}
{% endtabs %}

## Delete a webhook

<mark style="color:red;">`DELETE`</mark> `https://api.8pay.network/v1/:chain/variable-recurring/plans/:planId/webhook`

#### Path Parameters

| Name   | Type   | Description                                                   |
| ------ | ------ | ------------------------------------------------------------- |
| planId | string | ID of the plan                                                |
| chain  | string | [chain identifier](https://docs.8pay.network/overview#chains) |

#### Headers

| Name          | Type   | Description       |
| ------------- | ------ | ----------------- |
| Authorization | string | Bearer \<api-key> |

{% tabs %}
{% tab title="204 " %}

```
```

{% endtab %}
{% endtabs %}
