Skip to content

How to fix WooCommerce payment gateway errors

The order is created but the payment is refused, or the money is taken and the order never shows as paid. The order's status and notes say which. Usual causes are mixed-up test and live credentials, payment confirmations that cannot reach your site, and a gateway not offered at checkout.

By
WP Ministry
Updated

In short

  • Open the order and read its notes first. The gateway records there what the payment provider answered.
  • A paid order stuck in "Pending payment" means the provider's confirmation did not reach your site.
  • A single declined card is the customer's bank saying no. Every card failing is a setting on your side.
  • Compare what your payment provider's dashboard shows with what WooCommerce shows before changing anything.

A payment gateway is the plugin that passes a customer's payment from your checkout to a payment provider. A gateway error means the checkout itself worked, an order was created, and the payment step then failed or was never confirmed. If no order is created at all, the fault is earlier: see WooCommerce checkout not working.

Your store's data is not at risk. The money can be. A customer may have paid for an order your store still shows as unpaid, so compare your provider's dashboard with your orders before anything else.

Find out which cause you have

Go to WooCommerce, then Orders, and open an order that went wrong. Read two things: its status, and the "Order notes" panel, where WooCommerce and the gateway record status changes and payment results.

  • "Failed", with a note giving a decline reason. The provider or the bank said no. See the fix for declined payments.
  • "Failed" on every order, with a note about credentials, keys or authentication. See the first fix.
  • "Pending payment", and your provider's dashboard shows the payment as taken. The confirmation did not arrive. See the second fix.
  • No way to pay at checkout. See the fix for a gateway that is not offered.
  • A note or log entry about a connection, a timeout or SSL. See the last fix.

One "Pending payment" order on its own is not a fault. WooCommerce gives that status to every order that has been placed and not yet paid, including those where the customer walked away.

For more detail, turn on logging in the gateway's settings if it has the option, repeat the payment, and read the gateway's log under WooCommerce, then Status, then Logs.

Where it goes wrong

A page request passes through each of these in turn. This one comes from a plugin.

  1. Browser
  2. DNS
  3. HTTPS
  4. CDN or firewall
  5. Web server
  6. PHP
  7. WordPress (this error comes from here)
  8. Database and files

What causes it

  • The gateway is in test mode, or its credentials do not match

    Common

    A payment account has one set of credentials for testing and another for real payments. Test mode left on, live keys pasted into test fields, or keys that were replaced at the provider make every payment fail.

    Fix: Match the gateway's mode and credentials

  • The provider's payment confirmations do not reach your site

    Common

    After a payment, the provider sends your site a message, often called a webhook, saying the money arrived. If that message is sent to the wrong address or is turned away, the customer has paid and the order still looks unpaid.

    Fix: Get the provider's confirmations through to your site

  • The provider or the customer's bank refused the payment

    Common

    The card was declined, or the provider has limited your account. Nothing on the site is broken, and the reason is recorded against the order.

    Fix: Read why the payment was declined

  • The gateway is not offered at checkout

    Sometimes

    The gateway is switched off, does not support the store's currency or the customer's country, or does not work with the Checkout block. Customers then see a notice that no payment methods are available.

    Fix: Make the gateway available at checkout

  • Your server cannot reach the payment provider

    Rare

    The gateway on your site has to call the provider over a secure connection. A firewall at the host that blocks outgoing requests, or server software too old for the provider's security requirements, stops every payment.

    Fix: Ask the host whether the server can reach the provider

How to fix it

Match the gateway's mode and credentials

  • Easy
  • Low risk
  • About 15 minutes
  1. Step 1: Open the gateway's settings

    Go to WooCommerce, then Settings, then Payments, and open the settings of the gateway that fails.

  2. Step 2: See which mode it is in

    Most gateways have a test mode, sometimes called sandbox. In test mode only the provider's test cards work, and a real card is refused. On a store that is open for business, test mode must be off.

  3. Step 3: Copy the credentials again

    Log in to your payment provider, switch its dashboard to live, and copy each key or credential into the matching live field, with no space before or after. Test keys belong only in the test fields. If the keys were replaced at the provider, the old ones no longer work.

  4. Step 4: Reconnect, if the gateway connects by signing in

    Some gateways hold no keys and are linked by logging in to the provider from the settings page. Disconnect and connect again.

  5. Step 5: Check the result without paying by card

    The settings should now show a live connection with test mode off. Open the next real order paid through the gateway: it should move to "Processing" or "Completed", and the payment should show in the provider's dashboard. To test the payment step itself, use a staging copy with the gateway in its test mode, which is where WooCommerce's guide to test orders says test payments belong. Before paying on the live store with your own card, read your provider's rules: Stripe's testing documentation says its services agreement prohibits testing in live mode using real payment method details.

