javascript - 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
我读错了文档吗?谢谢你。
解决方案
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.
推荐阅读
- wordpress - WooCommerce 获取所有运输方式计算 API
- javascript - 保持与 react.js 相同的 socket.id
- postgresql - 检查值是否不等于选择查询时触发函数总是引发异常
- javascript - 语法错误:JSON.parse 中位置 0 的 JSON 中的意外标记 <
- haskell - 有效地替换二进制对象的一部分
- python - Python - 重命名元组列标题
- jquery - 搜索在 JQuery 自动完成下拉菜单中不起作用
- orm - 如何在不重新安装插件的情况下将表添加到商店软件数据库?
- windows-10 - Citrix Receiver 4.11 Windows 10 64位重复下载提示
- android - 将图像压缩到指定大小的最快方法是什么?