2

I was wondering if you could have drop downs (select w/ option tags) instead of a text input field for the expiration month and year when you use hosted fields in Recurly.js v4. The divs below

<div data-recurly="month" id="month"></div>
<div data-recurly="year" id="year"></div>

change to this below.

<div id="month" data-recurly="month">
 <div class="recurly-hosted-field recurly-hosted-field-month">
  <iframe frameborder="0" scrolling="no" allowtransparency="true" border="0" src="https://api.recurly.com/js/v1/field?config=somecrazylongstringThatWasRemoved" style="height: 100%; width: 100%; background: transparent none repeat scroll 0% 0%;">
    <input type="text" style="visibility: visible; font-family: Open Sans; font-size: 1rem; color: rgb(44, 7, 48); font-weight: bold; font-variant: normal; font-style: normal; line-height: normal;" placeholder="mm">
  </iframe>
 </div>
</div>
<div id="month" data-recurly="month">
 <div class="recurly-hosted-field recurly-hosted-field-month">
  <iframe frameborder="0" scrolling="no" allowtransparency="true" border="0" src="https://api.recurly.com/js/v1/field?config=somecrazylongstringThatWasRemoved" style="height: 100%; width: 100%; background: transparent none repeat scroll 0% 0%;">
   <input type="text" style="visibility: visible; font-family: Open Sans; font-size: 1rem; color: rgb(44, 7, 48); font-weight: bold; font-variant: normal; font-style: normal; line-height: normal;" placeholder="yy">
  </iframe>
 </div>
</div>

Is there something you can pass in the Recurly to change the inputs to dropdowns? This is what i'd like:

<select id="ExpirationMonth" name="ExpirationMonth">
    <option class="first" value="MonthNotSelected">Month</option>
    <option value="01">01</option>
    <option value="02">02</option>
    <option value="03">03</option>
    <option value="04">04</option>
    <option value="05">05</option>
    <option value="06">06</option>
    <option value="07">07</option>
    <option value="08">08</option>
    <option value="09">09</option>
    <option value="10">10</option>
    <option value="11">11</option>
    <option class="last" value="12">12</option>
</select> 
<select id="ExpirationYear" name="ExpirationYear">
    <option class="first" value="YearNotSelected">Year</option>
    <option value="2016">2016</option>
    <option value="2017">2017</option>
    <option value="2018">2018</option>
    <option value="2019">2019</option>
    <option value="2020">2020</option>
    <option value="2021">2021</option>
    <option value="2022">2022</option>
    <option value="2023">2023</option>
    <option value="2024">2024</option>
    <option value="2025">2025</option>
    <option value="2026">2026</option>
    <option value="2027">2027</option>
    <option value="2028">2028</option>
    <option value="2029">2029</option>
    <option class="last" value="2030">2030</option>
</select>

This is my recurly configure:

              recurly.configure({
              publicKey: 'removed',
              style: {
                all: {
                  fontFamily: 'Open Sans',
                  fontSize: '1rem',
                  fontWeight: 'bold',
                  fontColor: '#2c0730'
                },
                number: {
                  placeholder: 'Debit/Credit Card Number'
                },
                month: {
                  placeholder: 'mm'
                },
                year: {
                  placeholder: 'yy'
                }
              }
            });

1 Answer 1

7

It's not possible to do a dropdown or select-box for the expiration year or month fields in Recurlyjs.v4.

This particular integration method allows merchants to pass SAQ-A compliance. The trade off to the simplified compliance is that the field format is limited to text input fields.

(Source: I work for Recurly)

4
  • Is there a way to set the input maxlength to: 16 for number 3 for CVV of Visa, Mastercard, and Discover. 4 for CVV of Amex 2 for Expiration Month 2 for Expiration Year I'm not sure if the number iframe can communicate with the cvv iframe to let it know what the CC's prefix is to determine the card type by the following prefixes: American Express 34, 37 MasterCard 50-55 Visa 4 Discover Card 6011, 622126-622925, 644-649, 65 If it can't communicate could max length be set to 4?
    – PHPDave
    Feb 4, 2016 at 20:40
  • Example: <input type="text" maxlength="16" placeholder="Debit/Credit Card Number"> <input type="text" maxlength="4" placeholder="cvv"> <input type="text" maxlength="2" placeholder="mm"> <input type="text" maxlength="2" placeholder="yy">
    – PHPDave
    Feb 4, 2016 at 20:40
  • Thanks for your answer!
    – PHPDave
    Feb 4, 2016 at 20:42
  • For people who are coming here in the future, this is currently possible. You can set thee config inputType: "select" on the config to make them a select, or if you only want to make them a select on mobile (but not desktop) you can set inputType: "mobileSelect".
    – scorgn
    Jun 5, 2022 at 17:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.