#Mahesh K
1 messages · Page 1 of 1 (latest)
hello!
hi alex!
how are you?
how can we do paginaition while retreiving large data from stripe?
the Stripe SDKs have auto pagination built in : https://stripe.com/docs/api/pagination/auto
await stripe.customers.list().autoPagingEach(async (customer) => {
await doSomething(customer);
if (shouldBreak()) {
return false;
}
});
console.log('Done iterating.');
i didn't understand the terms in this code.
what specifically don't you understand?
i will tell what i am doing.
i am fetching list of all payouts and adding all the net amount.
by running a for loop for the response given by the payouts.list api.
alright, so what issues are you having when using auto pagination? what have you tried?
alex😢
let balanceDeposited = 0
for await (const pay of stripe.payouts.list({limit:2})){
balanceDeposited += pay.amount /100
}
its not working
what's not working?
i am getting incorrect value.
sorry
i forgot to mention my connect account id
let balanceDeposited = 0
for await (const pay of stripe.payouts.list({limit:2},{ stripeAccount: accountID })){
balanceDeposited += pay.amount /100
}
i'm sorry but i don't understand what's the issue. You're just pasting your code, but you're not explaining what is the issue - what value are you expecting to get, what did you get instead
in this code i didn't mention the my stripe connect account id. so i am getting all my main account values.
but in this code i have included the stripe connect account id , then i am getting all the results that i want.
not an issue. i unable to explain that time.
how to list all the failure charges.
the list charges API doesn't have a status parameter to filter by. You could retrieve all charges, and then do your own filtering by the status.
Alternatively, you can also consider using the Search API : https://stripe.com/docs/api/charges/search - https://stripe.com/docs/search#query-fields-for-charges and you can filter by the status
alex, what is this charge??
{
"id": "txn_1MyqwJJFyf0NJAEUFguOsDU8",
"object": "balance_transaction",
"amount": -300,
"available_on": 1681971955,
"created": 1681971955,
"currency": "usd",
"description": "Connections Verification (2023-04-01 - 2023-04-30)",
"exchange_rate": null,
"fee": 0,
"fee_details": [],
"net": -300,
"reporting_category": "fee",
"source": null,
"status": "available",
"type": "stripe_fee"
},
If you reach out to Stripe Support https://support.stripe.com/contact, they should be able to help explain what charge that's for
we're not so familiar with Stripe fees here on this channel
ok alex