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 its integration with AffiliateWP.

To add the appropriate webhook endpoints, in your Stripe Dashboard, go to Developers > Webhooks (direct link).

NOTE: We recommend creating two webhook endpoints: one for Test Mode and one for Live Mode. If you don’t create one for each payment mode now, you’ll need to repeat the process detailed below after toggling payment modes.

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

At the same time that you add your endpoint, you will need to add the events to listen to by clicking the button labeled +Select events. After doing that, you can copy and paste each event listed below into the Select events to send > Search events search box.

After searching each term, click the checkbox to add it, and the search additional terms. Do not click Add events until you’ve checked all events listed below:

invoice.payment_succeeded

payment_intent.succeeded

charge.succeeded

invoice.upcoming

checkout.session.completed

plan.updated

charge.failed

Details about the functionality of each of these events is shown at the bottom of this document.

When you’re done adding events, click Add endpoint to complete the process.

 

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.

NOTE: We recommend creating two webhook endpoints: one in Test Mode and in Live Mode. If you don’t create one for each payment mode now, you’ll need to repeat the process detailed below after toggling payment modes in WP Simple Pay.

Stripe, Live Mode Dashboard: https://dashboard.stripe.com/dashboard

Stripe, Test Mode Dashboard: https://dashboard.stripe.com/test/dashboard

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 Test Endpoint Secret text box.

Currently, WP Simple Pay utilizes the following events:

invoice.payment_succeeded

  • Used to increment installment plans and send “Payment Confirmation” and “Payment Notification” emails for Subscriptions.
  • Exposes the simpay_webhook_subscription_created action for further processing after a successful Subscription.

payment_intent.succeeded

  • Sends the “Payment Confirmation” and “Payment Notification” emails for one-time payments.
  • Exposes the simpay_webhook_payment_intent_succeeded action for further processing after successful payment

charge.succeeded

  • Sends the “Payment Confirmation” and “Payment Notification” emails for one-time payments using ACH Debit.
  • Exposes the simpay_webhook_charge_succeeded action for further processing after successful payment

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.

 

Updated on October 11, 2021

Was this article helpful?

Related Articles