Reputation: 232
I have stripe platform with connected stripe accounts.
I would like to obtain all charges that have been made on a particular connected account.
User connected account id:
acct_xxx
The only documentation I can find is for retrieved customers based on secret api keys. https://stripe.com/docs/api/charges/list
const stripe = require('stripe')('sk_test_xxx');
const charges = await stripe.charges.list({
limit: 3,
});
I need to obtain all charges of a connected account. Not charges on the platforms customers.
I found a similar stack overflow question for ruby. Get a list of the charges on a Stripe account connected via Stripe Connect
I do not know how to achieve this using node.js
Upvotes: 2
Views: 714
Reputation: 3361
You need to pass the Stripe-Account header to make API calls "on Connect accounts": https://stripe.com/docs/connect/authentication#stripe-account-header
Most of Stripe's client libraries (like stripe-node) allow passing a parameter with each API call function, in the options hash, like:
const charges = await stripe.charges.list(
{
limit: 3,
},
{
stripeAccount: 'acct_12345'
}
);
Upvotes: 2