Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stripe not an object #34

Open
livvyjeffs opened this issue May 20, 2015 · 1 comment
Open

Stripe not an object #34

livvyjeffs opened this issue May 20, 2015 · 1 comment

Comments

@livvyjeffs
Copy link

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
Copy link
Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant