Skip to content

WooCommerce card testing attack: stop it at checkout

Find out whether your WooCommerce store is under a card testing attack, and stop the bots at the checkout. You will confirm the attack from your orders and logs, contain it the same day, add layered defences and clean up the junk orders safely.

Your WooCommerce orders list suddenly fills with failed orders for small amounts, placed by names and email addresses that make no sense. That pattern usually means card testing, where criminals run stolen card numbers through a real checkout to learn which cards still work. Store owners and the people who host their shops, often on cPanel, can stop it by stacking checks in front of the payment step. Rate limits at Cloudflare and in WooCommerce cap checkout attempts per visitor, a CAPTCHA asks for proof that a person is typing, and the gateway’s fraud screening catches the rest. With those in place, most bots get turned away before an order is ever created.

What you’ll accomplish

  • Confirm from your orders, access logs and gateway dashboard that this really is card testing.
  • Contain an attack that is happening right now, without closing the store.
  • Add four defence layers, each one placed where it does the most good.
  • Clean up the junk orders and fake customer accounts with WP-CLI, safely and in a way that works with either order storage.
  • Prove each layer works with a test you can repeat.

Prerequisites

  • WooCommerce 9.6 or later. The checkout rate-limit toggle used in step 5 first appeared in that release.
  • An administrator login, plus access to your payment gateway dashboard (Stripe, PayPal or another).
  • SSH and WP-CLI for the cleanup steps. WP-CLI lets you manage WordPress from the terminal; run wp --info to check it is installed.
  • To read raw access logs on cPanel you need root, or you can download them from Metrics, Raw Access in your cPanel account.
  • Cloudflare is optional. The edge steps assume it, and they say clearly what the Free plan can and cannot do.

Replace example.com with your domain in every command. Commands with --user=1 assume user ID 1 is an administrator.

How it works

A card-testing bot skips your shop pages and talks straight to the checkout. A classic (shortcode) checkout receives orders as a POST to /?wc-ajax=checkout. The block-based checkout uses the Store API, WooCommerce’s public interface for carts and checkout, at /wp-json/wc/store/v1/checkout. Each request carries one stolen card and a cheap item.

What matters most is where the bot gets stopped.

The path of a card-testing bot through four defence layers. The bot posts to the classic and block checkout endpoints. Layer 1, the edge rate limit and WAF, blocks it at the edge. Layer 2, the WooCommerce rate limit on the Store API checkout at 3 requests per 60 seconds, answers HTTP 429. Layer 3, a CAPTCHA or Turnstile token checked on the server, refuses the checkout. These three sit before WooCommerce creates the order. Layer 4, the gateway's fraud screening, sits after it, so a declined card still leaves a failed order behind.

The first three layers act before WooCommerce creates the order, so a blocked attempt leaves nothing behind. The gateway’s fraud screening only runs after the order exists. It protects your merchant account, but every decline still leaves a failed order in your admin. Each decline also counts against your store’s decline rate, which card networks and your payment provider watch. That is why the gateway alone is never enough.

Step-by-step

1. Confirm it in the orders list. Open WooCommerce, Orders and filter by Failed and Pending payment. Card testing looks like dozens or hundreds of orders in a short window. They share a low total, often the same cheap product, and carry random-looking names and email addresses. If the failed orders look like real customers whose cards were declined, this article does not apply. Our guide to orders stuck on Pending payment covers that different problem.

2. Count checkout requests in the access log. On a cPanel server, each domain’s log lives in /var/log/apache2/domlogs/. This command lists the top source IPs posting to either checkout endpoint:

grep -E '"POST [^"]*(wc-ajax=checkout|wc/store(/v1)?/checkout)' /var/log/apache2/domlogs/example.com-ssl_log \
  | awk '{print $1}' | sort | uniq -c | sort -rn | head -20

Example output:

    412 203.0.113.45
    388 198.51.100.17
    121 203.0.113.202
      3 192.0.2.88

A normal store shows a few checkout POSTs per IP. The block checkout also posts to this endpoint when a shopper switches payment method, so a handful per visitor is normal. Hundreds from a handful of addresses confirm the attack. If no IP stands out, the attack is spread across many addresses, which is common. The per-IP layers then matter less, and the CAPTCHA and gateway layers matter more.

To see when it started, count the same requests per hour:

