Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

170
Views
Integración de reCaptcha v3 de Google con la API JavaSript de Recurly

Estoy usando la API de JavaScript de Recurly para procesar pagos de suscripciones.
Quiero implementar la API reCaptcha V3 de Google en la página autohospedada de Recurly.

<script src="https://js.recurly.com/v4/recurly.js"></script>

 recurly.configure({ publicKey : 'xxx-xxx', required : ['cvv', 'address1', 'city', 'state', 'country', 'postal_code'], }); // When a customer hits their 'enter' key while in a field recurly.on('field:submit', function (event) { $('form').submit(); }); // On form submit, we stop submission to go get the token $('form').on('submit', function (event) { // Prevent the form from submitting while we retrieve the token from Recurly event.preventDefault(); // Reset the errors display $('#errors').text(''); $('input').removeClass('error'); // Disable the submit button $('button').prop('disabled', true); var form = this; // Now we call recurly.token with the form. It goes to Recurly servers // to tokenize the credit card information, then injects the token into the // data-recurly="token" field above recurly.token(form, function (err, token) { // send any errors to the error function below if (err) error(err); // Otherwise we continue with the form submission else form.submit(); }); });

Las cosas son, la implementación de la API de Google es algo como esto:

 <input type="hidden" name="recaptcha_response" id="recaptchaResponse"> <button type="submit" id="btn-submit" class="g-recaptcha" data-sitekey="xxxxxxxxx" data-callback='onSubmit' data-action='submit'>Submit</button> <script> function onSubmit(token) { document.getElementById("recaptchaResponse").value = token; document.getElementById("frm-subscribe").submit(); } </script>

Ambos tienen su propia versión de onSubmit. ¿Cómo incluyo el de Google en el de Recurly?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

<input type="hidden" name="recaptcha_response" id="recaptchaResponse"> <button type="submit" id="btn-submit">Submit</button>
 recurly.token(form, function (err, token) { // send any errors to the error function below if (err) error(err); // Otherwise we continue with the form submission else { grecaptcha.ready(function() { grecaptcha.execute('xxx-xxx-site-key', {action: 'submit'}).then(function(token) { document.getElementById("recaptchaResponse").value = token; form.submit(); }); }); } });
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!