Client-Side Validation

Let’s start with client-side validation, which means validating the credit card data users enter in the shopping cart on the way to making a purchase. Our responsibility on the client side is to prevent customers from sending invalid data to the Stripe API server, and in case of an error in the token API call, inform customers that their purchase has been stopped. In this case, invalid data could mean an invalid credit card number, an expiration date that is in the past, a bad CVC number, and so on.

Stripe maintains the jQuery.payment[31] plugin, which is a jQuery plugin that implements a number of credit card validation functions that we can tie to the form that we created in Gathering Information. A nice feature of ...

Get Take My Money now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.