我正在尝试设置条带连接,但在创建费用时出现错误。知道我做错了什么吗?
客户
Stripe.setPublishableKey([CUSTOMERS_PUBLISHABLE_KEY]);
Stripe.card.createToken({
number: card.number,
cvc: card.cvc,
exp_month: card.exp.month,
exp_year: card.exp.year
}, stripeResponseHandler);
对此调用的响应如下所示:
{
"id": "tok_169ZyxF6SmAjeAPKC9YF7YAi",
"livemode": false,
"created": 1433330667,
"used": false,
"object": "token",
"type": "card",
"card": {...}
},
"client_ip": "..."
}
服务器
var stripe = require('stripe')(config.stripeSecretKey);
stripe.charges.create({
amount: totalPrice,
application_fee: appFee,
currency: 'usd',
source: paymentToken, // from above: tok_169ZyxF6SmAjeAPKC9YF7YAi
destination: [CUSTOMERS_STRIPE_USERID]
}, function(err, charge){
if (err)
// Error: There is no token with ID tok_169ZyxF6SmAjeAPKC9YF7YAi.
// at Error._Error (c:\dev\leaguespeed-node\node_modules\stripe\lib\Error.js:12:17)
// at Error.module.exports.protoExtend.Constructor (c:\dev\leaguespeed-node\node_modules\stripe\lib\utils.js:113:13)
// at Error.module.exports.protoExtend.Constructor (c:\dev\leaguespeed-node\node_modules\stripe\lib\utils.js:113:13)
// at Function.StripeError.generate (c:\dev\leaguespeed-node\node_modules\stripe\lib\Error.js:56:14)
// at IncomingMessage.StripeResource._responseHandler (c:\dev\leaguespeed-node\node_modules\stripe\lib\StripeResource.js:133:39)
// at IncomingMessage.emit (events.js:117:20)
// at _stream_readable.js:938:16
// at process._tickCallback (node.js:419:13)
return defer.reject(err);
else
{
defer.resolve(charge);
}
});