如何修复'您输入的验证码不正确'。 Recaptcha v3中的错误

I'm trying to configure/update ReCaptcha from v2 to v3.

I have changed the code and in the bottom right corner I can see that Recaptcha v3 is working.

BUT..

After filling the fields and pressing the button 'Submit' the error message appears saying that "The captcha you entered is incorrect. Please try again."

What could be causing the issue?

This is the script:

  <script src="https://www.google.com/recaptcha/api.js?render=MY_SITE_KEY"></script>
    <script>
        grecaptcha.ready(function () {
            grecaptcha.execute('MY_SITE_KEY', { action: 'contact' }).then(function (token) {
                var recaptchaResponse = document.getElementById('recaptchaResponse');
                recaptchaResponse.value = token;
            });
        });
    </script>