reCAPTCHA v3 or v2? code example
Example: recaptcha v3
<script src='https://www.google.com/recaptcha/api.js?render=CLAVE_SITIO_WEB'>
</script>
<script>
grecaptcha.ready(function() {
grecaptcha.execute('CLAVE_SITIO_WEB', {action: 'formulario'})
.then(function(token) {
var recaptchaResponse = document.getElementById('recaptchaResponse');
recaptchaResponse.value = token;
});});
</script>