WordPress Payment Gateway: How to Connect It and Fix Failures
WordPress troubleshooting

WordPress Payment Gateway: How to Connect It and Fix Failures

To connect a payment gateway to WordPress you need three things: a WooCommerce store, an account with a payment provider that works with businesses in your country, and that provider’s plugin, which connects the two. You do the setup itself in WooCommerce > Settings > Payments, and from there the customer either pays in your site’s checkout or is sent to the provider’s payment page.

If you already connected a gateway and it doesn’t work, the cause is almost always in one of a few usual places: the SSL certificate, the plugin settings, compatibility with the checkout block, a conflict with another plugin, or a notification URL that was never set. I’ve collected them all here in the order you should check them, and for each one how to recognize the problem and how to fix it.

Before you touch your WordPress payment gateway, back up. Installing a payment plugin, replacing keys and deactivating plugins for testing all touch the heart of the store, so before any such change you need a full backup of the site, both files and database. WooCommerce’s documentation recommends working in a staging environment and in the gateway’s sandbox (test) mode, if it has one, so you can test without charging real cards.

Step 1: choose how the customer will pay

According to WooCommerce’s documentation there are two main approaches to payment gateways, and the difference affects security and what you are responsible for.

Approach What happens What it means for you
Redirect The customer is sent to the payment provider’s site, pays there and returns to your site Card details are not typed on your site
On-site payment (Direct) The customer pays directly on your checkout page An SSL certificate is required as part of meeting the PCI standard

WooCommerce itself does not store credit card details. Even so, when payment goes through an outside provider, the PCI DSS standard still applies to you, because your checkout page is part of the transaction. The difference is that the burden on you is much smaller.

WooCommerce’s PCI DSS documentation also lists a few basic security steps recommended for every store that accepts payments:

  • Hosting with a provider that understands PCI requirements.
  • Strong passwords and restricted access to the admin area.
  • Regular updates of WordPress, the theme and the plugins.
  • SSL on the checkout and account pages.

Those are the steps that concern the store itself. If you also want to look at the broader protection of the business, beyond the checkout page, I wrote a separate guide on cybersecurity for a small business. If you want to actually verify, and not just go by a checklist, that the store meets the requirements, you can order a penetration test. And if the store is new, it’s worth knowing the other side of the problem: fraudulent transactions that go through the gateway successfully. I have a separate guide on that too: how to prevent credit card fraud on a new ecommerce site.

Availability depends on your country. Check the official list of countries supported by WooPayments to see whether it is available where your business operates. If your country isn’t on the list, you will need a local payment provider. Some providers publish their plugin in the WordPress plugin directory, and some distribute it from their own website. Before installing, check when the plugin was last updated and which WooCommerce version it was tested with.

Step 2: the SSL certificate and the site addresses

According to WooCommerce, most payment gateways require SSL. So this is the first check when the payment method doesn’t appear at checkout or when the provider returns an error.

To check, open the checkout page and make sure the address starts with https:// and that the browser doesn’t show a security warning.

After the certificate is installed, go to Settings > General and update the WordPress Address (URL) and Site Address (URL) fields so they start with https://. That is what WooCommerce’s SSL documentation tells you to do after installing a certificate.

Step 3: install the WordPress payment gateway plugin and configure it

After you install the plugin of the payment provider you chose, all the setup is done in one place:

  1. Go to WooCommerce > Settings > Payments.
  2. Click Enable next to the payment method to turn it on, and Manage to configure it. According to the documentation, if the provider needs additional setup, WooCommerce opens its setup screen.
  3. Enter the login details you received from the payment provider. They need to match the environment: test details for test mode, and real details for the live environment.
  4. You can change the order in which payment methods are shown to the customer with the drag handle on the left of each provider.
  5. In WooCommerce > Settings > General, go over the store’s currency settings and make sure they match what you set up with the payment provider.

Before you open payments to customers, do at least one end-to-end test transaction: add a product to the cart, go through checkout, pay in test mode, and then check that the order appears in WooCommerce > Orders with the right status and that the customer email was sent. One test like this saves you from a real customer discovering the problem before you do. While you’re at it, make sure the order also produces an automatic invoice, and not only an order confirmation, if your invoicing system is connected to the store.

If something fails at this stage, the error code gives you a hint. WooCommerce’s documentation on resolving payment errors says that 400 errors usually come from a wrong address, and that errors with code 200 often come from wrong login details. In both cases, go back to the plugin settings.

Step 4: the payment method doesn’t appear at checkout

