首页 > 解决方案 > Stripe Node js 向客户收费

问题描述

我要做的就是向这样的客户收费:

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
});

根据文档:

https://stripe.com/docs/api/charges/create 这应该是可能的,但我得到了错误:

there was an issue Error: No such token: cus_111212122112

我读错了文档吗?谢谢你。

标签: javascriptnode.jsstripe-payments

解决方案


Review Firestripe example since it’s in Node 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.


推荐阅读