iOS8 Card Scan – Making your payment form “compliant”

Okay, so let’s start by explaining why I wrapped the word “complaint” in double quotes. The reason is simple – I couldn’t really find any documentation on it. So it’s a bit difficult to comply with a standard that doesn’t formally exist!

However, a few people out there have experimented with it enough that there seems to be a few unwritten rules when it comes to making your payment forms work with the card scan feature.

It basically boils down to helping the card scan feature recognize which fields are dedicated to providing certain payment details.

If you’ve dealt with auto-fill fields before (especially with Chrome), you might be expecting that the name attribute of your form fields needs to contain certain keywords to help identify the field. Not the case.

It boils down to four simple tricks:

  1. The credit card number id attribute must be cc_number
    Optionally, you can set the name attribute to cardnumber
  2. The credit card expiration month id attribute must be cardExpirationMonth
  3. The credit card expiration year id attribute must be cardExpirationYear
  4. For the card name, it must have a label with a for attribute that references the field. That label must contain the text: Name on card

Naturally, if you used class names to style your fields in your CSS, this won’t disrupt your code. You can simply add the id attributes and hide the label with CSS.

Why follow me on Twitter?

  • I tweet about new technologies, services or libraries I find interesting
  • Yeah, sometimes I'll post a pet-peeve or rant about something trivial
  • If I discover something that made my web development life easier, I share it
  • I'll shout out any handy tip that I think might be useful to other devs


Tagged , .

Updated: 2015-02-02

Phil LaNasa follow us in feedly