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

162
Views
Integrating Google's reCaptcha v3 with Recurly's JavaSript API

I am using Recurly's JavaScript API to process subscriptions payments.
I want to implement Google's reCaptcha V3 API to the Recurly's self-hosted page.

<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();
    });
});

Things is, Google's API implementation is something like this :

<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>

Both have their own version of onSubmit. How do I include Google's one into Recurly's ?

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!