# Webhook Configuration

### What is a webhook?

Webhooks allow Stripe to send notifications to your website when certain events occur. For example, if a payment is refunded in Stripe, Stripe can automatically send a notification to your webhook to let your website know.

### Which features require a webhook?

* [x] Email notification
* [x] Delayed & Redirection payment methods (Sofort, PayPal, Alipay, etc)
* [x] Subscription schedule plan (occurrences)

### How to setup a webhook?

1. In your Stripe dashboard, click Developer -> [Webhooks](https://dashboard.stripe.com/webhooks), then click the Add endpoint button.

<figure><img src="/files/IsYwcaVhuMs62kRVaYT8" alt=""><figcaption></figcaption></figure>

2. To get the endpoint URL, go back to the **Setting** tab in your WordPress dashboard and you should see a field labeled `Webhook URL`. Copy the URL or click the copy icon.

<figure><img src="/files/QKAVZ04iotrtOUE6Zerm" alt=""><figcaption></figcaption></figure>

3. Paste the endpoint URL into the dialog box in your Stripe dashboard.

<figure><img src="/files/e9Ujb44rTiBOXqbCUNbA" alt=""><figcaption></figcaption></figure>

4. Add the below events to listener

```
payment_intent.payment_failed
payment_intent.succeeded
charge.succeeded
invoice.upcoming
invoice.payment_succeeded
invoice.payment_failed
checkout.session.async_payment_succeeded
checkout.session.async_payment_failed

```

<figure><img src="/files/k8tyXd59SFLIpgNnXZU9" alt=""><figcaption></figcaption></figure>

### Enable Webhook signatures (Strongly recommended)

Generating a signature for the webhook can greatly protect your endpoint from being abused by external parties.

In your Stripe dashboard, go to the webhook settings and click the `Signing secret` button to generate a signature.

<figure><img src="/files/MVlZ1wz1bNRHNc37msRT" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/UwcGZlzDExgE1erQhTzu" alt=""><figcaption></figcaption></figure>

Go back to plugin settings and paste to the webhook secret field in the **Settings** tab

<figure><img src="/files/MEWN4tudMup0zvfCY3pe" alt=""><figcaption></figcaption></figure>

### Webhook Connection Test

First of all, let's do some payments with our plugin under test mode, then go to the webhook URL and find any events such as a payment\_intent.succeeded. Now click the \`Resend\` button to trigger the event again.

<figure><img src="/files/kxqoUgYCwHF88NRgMCwc" alt=""><figcaption></figcaption></figure>

If the response is 200 (OK), our plugin will process the event and display a connected status in the Webhook URL field.

<figure><img src="/files/ebn3qp1lLIQe8qCx6LOY" alt=""><figcaption></figcaption></figure>


---

# 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.payaddons.com/getting-started/webhook-configuration.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.
