简体   繁体   English

Stripe Node JS向客户收费

[英]Stripe Node js charge a customer

All I am trying to do is charge a customer like this: 我要做的就是向这样的客户收费:

var stripe = require("stripe")("sk_test_5uwvjas5uFYUCZN5d3YdAT19");

stripe.charges.create({
  amount: 1000,
 currency: "usd",
 customer: "cus_112121212", // CUSTOMER ID
 destination: {
          account: "{CONNECTED_STRIPE_ACCOUNT_ID}",
      },
}).then(function(charge) {
 // asynchronously called
});

According to the documentation: 根据文档:

https://stripe.com/docs/api/charges/create This should be possible, Yet i get the error: https://stripe.com/docs/api/charges/create这应该是可能的,但是我得到了错误:

there was an issue Error: No such token: cus_111212122112

Am I reading the docs wrong? 我读的文档错了吗? Thank you. 谢谢。

Review Firestripe example since it's in Node js. 查看Firestripe示例,因为它位于Node js中。

https://github.com/firebase/functions-samples/blob/master/stripe/functions/index.js https://github.com/firebase/functions-samples/blob/master/stripe/functions/index.js

If that doesn't help, confirm that customer have a source attached to it. 如果这样做没有帮助,请确认客户已附加源。 If not, then you can't charge that customer. 如果没有,那么您不能向该客户收费。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM