Skip to main content

Protect forms with CAPTCHA

What it does​

A CAPTCHA asks visitors to prove they're a person before a form is sent, which cuts down automated spam. WebForms works with three services: Google reCAPTCHA, hCaptcha and Cloudflare Turnstile. You create an account with one of them, paste its keys into your store, and choose who has to pass the check:

  • Store-wide, with Require CAPTCHA for: Guests Only, All Visitors or Disabled. On a new installation it's Disabled, so no form asks for a CAPTCHA.
  • On one form, with the form's Captcha Mode, which follows the store-wide rule or replaces it.
Add CAPTCHA to a Contact Form2:18Watch on YouTube

Before you start​

  • You have an account with the service you want to use, and it has given you keys for your store. WebForms asks for a Site Key and a Secret Key. For reCAPTCHA Enterprise it asks for a Site Key, an API Key and a Project ID.
  • With reCAPTCHA, you know which version your keys are for: v2, v3 or Enterprise.
  • You can open Stores → Configuration in the admin.
  • You know whether the settings are for the whole store or for one store view. Every setting below can differ per store view, except the two score settings. To set up one store view, select it in Scope at the top of the configuration page before you change anything.

Steps​

Connect the CAPTCHA service​

  1. Go to Stores → Configuration → MageMe Extensions → WebForms.
  2. Click Spam Protection to expand it.
  3. In CAPTCHA Provider, select reCAPTCHA, hCaptcha or Turnstile. The page then shows only the settings of that service.
  4. If you selected reCAPTCHA, select the version of your keys in reCAPTCHA Version: v2, v3 (invisible) or Enterprise.
  5. Paste your keys into Site Key and Secret Key. For reCAPTCHA Enterprise, fill in Site Key, API Key and Project ID instead. Verification Action must match the action name set for the key; it starts as webforms.
  6. Optionally choose how the check looks, for example Theme or Widget Size. These settings differ by service. The settings reference lists them all.
  7. Click Save Config. If a key the selected service needs is empty, the page doesn't save and names the missing keys, for example "reCAPTCHA v3 needs a Site Key and a Secret Key. Enter them or choose another captcha before saving."

Choose who must pass the check​

  1. On the same page, in Require CAPTCHA for, select:
    • Guests Only to ask visitors who aren't signed in to a customer account,
    • All Visitors to ask everyone, or
    • Disabled to ask nobody, unless a form says otherwise.
  2. Click Save Config.

Use a different rule on one form​

  1. Go to Content → WebForms → Manage Forms.
  2. Click the form's name.
  3. Click User Experience in the list of sections on the left.
  4. In Captcha Mode, select Guests Only, All Visitors or Disabled. Use Store Configuration, the default, follows Require CAPTCHA for.
  5. Click Save.

The form's rule wins over the store-wide one. You can leave Require CAPTCHA for at Disabled and protect only the form that attracts spam.

What you should see​

Open the form on your store as a visitor who has to pass the check. The service's check sits where the form's Captcha element sits, right above Submit unless you moved it. See Captcha field.

  • With Guests Only, a customer who is signed in sees no check and can send the form straight away.
  • If a visitor clicks Submit before the check is finished, the form isn't sent and a window titled Error says "The security check is not complete yet. Please complete it or wait for it to finish, then try again."
  • If the service rejects the visitor's answer, the Error window shows the Rejected Check Message, for example "hCAPTCHA verification failed." The form stays on the page with everything the visitor typed.
  • If the form reaches your store without any answer from the service, the Error window shows the Service Error Message, for example "Something went wrong with reCAPTCHA. Please contact the store owner."

Each service has its own two messages, and you can change them in Spam Protection. For Turnstile they are "Turnstile verification failed." and "Something went wrong with Turnstile. Please contact the store owner."

A submission stopped by the check isn't saved, so it doesn't appear in the Inbox and no notification email goes out. In the builder, click the Captcha element: its panel shows the service and the word configured once its keys are in. Without the keys, the panel says "The captcha check is not running, so forms that use it reject every submission." and names the keys to add. For reCAPTCHA Enterprise, the Project ID counts as one of them: without it, the check isn't running either.

Limits​

  • A form shows a CAPTCHA only after you fill in the keys of the selected service. Without them, a form that asks for a CAPTCHA refuses every submission: the visitor sees "Captcha is not set up on this store. Please contact the store owner.", nothing is saved and the store's log names the missing setting. A form that doesn't ask for a CAPTCHA, by Captcha Mode or Require CAPTCHA for, keeps taking submissions. While keys are missing, the admin shows a system message at the top of the page: "WebForms captcha is switched on in store view name, but the keys for the selected captcha are missing, so captcha cannot work there.", or "in Default Config" when every store view is affected. It names one store view at a time. Its link, Open the captcha settings, leads to the settings. Only admins whose role includes the WebForms settings see it.
  • reCAPTCHA keeps a separate set of keys for each reCAPTCHA Version. Only the set of the selected version is used. Save Config refuses a service or version whose keys are empty, also when Require CAPTCHA for is Disabled but some forms ask for a CAPTCHA by their own Captcha Mode.
  • The services publish test keys that let every visitor pass the check, whatever they answer. Use the keys the service created for your store, not test keys.
  • reCAPTCHA v3 and Enterprise rate visitors with a score instead of a puzzle. The settings reference explains Minimum Human Score and Maximum Bot Score.
  • A check passed once counts for one submission only. A visitor who sends the form again in the same visit passes the check again.

Troubleshooting​

  • Visitors see "Captcha is not set up on this store. Please contact the store owner." The form asks for a CAPTCHA, but the keys of the selected service are missing for that store view. Fill them in, or set the form's Captcha Mode so it doesn't ask for one. The WebForms upgrade check lists every form in this state.
  • No CAPTCHA appears on the form. If the admin shows a system message that the captcha keys are missing, click its link and fill them in. Otherwise, check that the keys are filled in for the store view you're looking at. Then check the form's Captcha Mode and, if it says Use Store Configuration, Require CAPTCHA for. With Guests Only, sign out first: signed-in customers don't get the check. In the builder, click the form's Captcha element: if its panel says the check is not running, it names the keys that are missing.
  • Every visitor gets the Service Error Message or the Rejected Check Message. Check that CAPTCHA Provider and, for reCAPTCHA, reCAPTCHA Version match the keys, and that the keys were pasted in full. See Captcha blocks every submission.
  • Spam still arrives. Make sure the form that gets the spam has the check: its Captcha Mode is All Visitors, or Guests Only if spam comes from guests. For spam from the same addresses, add them to Blocked email addresses.

What's next​

Applies to WebForms 4Last reviewed October 14, 2026