grep -E '"POST [^"]*(wc-ajax=checkout|wc/store(/v1)?/checkout)' /var/log/apache2/domlogs/example.com-ssl_log \
  | awk '{print substr($4, 2, 14)}' | uniq -c

Each line shows a count and an hour such as 10/Oct/2026:03. A sudden jump from single digits to hundreds marks the start.

3. Look up who owns the busiest addresses. Team Cymru runs a public whois service that maps an IP to its network, known as an ASN (autonomous system number).

whois -h whois.cymru.com " -v 203.0.113.45"

The first column is the AS number and the last is the network’s name. Write down the AS numbers that repeat; you will use them in step 6. If the top address belongs to AS13335, that is Cloudflare itself. It means your server logs Cloudflare’s address instead of the visitor’s. Ask your host to restore real visitor IPs (Apache’s mod_remoteip module does this) before step 5, because WooCommerce’s rate limit counts by IP.

4. Check the gateway dashboard. In Stripe, a card-testing attack shows as a spike in failed or blocked payments with small amounts. Payments marked Blocked by Stripe mean Stripe’s own card-testing defences have already stepped in. In PayPal, look for a burst of declined transactions in your activity list. If any test payments actually succeeded, refund them now. Stripe recommends this to head off disputes, which are formal chargeback claims from cardholders.

5. Turn on WooCommerce’s checkout rate limit. Go to WooCommerce, Settings, Advanced, Features. Enable the rate-limit checkout option (the label reads Rate limit Checkout in current versions, and slightly differently in older ones). The option is off by default. Once on, it allows 3 checkout POSTs per 60 seconds from one IP address (or one logged-in account), and answers anything more with HTTP 429, meaning “too many requests”.

This toggle protects the block checkout’s Store API endpoint only. The classic /?wc-ajax=checkout endpoint is not counted, so a shortcode checkout relies on the Cloudflare custom rule in step 6 and the CAPTCHA in step 7.

Developers can tune the numbers with the woocommerce_store_api_rate_limit_options filter. Its keys are enabled, proxy_support, limit (default 25) and seconds (default 10), and it applies to every Store API POST request, not only checkout. Leave proxy_support off. It trusts forwarding headers that an attacker can fake when your server is reachable directly.

6. Add an edge rule in Cloudflare. Cloudflare’s Free plan includes one rate limiting rule. It counts per IP over a fixed 10-second window, and it can match on the URL path but not on the query string. So it can protect the block checkout:

Rule name:  checkout-burst
Expression: (http.request.uri.path eq "/wp-json/wc/store/v1/checkout")
Threshold:  6 requests per 10 seconds, counted per IP
Action:     Block

Keep the threshold at 6 or above. The Free rule cannot filter by method, so it also counts the requests a real shopper sends while switching payment method. It also only sees bursts. A bot that sends one attempt every few seconds stays under any 10-second threshold, so the ASN rule below and WooCommerce’s 60-second limit cover that case.

The rule cannot match /?wc-ajax=checkout, because the part after ? is the query string. Pro adds the query field to rate limiting rules. If your one Free rule already guards wp-login.php, as in our Free plan rate limiting guide, you have to choose which path gets it.

During an active attack, a WAF (web application firewall) custom rule can block the networks you noted in step 3 on the checkout endpoints only:

Expression: (http.request.uri.query contains "wc-ajax=checkout" or http.request.uri.path eq "/wp-json/wc/store/v1/checkout") and ip.src.asnum in {64500 64501}
Action:     Block

Free includes five custom rules, and both fields in this expression work on every plan. Replace 64500 64501 with your AS numbers. Use Block, not Managed Challenge, on these endpoints. Cloudflare documents that challenge pages fail on AJAX and fetch requests, the background requests a page’s JavaScript sends. Both checkouts send orders that way, so a challenge would break checkout for real customers too. Remove the ASN rule once the attack stops.

7. Add a CAPTCHA at checkout. A CAPTCHA plugin, such as one using Cloudflare Turnstile or Google reCAPTCHA, adds a check that most scripts fail. Three points decide whether it works. The plugin must support your checkout type, block or classic. It must verify the token on the server, not only in the browser. And it must check every order request, because bots post to the endpoint directly. The costs are real: a little friction for customers, possible accessibility issues with visible puzzles, and one more plugin to keep updated. Place a real order yourself after installing it, including with any express payment buttons you offer.

