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 the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.