stripe-meteor icon indicating copy to clipboard operation
stripe-meteor copied to clipboard

Stripe not an object

Open livvyjeffs opened this issue 9 years ago • 1 comments

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');
        });

    }
});

livvyjeffs avatar May 20 '15 11:05 livvyjeffs

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?

livvyjeffs avatar May 20 '15 11:05 livvyjeffs