Search code examples
recurly

Does Recurly require Address, City, Country and postal code when submitting CC info for a token?


I'm trying to follow the getting started guide on https://docs.recurly.com/js/

When I try to request a token via this javascript:

form = $('#form-credit-card');
recurly.token(form, function (err, token) {
if (err) {
    RecurlyErrorHandler(err);}
else {
    alert($('input[name=recurly-token]').val());
}
}); 

function RecurlyErrorHandler (err) {
    $('#errors').text('The following fields appear to be invalid: ' + err.fields.join(', '));
    $('button').prop('disabled', false);
    $.each(err.fields, function (i, field) {
        $('[data-recurly=' + field + ']').addClass('error');
    });
}

I get this error message. I'm sending first name, last name, cc, cvv, exp month, exp year. Do I also have to send the address, city, country and postal? Or is there a setting I'm missing. I didn't notice those fields in the getting started guide. I am using hosted fields if that matters.

{"error":{"code":"invalid-parameter","message":"Address1 can't be empty, City can't be empty, Country can't be empty, and Postal code [\"can't be empty\"]","fields":["address1","city","country","postal_code"]}}


Solution

  • It will depend on your site settings. It sounds like your Address Requirements are currently set to FULL. You can access your site settings to modify these down to NONE, which will allow you to pass the information you're currently setting in your form.

    Bonus tip: You can always set your site settings to NONE and pass more information - this setting just determines the level of information that's required to submit the form. If you're doing anything around taxes, or want to do Zero Dollar Auths versus $1 auths, you will need to collect more address information.