STRIPE Connect No such customer: cus_XYXXX23

Viewed 5992

While trying to generate a token for my connected account from my already created stripe customer, I keep on receiving an error saying that the customer id does not exist. That being said, I know for a fact that the customer is being created.

Here's the code:

var Stripe = StripeAPI('sk_test_key');

Stripe.customers.create({
  email: Meteor.user().emails[0].address,
  description: "SIDIM 2016",
  source: stripeToken
}).then(function(customer) {

  return Stripe.tokens.create({
    customer: customer.id
  }, {stripe_account: "acct_XXXYYYZZZ"});

}).then(function(token) {

  console.log(token);

  var charge = Stripe.customers.create({
    email: Meteor.user().emails[0].address,
    description: "SIDIM 2016",
    source: token.id
  }, {stripe_account: "acct_XXXYYYZZZ"});

  console.log(charge);

}).then(function(charge) {

  return Stripe.charges.create({
    amount: total,
    currency: 'usd',
    customer: charge.id
  }, {stripe_account: "acct_XXXYYYZZZ"});

}).catch(function(err) {
  // Deal with an error
});

I'm using API version 2016-03-07 (latest).

I've already spent 2 hours debugging and looked through stackoverflow. Thanks!

1 Answers
Related