我将stripe v7.6.0与typescript节点应用程序一起使用。我正在尝试在一个已连接的帐户上创建一个新计划(用于订阅(。这是我的片段:
const stripeAccount = "acct_2Gk346Btfer3fzH9";
plan = await this.stripe.plans.create({
amount,
currency,
interval,
product: {
name: productName,
},
}, { stripeAccount });
Github表示:
可使用Stripe Connect的每个请求的Stripe Account标头添加到任何方法:
// List the balance transactions for a connected account: stripe.balanceTransactions.list( { limit: 10, }, { stripeAccount: 'acct_foo', } );
Stripe节点wiki:
所有方法都可以接受包含一个或以下更多内容:
stripe.charges.refund(chargeId, { amount: 500, }, { stripeAccount: connectedAccountId, });
基于上面的链接,我认为我的代码应该可以正常工作。但我得到了一个错误:
(节点:9737(未处理的PromiseRetention警告:错误:条纹:未知参数([object object](。你的意思是传递一个选项对象吗?看见https://github.com/stripe/stripe-node/wiki/Passing-Options.(在API请求POST
/plans
(
如何修复此错误?
这是巨大的Snake案例而不是camelCase。
工作示例:
plan = await this.stripe.plans.create({
amount,
currency,
interval,
product: {
name: productName,
},
}, { stripe_account: stripeAccount });