Good evening,
I am currently trying to create an object that will contain:
{
"acct_123": [
// result from calling stripe api
],
"acct_456": [
// result from calling stripe api
]
}
The parameter of my function is the list of stripeIds: ['acct_123', 'acct_456']
I tried this:
const fetchList = async (id: string) => {
const resp = await stripe.accounts.listExternalAccounts(
id,
{ object: "bank_account" },
{ apiKey }
)
return resp.data;
}
const bankAccoutFetchPromises: any = [];
stripeConnectAccountIds.map(async (id: string) => {
const bankAccountList = await stripe.accounts.listExternalAccounts(
id,
{ object: "bank_account" },
{ apiKey }
);
bankAccoutFetchPromises.push(bankAccountList.data);
});
Promise.all(bankAccoutFetchPromises);
Unfortunately this call only fetch the data for the first element in the array. 😐
Can you please help me with setting object key the id and the value the result from fetchList(id)?
Thanks! 🙂