javascriptrecurly

Using Recurly JS how do I set different fields to be required


I am using Recurly JS and trying to get the some extra fields to be required. The fields i can get with the required: [] settings are: Card number, month, year, cvv, first name, surname, address1, city

I cannot get the following: agency name, email, postcode, country, vat number

I also want to set the details for the month length.

I was trying to use the RecurlyState object, but Im not sure if it works or how to make it work with the recurly.configure({});

I could not find anything in the official documents on how to make certain fields required but I found it here on Git Hub


Solution

  • If your Required Address configuration is set to "Full Address" in the Site Settings>configuration window of the user interface, then validation will automatically check for first_name, last_name, address1, state, city, country, zip. It would not be required to declare these parameters in the required [] array.

    The following the vat_number and cvv would be need to be declared in the required array as with this example:

    required: ['cvv', 'vat_number']

    For parameters such as agency name, email, they would require a small customized validation script to check for these fields on submit of the form. Recurly.js is designed to handle just PCI related data, so this is not included by default.

    The expiry month length is configured within the recurly.js library to accept either a 1 or 2 digit value