Reputation: 5320
I'm using stripe v7.6.0 with typescript node app. I'm trying to create a new plan (for a subscription) on a connected account. Here's my snippet:
const stripeAccount = "acct_2Gk346Btfer3fzH9";
plan = await this.stripe.plans.create({
amount,
currency,
interval,
product: {
name: productName,
},
}, { stripeAccount });
A per-request Stripe-Account header for use with Stripe Connect can be added to any method:
// List the balance transactions for a connected account: stripe.balanceTransactions.list( { limit: 10, }, { stripeAccount: 'acct_foo', } );
All methods can accept an optional options object containing one or more of the following:
...
stripe.charges.refund(chargeId, { amount: 500, }, { stripeAccount: connectedAccountId, });
Based on the links above, I assume my code should work fine. But I get an error:
(node:9737) UnhandledPromiseRejectionWarning: Error: Stripe: Unknown arguments ([object Object]). Did you mean to pass an options object? See https://github.com/stripe/stripe-node/wiki/Passing-Options. (on API request to POST
/plans
)
How can I fix this error?
Upvotes: 1
Views: 1333
Reputation: 5320
This is huge. Snake case instead of camelCase.
Working example:
plan = await this.stripe.plans.create({
amount,
currency,
interval,
product: {
name: productName,
},
}, { stripe_account: stripeAccount });
Upvotes: 4