#jcu1012-stripe-fee
1 messages · Page 1 of 1 (latest)
Hello. You'll likely need to do some expanding on nested fields, similar to: https://stripe.com/docs/expand/use-cases#charges-in-payout
Can you share the code you're calling now?
/ Setup raw transactions value
const transactionsRaw = await stripe.balanceTransactions
.list({
expand: [
'data.source.balance_transaction',
'data.source.charge',
'data.source.customer',
'data.source.charge.customer'
],
limit: 100
})
.autoPagingToArray({ limit: 10000 })
// Setup list of fees
const fees = transactionsRaw.filter(
(transaction) => transaction.reporting_category === 'fee'
)
// Print in transaction
console.log(fees)
Why not pass the type fee when using the list endpoint? https://stripe.com/docs/api/balance_transactions/list#balance_transaction_list-type
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
What is not in the response that you're expecting?
Indeed, passing stripe_fee as type in the list endpoint simplifies the code. However, it doesn't solve the problem.
Here is an example of an item retrieved
{
id: 'txn_1JN0OoHS4I0tfsw4LpyJsyhd',
object: 'balance_transaction',
amount: -48,
available_on: 1628622846,
created: 1628622846,
currency: 'eur',
description: 'Billing (2021-08-08): Subscriptions',
exchange_rate: null,
fee: 0,
fee_details: [],
net: -48,
reporting_category: 'fee',
source: null,
status: 'available',
type: 'stripe_fee'
}
as you can notice, there is no information about the customer.
How should I get that information?
Ah, you can't get payments relating to Billing fees specifically as they're all grouped