Online Payment Credit & Debit Card Form Validation

By | October 27, 2018

Online payment option form like Credit Card & Debit Card Details with Validation using JavaScript for validate the payment details form. VISA, MASTER CARD and more bank card details we validate in this form. Developed using Bootstrap, jQuery, jQuery Validation Plugin, jQuery.payment library, and Stripe.js. AJAX form submission with visual feedback. This demo will create Stripe credit card token.

Demo / Download

Author wmhilton
Created April 17, 2018
Compatible browsers Chrome, Firefox, Safari


  <link href="" rel="stylesheet" id="bootstrap-css"> <script src=""></script> <script src=""></script>  <link rel="stylesheet" href=""> <script type="text/javascript" src=""></script> <script type="text/javascript" src=""></script>  <!-- If you're using Stripe for payments --> <script type="text/javascript" src=""></script>  <div class="container">     <div class="row">         <!-- You can make it whatever width you want. I'm making it full width              on <= small devices and 4/12 page width on >= medium devices -->         <div class="col-xs-12 col-md-4">                               <!-- CREDIT CARD FORM STARTS HERE -->             <div class="panel panel-default credit-card-box">                 <div class="panel-heading display-table" >                     <div class="row display-tr" >                         <h3 class="panel-title display-td" >Payment Details</h3>                         <div class="display-td" >                                                         <img class="img-responsive pull-right" src="">                         </div>                     </div>                                     </div>                 <div class="panel-body">                     <form role="form" id="payment-form" method="POST" action="javascript:void(0);">                         <div class="row">                             <div class="col-xs-12">                                 <div class="form-group">                                     <label for="cardNumber">CARD NUMBER</label>                                     <div class="input-group">                                         <input                                              type="tel"                                             class="form-control"                                             name="cardNumber"                                             placeholder="Valid Card Number"                                             autocomplete="cc-number"                                             required autofocus                                          />                                         <span class="input-group-addon"><i class="fa fa-credit-card"></i></span>                                     </div>                                 </div>                                                         </div>                         </div>                         <div class="row">                             <div class="col-xs-7 col-md-7">                                 <div class="form-group">                                     <label for="cardExpiry"><span class="hidden-xs">EXPIRATION</span><span class="visible-xs-inline">EXP</span> DATE</label>                                     <input                                          type="tel"                                          class="form-control"                                          name="cardExpiry"                                         placeholder="MM / YY"                                         autocomplete="cc-exp"                                         required                                      />                                 </div>                             </div>                             <div class="col-xs-5 col-md-5 pull-right">                                 <div class="form-group">                                     <label for="cardCVC">CV CODE</label>                                     <input                                          type="tel"                                          class="form-control"                                         name="cardCVC"                                         placeholder="CVC"                                         autocomplete="cc-csc"                                         required                                     />                                 </div>                             </div>                         </div>                         <div class="row">                             <div class="col-xs-12">                                 <div class="form-group">                                     <label for="couponCode">COUPON CODE</label>                                     <input type="text" class="form-control" name="couponCode" />                                 </div>                             </div>                                                 </div>                         <div class="row">                             <div class="col-xs-12">                                 <button class="subscribe btn btn-success btn-lg btn-block" type="button">Start Subscription</button>                             </div>                         </div>                         <div class="row" style="display:none;">                             <div class="col-xs-12">                                 <p class="payment-errors"></p>                             </div>                         </div>                     </form>                 </div>             </div>                         <!-- CREDIT CARD FORM ENDS HERE -->                                   </div>                              <div class="col-xs-12 col-md-8" style="font-size: 12pt; line-height: 2em;">             <p><h1>Features:</h1>                 <ul>                     <li>As-you-type, input formatting</li>                     <li>Form field validation (also as you type)</li>                     <li>Graceful error feedback for declined card, etc</li>                     <li>AJAX form submission w/ visual feedback</li>                     <li>Creates a Stripe credit card token</li>                 </ul>             </p>             <p>Be sure to replace the dummy API key with a valid Stripe API key.</p>                          <p>Built upon: Bootstrap, jQuery,                  <a href="">jQuery Validation Plugin</a>,                  <a href="">jQuery.payment library</a>,                 and <a href="">Stripe.js</a>             </p>         </div>              </div> </div>  

CSS Code

 body { margin-top:20px; }   .credit-card-box .panel-heading img {     min-width: 180px; } 


Online Payment Form Validation Preview