WP Payments Documentation


Introduction #

Webhooks are automated messages that are sent to your website by WP Payments whenever an important action takes place, like when an existing payment method becomes chargeable.

This will help your e-Commerce website to stay in sync with WP Payments at all times, which enhances the plugin’s local payment method functionality.

For example, let’s say a customer ordering on your site has used a payment gateway, it will redirect them to a bank authentication page.  After authentication, they will be redirected back to your website.  But what happens if they accidentally close their browser while they are being redirected to your site?

That’s when webhooks come in handy.  Stripe will send an event message (a webhook) to your server which will immediately inform our plugin that the payment method can be charged.  So now our plugin can finish processing the order without any delay.  

Configure Webhooks #

1. To start configuring webhooks, first Login to Stripe/WP Payments.

2. The option “Viewing test data” on the left navigation bar will determine whether you are creating a Test webhook or a Live webhook.

3. Go to the Developers section above and click Webhooks.

4. Click the Add endpoint button.

5. Go to the plugin’s API settings page, to get the Webhook url.  Copy that url and paste it to the Stripe Endpoint url.

6. Stripe allows you to configure all the event types that are sent to the endpoint url.

You can also configure the event types that will be sent to the endpoint url.

Required Events #

  1. source.chargeable
  2. charge.succeeded
  3. charge.failed
  4. payment_intent.succeeded
  5. charge.refunded
  6. charge.dispute.created
  7. charge.dispute.closed

Once you have added the event, click Add endpoint

Now you will see that the endpoint has been added and is active.  For enhanced security, Stripe uses an endpoint secret for webhooks.  You need to add this secret to the plugin’s settings.

So go to the Signing secret section and click the Click to reveal button.  This will show you the webhook secret that you need to copy.  Just copy this value, go to the plugin’s API settings page and paste it in the Webhook secret field.