Skip to content

Payment library by Stripe. A general purpose library for building credit card forms, validating inputs and formatting numbers.

Notifications You must be signed in to change notification settings

jeffpatzer/meteor-jquery-payment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Meteor Jquery Payment

Meteor package for Stripe's jQuery.payment library. For full documentation, see the jQuery.payment repository.

Example Usage

You can initialize formatting on a input during the render event.

Template.profileEdit.hooks({
  rendered: function () {

    // Format Card Number
    $('#creditCardNumber').payment('formatCardNumber');
    $('#creditCardCVV').payment('formatCardNumber');
  }
});

You can then check the validity of an input on form submit or what have you.

Template.profileEdit.events({
  'submit #stripePaymentForm': function(e) {
    e.preventDefault();
    var $form = $(e.target);
    var $cc = $form.find("#creditCardNumber").val();
    var $ccM = $form.find("#creditCardExpDateMonth").val();
    var $ccY = $form.find("#creditCardExpDateYear").val();
    var $cvc = $form.find("#creditCardCVC").val();

    // check for error
    var error = true;
    if (!$.payment.validateCardNumber($cc)) {
      error = "The credit card number is invalid";
    }else
    if (!$.payment.validateCardExpiry($ccM, $ccY)) {
      error = "The expiry values have an error.";
    }else
    if (!$.payment.validateCardCVC($cvc)) {
      error = "The CVC value has an error.";
    }else{
      error=false
    }

    // do more stuff

  }
});

Customize to your use.

About

Payment library by Stripe. A general purpose library for building credit card forms, validating inputs and formatting numbers.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published