Accepting Webhooks from Stripe - WP Simple Pay Documentation
  1. Home
  2. Functionality
  3. General
  4. Accepting Webhooks from Stripe
  1. Home
  2. Functionality
  3. Accepting Webhooks from Stripe

Accepting Webhooks from Stripe

Webhooks allow Stripe to send messages back to your WordPress site. Setting up webhooks is required for some functionality of WP Simple Pay such as creating installment plans, allowing customers to update their subscription payment details, and using it’s integration with AffiliateWP.

To add the appropriate webhook endpoints, in your Stripe dashboard go to Developer > Webhooks (direct link). We recommend creating two webhook endpoints: one for test mode and one for live mode. If you create both, you’ll need to repeat the below process after toggling modes.

Click Add Endpoint, then add the URL found in Simple Pay Pro > Settings > Stripe Setup tab under Webhooks.

We recommend selecting “receive all events” as WP Simple Pay will probably need to use the same webhook endpoint to communicate with your site using features not yet released.

After you add the endpoint you should see the new URL listed in the webhooks settings.

Stripe can sign the webhook events it sends to your endpoints for added security and we strongly recommend that you set this up. To do so, retrieve your endpoint’s secret from your Dashboard’s webhooks settings. Select an endpoint for which you want to obtain the secret, then select the Click to reveal button.

Then copy the signing secret from the Stripe Dashboard, head back to the Stripe Setup tab in your WP admin, then paste it into the Live/Test Endpoint Secret text box.

If you’re interested in more details, you can visit Stripe’s doc on using webhooks with subscriptions.

How can I reduce the number of webhook events my site receives?

When choosing to receive all webhook events, you may notice this message:

If you are interested in reducing the number of webhooks sent to your website, you can choose which webhook events to listen for in your Stripe webhooks settings rather than choosing to receive all events:

Currently WP Simple Pay utilizes the following events:

  • invoice.payment_succeeded
    Used to increment installment plans.
    Exposes the simpay_webhook_subscription_created action for further processing after a successful Subscription. e.g. custom email notifications
  • payment_intent.succeeded
    Exposes the simpay_webhook_payment_intent_succeeded action for further processing after a successful payment. e.g. custom email notifications
  • invoice.upcoming
    Sends the “Upcoming Invoice” email reminder for updating a Payment Method. Learn more
  • checkout.session.completed
    Used to remove generated abandoned Stripe Checkout records.
    Exposes the simpay_webhook_checkout_session_completed action for further processing if needed.
  • plan.updated
    Used to ensure the list of Subscription Plans is up to date when configuration Subscription Options.
  • charge.failed
    Exposes the simpay_webhook_charge_failed action for further processing after a Charge fails.

If you decide to specify which webhook events to listen for you will need to verify your list of enabled events against this list in the future to ensure you are adding the events necessary for any new functionality.

In order to avoid needing to manually add new webhook events when a future version of WP Simple Pay requires one, we strongly recommend you use ‘receive all events’.

Updated on October 9, 2020

Was this article helpful?

Related Articles