In stores set up in recent years, the checkout page is built by default from the Checkout block. According to WooCommerce’s documentation, the block shows only payment methods that are available in the store and compatible with it, so a payment plugin that wasn’t updated to support the block simply won’t appear.

It looks like this: the plugin is enabled in WooCommerce > Settings > Payments, but it doesn’t show at checkout. When you edit the checkout page and select the Checkout block, a plugin that declared itself incompatible triggers a warning, and a button to switch to Classic Checkout appears in the sidebar.

The fix is to return the checkout to the classic version: edit the checkout page, open List View, select the Checkout block, click Transform and choose Classic Shortcode. Save, and do the same on the cart page, because WooCommerce recommends reverting both together. And if you are worried that the classic checkout will disappear, according to the WooCommerce developer blog there is currently no plan to end support for it.

Step 5: the payment goes through but the order doesn’t update

The customer paid, the payment provider sees the transaction, and on the site the order is stuck on Pending payment or Failed. In a case like this the problem is usually in the message the provider is supposed to send back to the site. These are the places to check:

  • Turn on logging in the payment plugin’s settings, run one test transaction, and read the new entries in WooCommerce > Status > Logs.
  • Check the notification URL (IPN or webhook) that was set up with the payment provider. According to WooCommerce, for some payment gateways you need to set it manually.
  • If the site has a security plugin or firewall, make sure it isn’t blocking the requests that come from the payment provider.

Step 6: the gateway broke after an update

If your WordPress payment gateway worked until yesterday and stopped after an update, start by checking for conflicts and the PHP logs.

Plugin conflict: temporarily switch to a default theme such as Twenty Twenty-Five or Storefront, deactivate all plugins except WooCommerce and the payment plugin, and reactivate them one at a time. This is the method WooCommerce describes in its conflict testing documentation. If you have no access to the admin area, you can rename the suspect plugin’s folder inside wp-content/plugins through FTP or the file manager, and WordPress will stop loading it.

Critical error: if the message “There has been a critical error on this website” appears, WordPress emails the site administrator a login link in Recovery Mode, where the problem component is paused just for you. Check your spam folder for that email too.

Error log: add the following lines to wp-config.php, before the line /* That's all, stop editing! Happy blogging. */:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

Then repeat the transaction and open wp-content/debug.log. When you’re done, set WP_DEBUG back to false. It’s also worth looking at the PHP version and at the items marked in red in WooCommerce > Status > System Status, and if needed, asking your hosting company for the server error log.

When to stop and call an expert

Some payment problems are solved with one click, and some require reading logs, understanding the theme’s code and working with the payment provider’s support. Stop and get help if any of these is true for you:

  • Customers are charged and the orders aren’t recorded on the site.
  • You have no recent backup, or you aren’t sure how to restore one.
  • The log points to custom code in the theme.
  • The payment provider says everything is fine on their side, and the logs on the site show nothing.
  • You went through all the steps and the payments still don’t work.

Once payments work and the store is ready to sell, the next step is bringing buyers to it. I covered that in my guide on how to increase organic traffic to your website.

Frequently asked questions

What do I need to set up a payment gateway in WordPress?

A WooCommerce store, an account with a payment provider, that provider’s plugin and an SSL certificate. You enable and configure the plugin in WooCommerce > Settings > Payments.

How do I add a payment gateway to a WordPress site so card details don’t pass through the site?

Choose a gateway that works by redirect: the customer is sent to the payment provider’s payment page and returns to the site at the end. The PCI DSS standard still applies to the store, but the burden is smaller.

Can I use WooPayments in my country?

That depends on the official list of countries supported by WooPayments. Check the current list before you plan around it.

Why is the payment plugin enabled but not showing at checkout?

The common reason is that the plugin isn’t compatible with the Checkout block. You can convert the checkout and the cart to Classic Shortcode through Transform in the editor. Also check that the site works over HTTPS.

The customer paid and the order stayed on Pending payment. What do I check?

The notification URL (IPN or webhook) at the payment provider and the plugin’s log in WooCommerce > Status > Logs. If there is a firewall, make sure it isn’t blocking the payment provider’s requests.

Does WooCommerce store credit card details?

No. According to WooCommerce’s documentation, the system doesn’t store card details, and the official payment gateways store at most partial data such as the last four digits when payment tokens are used.

If you tried to connect a WordPress payment gateway yourself and it still doesn’t work, I can take care of it. Leave your details here and we’ll check together where it gets stuck.

Have a project worth talking about?

The call is free, with no commitment 😊