I am trying to initialize the client for the first time. I have a form where they sign up and that's it, and they submit it. The following happens on the client:
var cardValues = AutoForm.getFormValues('credit-card-form').insertDoc; Stripe.createToken(cardValues, function (err, token) { if (!err && token) { Meteor.call('Stripe.initializeCustomer', token); } });
On the server, I'm trying to do something like this:
Meteor.methods({ 'Stripe.initializeCustomer': function (token) { var Stripe = StripeAPI(process.env.STRIPE_KEY); // some validation here that nobody cares about Stripe.customers.create({ source: token }).then(function (customer) { return Stripe.customers.createCard(customer.id, { source: token }) }).catch(function (error) { // need to do something here }) } });
It would seem that the Stripe API is not like
Raw Failure Error: You cannot use the Stripe marker more than once
Is there a canonical way to make multiple server requests for a single token?
source share