Skip to main content

Use reCAPTCHA with Stripe Web Widgets

Protect your Stripe Web Widgets from card testing and automated fraud by enabling Google reCAPTCHA v3.

Cristina Gruita avatar
Written by Cristina Gruita
Updated today

Generate reCAPTCHA v3 Keys

You can find out more about Google reCaptcha v3 here.

  1. Go to the Google reCAPTCHA page and sign in with a Google account.

  2. In Register a new site, enter a label such as your organisation or website name.

  3. Select reCAPTCHA v3.

  4. Enter your website domain or domains.

  5. Click Register and copy the Site Key and Secret Key.

Domains must exactly match where your widgets are hosted.


Add reCAPTCHA Keys to Donorfy

Once keys are generated, add them to your Donorfy configuration.

  1. Sign in to Donorfy and go to Settings, then click Configuration.

  2. Search for Stripe Connect.

  3. In the Google reCAPTCHA section, enter your Site Key and Secret Key.

  4. Review the reCAPTCHA Pass Threshold setting.

  5. Click Update to save.

The pass threshold defaults to 0.5. Increase it gradually, for example by 0.1, if suspicious activity is still passing reCAPTCHA.


Understand reCAPTCHA Scores

Google assigns a score between 0.0 and 1.0 for each request.

  • Scores closer to 1.0 indicate likely genuine users.

  • Scores closer to 0.0 indicate likely bot activity.

You can review score trends in the Google reCAPTCHA dashboard page under the score distribution graph.


Apply reCAPTCHA to New Widgets

Any new Stripe Web Widgets generated after enabling reCAPTCHA automatically use it.

No additional configuration is required for newly created widgets.


Update Existing Stripe Web Widgets

Existing widgets require manual updates to support reCAPTCHA.
Only SCA compliant widgets are compatible with reCaptcha - we strongly recommend you update all your widgets to the SCA compliant - see this article for help with that.

⚠️ Important:

  • If you have existing widgets you must update them so they are ready to use reCaptcha, this should be done before you enter the reCaptcha keys into your Donorfy configuration.

  • If you enter the reCaptcha keys into your Donorfy configuration before updating your widgets then your existing widgets will no longer work.


Update the Stripe Payments Script

Replace the existing Stripe Payments JavaScript reference.

  1. Remove the old script reference, for example:
    ​stripepayments_2019.7.1.js.

  2. Add the latest script reference:
    ​https://cdn.donorfy.com/wwjs/stripepayments_2024.6.1.js.


Add the reCAPTCHA JavaScript

Add the Google reCAPTCHA script below the Stripe JavaScript include.

  1. Keep the existing Stripe script reference.

  2. Add the reCAPTCHA script directly below it, inserting your Site Key.

If this script is incorrect or the key is invalid, reCAPTCHA will not load.


Add Hidden reCAPTCHA Fields

Near the bottom of the widget HTML, add the following hidden fields.

  1. Add ReCaptchaSiteKey with your Site Key.

  2. Add ReCaptchaAction to identify the request source, such as Donorfy.

The action value appears in the Google reCAPTCHA dashboard and can be customised.


Verify reCAPTCHA Is Loading

After updating the widget:

  1. Load the page containing the widget.

  2. Confirm the reCAPTCHA logo appears at the bottom-right of the page.

If the logo does not appear, reCAPTCHA is not loading correctly.

Common errors include:

  • Invalid domain for the site key.

  • Incorrect or missing JavaScript reference.


Test Your Updated Widgets

You must test with a real transaction.

  1. Make a small live donation using a valid credit or debit card.

  2. Go to Financial, then click Online Donations to confirm the transaction appears.


Understand Common Error Codes

If an error occurs when submitting a donation, check the error code.

Error Code 11

A reCAPTCHA token was not sent.

Possible causes:

  • The widget was not upgraded correctly.

  • Browser settings block cookies or tracking.

Error Code 12

The reCAPTCHA token failed validation.

Possible causes:

  • Incorrect site or secret keys.

  • The widget domain is not registered in Google reCAPTCHA.

Additional details appear in the Errors & Info tab under Financial, then Online Donations.

Did this answer your question?