Get the provider's confirmations through to your site

  • Takes care
  • Low risk
  • About 30 minutes
  1. Step 1: Find the delivery record at the provider

    Your payment provider's dashboard has a section for webhooks or notifications. It lists the address each message was sent to and the answer your site gave.

  2. Step 2: Check the address

    It must be your site's present address, with https and with or without www exactly as the site uses. The gateway's settings page usually shows the address it expects. A provider may count a redirect as a failure, so an address that only redirects to the right one is not good enough.

  3. Step 3: Read the answer your site gave

    • 401 or 403: something on your site turns the provider away. Look at a security plugin, a firewall, a password on the whole site, or a maintenance mode. See 403 Forbidden.
    • 404: the address is wrong, or the gateway plugin is not active.
    • 500 or another number beginning with 5: the site failed while handling the message. See 500 Internal Server Error.
    • An SSL or TLS error: the provider does not accept your certificate. See Your connection is not private.
  4. Step 4: Check the signing secret

    Many providers sign each message, and the gateway checks the signature with a secret copied from the provider's dashboard. Test and live have different secrets. Copy the live one again.

  5. Step 5: Correct the stuck orders

    Resend the failed messages from the dashboard if the provider allows it. Otherwise confirm each payment in the dashboard and change that order's status by hand.

Read why the payment was declined

  • Easy
  • No risk
  • About 10 minutes
  1. Step 1: Open a failed order and read its notes

    The gateway writes the provider's reason there, and the provider's dashboard shows the same payment with more detail.

  2. Step 2: If it is one customer

    A declined card is a decision by the customer's bank or by the provider's fraud checks. Nothing on your site needs fixing. Ask the customer to use another card or to contact their bank.

  3. Step 3: If it is every customer

    Look for a notice on your payment provider's dashboard. An account whose verification is unfinished, or which the provider has restricted, cannot take payments. Check as well any fraud rules you have set there: a rule that is too strict refuses good customers.

Make the gateway available at checkout

  • Easy
  • Low risk
  • About 15 minutes
  1. Step 1: Confirm that it is switched on

    Go to WooCommerce, then Settings, then Payments. The gateway must be enabled and its setup finished.

  2. Step 2: Check the currency and the countries

    Under WooCommerce, then Settings, then General, find "Currency" in the "Currency options" section. Compare it, and the countries you sell to, with what the gateway and your payment account support. A gateway that cannot take the store's currency may switch itself off at checkout.

  3. Step 3: Check that it works with the Checkout block

    If the Checkout page uses the Checkout block and the only active gateways do not support it, no payment methods appear. Update the gateway plugin. If its current version still does not support the block, switch the page to the classic checkout: select the Checkout block in the editor, press Transform in the block toolbar and choose Classic Shortcode.

Ask the host whether the server can reach the provider

  • Easy
  • No risk
  • About 15 minutes
  1. Step 1: Collect the evidence

    Copy the connection error from the order note or the gateway's log. Under WooCommerce, then Status, note the "cURL version" row, which shows the software your server uses for outgoing secure connections.

  2. Step 2: Send both to your host

    Ask whether outgoing https requests to your payment provider are blocked, and whether the server supports the TLS version the provider requires.

When to get help

If the credentials are right, confirmations are delivered and accepted, and payments still fail or orders still stay unpaid, the fault is inside the gateway plugin or in how it meets another plugin. That needs the gateway's debug log read line by line, and its author's support. Get help right away if customers are being charged for orders that stay unpaid.

Common questions

A customer was charged but the order says "Pending payment". What do I do?

Confirm the payment in your provider's dashboard, then set the order to "Processing" by hand so it is fulfilled. Then fix the confirmations, or the next order will do the same.

One payment method works and another does not. Is the checkout broken?

No. The checkout is shared, so the fault is in the settings of the gateway that fails. Start with its mode and credentials.

Why do I have old "Pending payment" orders with no payment?

Those customers left before paying. If the hold stock setting has a time limit, WooCommerce cancels such orders itself when it runs out.

More on this subject

Would you rather we fixed it?

Emergency Fix is $99. Site down or checkout broken. Goes to the front of the queue. No fix, no fee. 30-day warranty. It starts with a free diagnosis.