Skip to main content
Question

grecaptcha.enterprise.execute always returns 0

  • November 24, 2025
  • 1 reply
  • 43 views

cmpenney

I’m trying to integrate reCaptcha v 3 into our checkout page. It seems that no matter what I do the call to grecaptcha.enterprise.execute is always returning a token of 0.

Here is the button event:

 

function OnCCCard(e) {
            e.preventDefault();
            grecaptcha.enterprise.ready(async () => {
                console.log('Getting Token');
                const token = await grecaptcha.enterprise.execute('MyKey', { action: 'checkout' });
                console.log('Got Token:' & token);
            });

        }

No matter what I try the second console.Log always says : “Got Token: 0”

I’m not sure what I’m doing wrong. 

1 reply

faube
Staff
Forum|alt.badge.img+6
  • Staff
  • December 4, 2025

Hello cmpenney,

in JavaScript the & operator is a bitwise AND operator.

Because ‘Got Token’ and token are both strings, I think it will always return 0.

 

Try correcting the logging statement and let us know if you are getting an actual token string.