Setting Up WooCommerce Stripe Webhooks – WPQuickies

Start accepting card payments on your WooCommerce store using the Stripe payment gateway.  Here’s a step-by-step guide on how to set up Stripe with WooCommerce.

What Are Webhooks?

Webhooks allow disparate applications to share information.

There are generally two ways for apps to communicate, polling and webhooks.

Polling is where you ask an app if it has any information to offer, similar to you being in a pub and asking your friends if they would like another round of drinks and which ones they would like.

Webhooks simply give information to an app on each occurrence, so using the similar analogy above in this case you simply bring a round of drinks to your friends when it’s your turn, no questions asked.

If you want a more detailed description of webhooks, watch my October 2020 WPQuickies on “WooCommerce Webhooks“.

Stripe vs PayPal

Forbes released an article in March 2022 about PayPal versus Stripe comparison, and it’s an excellent authoritative read for a detailed comparison of the two services.

Both PayPal and Stripe offer very similar online payment services, and their processing fees are also similar.

In general, PayPal has more extensive brand recognition and user base and is suited for small businesses and individuals just starting. 

PayPal is super easy to set up and requires little technical knowledge.

Stripe is best suited for established and growing businesses because they offer multiple ways to customise and brand the checkout and payment process, which will likely require an experienced developer.

Stripe vs WooCommerce Payments

The WooCommerce Payments plugin is relatively new, appearing in late 2021.

WooCommerce Payments brings your PayPal and credit card payments to manage directly in the WordPress dashboard.

You don’t have to log into your Stripe account to run reports or manage transactions.

Essentially the WooCommerce Payments plugin uses Stripe as the payment processor, so the charges between both systems are nearly identical.

WooCommerce Payments charges an additional 1% for international card payments, which may make a big difference if you process many of those.

Stripe still wins for flexibility to customise the checkout experience and offer different payment types.

Stripe for WooCommerce

As a developer, I love Stripe and trust it to take all my card payments. 

The Stripe payment gateway for WooCommerce also handles Apple Pay and Google Pay, so you’re covered for mobile transactions.

Stripe mobile payments screens

Setting up Stripe requires a bit of back and forth between the Stripe dashboard and WooCommerce, but it’s a one-time task.

You get the additional benefits of 3D Secure and Stripe Radar to watch for and minimise fraudulent transactions.

stripe payment request

Configuring Stripe For WooCommerce

It’s much easier to create and configure your Stripe account before connecting it to WooCommerce.

I suggest you take time to set up your Stripe account first, connect it to your business bank account, and then come back here.

Once you have the WooCommerce Stripe Payment Gateway plugin installed and activated, navigate to WooCommerce > Settings > Payments.

WooCommerce settings > Payments > Stripe

Click the “Create or connect an account” button and log in to your Stripe account.

getting started with Stripe WooCommerce

If you have multiple Stripe accounts as I do, select the one you want to connect with your WooCommerce shop.

WooCommerce select Stripe account to connect

You will get redirected back to the WooCommerce > Settings > Payments > Stripe > Settings dashboard area.

Make sure you configure the three settings areas “General”, “Account details”, and “Payments & transactions”.

General

If this is your first time using WooCommerce and/or Stripe, I highly recommend you check “Enable test mode”.

This will allow you to go through some transactions and test the connection and results before going live.

WooCommerce Stripe Settings General

You can rename the wording or leave the default settings on the checkout screen.

Account Details

The account details section shows you the status of your payments, payouts and webhooks.  

WooCommerce Stripe Settings Account Details

As you can see from the image, I’ve not yet configured the Stripe webhooks, and it’s showing as a warning in this section.

Payments & Transactions

In the payments and transactions section, you can enable the use of saved cards, change the name displayed on bank statements and other transaction tweaks. 

I generally leave the default settings as they are.

WooCommerce Stripe Settings payments & transactions

Setting Up Stripe Hooks For WooCommerce

Let’s go back to the account details section.

WooCommerce Stripe Settings account details

Webhooks have been highlighted as having an issue because they are not yet set up.

Directly below is the webhook URL that we need to add to Stripe.  In this example, the webhook URL is “https://zpddemo.wordifysites.com/?wc-api=wc_stripe”

There is a link to the “Stripe account settings” area to which you need to add the webhook URL.  

Go ahead and click on that link or navigate to “https://dashboard.stripe.com/account/webhooks“.

Stripe webhooks

I have existing Stripe webhooks to my other websites and applications, blurred in the above image.

Go ahead and click the “+ Add endpoint” button and enter the webhook URL from the WooCommerce Stripe settings into the “Endpoint URL” field.

listen to Stripe events

You can add a description for the webhook, which is handy if you plan on having multiple ones or just leave it blank.

Leave the version on the default dropdown setting.

Lastly, you will need to add all the events that the webhook should listen for, so click on the “+ Select events” button.

Stripe select events to send

You can check “Select all events” and then save. That’s fine.

If you would like to know the exact events to listen for with WooCommerce at the time of writing, you can search for and check only the following: 

  • source.chargeable
  • source.canceled
  • charge.succeeded
  • charge.failed
  • charge.captured
  • charge.dispute.created
  • charge.dispute.closed
  • charge.refunded
  • review.opened
  • review.closed
  • payment_intent.succeeded
  • payment_intent.payment_failed
  • payment_intent.amount_capturable_updated
  • payment_intent.requires_action
  • setup_intent.succeeded
  • setup_intent.setup_failed

This list could change at any time with future WooCommerce versions, so always check the WooCommerce Webhook documentation.

That’s you all set to start taking payments from WooCommerce using Stripe.

Remember to disable text mode when ready to take live customer payments.

Customer can now add their card details on your WooCommerce checkout, and Stripe will process the transaction and send the information back to WooCommerce.

Connecting To A Different Stripe Account

If you need to change the Stripe account that WooCommerce is using, here’s the process to do that.

In WooCommerce, navigate to WooCommerce > Settings > Payments > Stripe > Settings and click on the “Edit account keys” button.

Change Stripe Account in WooCommerce

The dialogue box that pops up holds the currently connected Stripe API keys for the live and test (sandbox) accounts.

Change Stripe Account in WooCommerce edit live account keys & webhooks

You need to change both the “publishable key” and the “secret key” with those from the new Stripe account you wish to connect to.

Do this for both live and test, and remember to add the webhook to the new Stripe account and save everything in Stripe and WooCommerce.

You can get the Stripe account API keys from https://dashboard.stripe.com/apikeys

In WooCommerce, refresh your Stripe settings, and you should be connected to the new Stripe account.  

Use the test account to confirm the connection.

Summary

Setting up Stripe with WooCommerce is an easy to follow step process that only needs to be done once.

After properly configuring the payment gateway, your WooCommerce customers can now pay using credit cards and you get the protection and flexibility of Stripe transaction processing.

Do you still have questions about setting up Stripe Webhooks for WooCommerce?

Ask in the comments below.

#WPQuickies

Join me every Thursday at 1 pm Sydney time for some more WPQuickies – WordPress tips and tricks in thirty minutes or less.

Broadcasting live on YouTube and Facebook.

Suggest a #WPQuickies Topic

If you have a WordPress topic you want to see explained in 30 mins or under, fill out the form below.

https://forms.gle/mMWCNd3L2cyDFBA57

Watch Previous WPQuickies

Was this article helpful?
YesNo