8. Tighten account settings. Under WooCommerce, Settings, Accounts & Privacy, untick account creation During checkout and On “My account” page if you do not need them. Bots use them to create the fake customer accounts you will clean up below. Guest checkout is a business decision. Requiring an account makes card testing harder, but it also costs real sales, so most stores keep it on and rely on the other layers.

9. Use the gateway’s fraud tools. Stripe Radar scores every payment and can block risky ones with rules. Custom velocity rules, such as limiting attempts per card or per IP, depend on your Radar plan. PayPal has fraud protection settings in the merchant account. These tools protect your account standing, while layers 1 to 3 keep the junk out of WooCommerce.

Clean up junk orders and accounts

First check where your orders live. With HPOS (High-Performance Order Storage, the default for new stores), orders sit in their own wp_wc_orders table. In that case wp post list --post_type=shop_order will not find them.

wp option get woocommerce_custom_orders_table_enabled

yes means HPOS is on. Either way, the wp wc shop_order commands go through WooCommerce itself and work with both storage types. Take a backup first:

wp db export before-card-testing-cleanup.sql

List the failed orders from the attack window, and check a few by hand before you remove anything:

wp wc shop_order list --user=1 --status=failed --after=2026-10-09T00:00:00 --per_page=100 \
  --fields=id,date_created,total,payment_method --format=table

Then move them to the trash, 100 at a time. Rerun the loop until the list command returns nothing:

for id in $(wp wc shop_order list --user=1 --status=failed --after=2026-10-09T00:00:00 --per_page=100 --format=ids); do
  wp wc shop_order delete "$id" --user=1
done

Each order prints Success: Trashed shop_order followed by its ID. Trashed orders can still be restored, so you can empty the trash later once you are sure. To keep this tidy from now on, set Retain failed orders under Accounts & Privacy to a period such as 1 month. WooCommerce then trashes old failed orders automatically.

For fake accounts, list the newest customers:

wp user list --role=customer --orderby=registered --order=DESC --number=50 --fields=ID,user_email,user_registered

Before deleting an account, confirm it has no orders. An empty result means none:

wp wc shop_order list --user=1 --customer=1234 --format=ids

Then delete the accounts that are clearly fake. Each one prints a Success line:

wp user delete 1234 1235 1236 --yes

Validate it works

Test the WooCommerce rate limit from a terminal outside your network. These requests carry no cart, so the first ones fail with an ordinary error, which is expected. What matters is the fourth one.

for i in 1 2 3 4; do
  curl -s -o /dev/null -D - -X POST https://example.com/wp-json/wc/store/v1/checkout | grep -iE '^HTTP|^ratelimit'
done

Example output for the fourth request:

HTTP/2 429
ratelimit-limit: 3
ratelimit-remaining: 0
ratelimit-retry-after: 57
ratelimit-reset: 1791602097

A 429 with ratelimit- lines on the fourth request means layer 2 works. A 429 or 403 without those lines came from Cloudflare instead, so wait 10 seconds and test again with fewer requests. Next, look in Cloudflare under Security, Events for your rule’s name with the action Block. Finally, place a real order with your own card and refund it. Over the next day, the count from step 2 should drop back to a few requests per IP.

Troubleshooting

Real customers get “Too many requests”. Your server most likely sees Cloudflare’s IP for everyone, so all shoppers share one counter. Restore visitor IPs as described in step 3, or turn the toggle off until that is done.

The test never returns 429. The toggle may be off, or the store sees the request as coming from a logged-in editor or administrator. WooCommerce skips the rate limit for users who can edit posts, so test from a plain terminal, not from a browser session where you are logged in.

Failed orders keep coming from many different IPs. A distributed attack never trips a per-IP counter. Rely on the CAPTCHA and the ASN rule, and ask your gateway’s support team for help.

The CAPTCHA blocks real orders. Check that the plugin supports your checkout type, and test with the page cache bypassed. A cached checkout page can serve an old token.

When this is the wrong approach

If the declined orders belong to real customers, you have a payment problem, not an attack. Start with the gateway’s decline codes instead. If your gateway has already paused your account, contact them before anything else, and show them the containment steps you took. And if the attack keeps returning after all four layers, managed bot protection or a host that watches checkout traffic for you may cost less than the time you are spending.

The official Store API rate limiting documentation covers the filters in depth, and Stripe’s card testing guide explains the gateway side.

Running WordPress that earns real money deserves an operator — Stack Harbor runs that stack under Enterprise WordPress; book an infrastructure consult.