作成済みのストライプ顧客から接続済みアカウントのトークンを生成しようとすると、顧客 ID が存在しないというエラーが表示され続けます。そうは言っても、私は顧客が作成されているという事実を知っています。
コードは次のとおりです。
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
});
API バージョン 2016-03-07 (最新) を使用しています。
私はすでに 2 時間のデバッグに費やし、stackoverflow を調べました。ありがとう!