stripe-meteor
stripe-meteor copied to clipboard
Stripe not an object
When I try to subscribe user with payments, it says Stripe is not an object. I'm guessing it's because it's before Meteor.startup is ready - how do I do this correctly?
Template.subscribe.events({
"click button.purchase": function(event, template){
$(template).find('status').text("You've purchased the dataset, thank you!");
ccNum = $('#ccnum').val();
cvc = $('#cvc').val();
expMo = $('#exp-month').val();
expYr = $('#exp-year').val();
Stripe.card.createToken({
number: ccNum,
cvc: cvc,
exp_month: expMo,
exp_year: expYr,
}, function(status, response) {
stripeToken = response.id;
Meteor.call('chargeCard', stripeToken);
});
Meteor.call('addSubscription', Meteor.userId(), ['subscribed'], function() {
console.log(Meteor.user().username + ' is now subscribed');
});
}
});
Also, can you explain how to make the "payment" button? Traditionally it's with:
<form><script .... /script></form>
but I tried that with Meteor and your package installed and it didn't work (I wasn't quite expecting it to), help on how to hook up the button and payment forms?