#TzarBuba-reports
1 messages · Page 1 of 1 (latest)
@hexed basin if you're coding this yourself, then https://stripe.com/docs/expand/use-cases#stripe-fee-for-payment should help, that's how you take a given payment and get the Stripe processing fees for it
Hey, let me a few minutes to see it
yes I'm doing it myself, using node
oh, that is kind of different from what I started doing
I started with stripe.charges.list()
so it's better to use stripe.paymentIntents.list()
that works too, PaymentIntents ultimately create Charges
and then use this prop expand
but i cant find the fees there
unless I use like n2 forloop and on every charge payment retrieving the expand property
sorry for my english
i have to investigate more about this prop expand
you can pass expand when listing
if it helps you can look at this thread https://discord.com/channels/841573134531821608/931144000008757268 where someone was doing the same thing an hour ago
for example you pass expand=['data.balance_transaction'] when listing Charges so that the fee is returned as part of the response
I have to see the response of this call
I assume it would be like { amount: 1000, // number or string fees: 100, // number or string stripe_fees: 12, // number or string }
this is my goal
if I'm able to get such information from charges/paymentintents it would be great
you can make it in test mode and see
probably the prop is data.balance_transaction
no it wouldn't, but you can parse the response and create it
don't know what you mean by prop
since you seem very lost give me a minute to write some code
balance_transaction: {
fee: 539,
fee_details: [ [Object] ],
net: 16331,
}
now I will check the fee details
probably it will have everything
in this code expand is prop
stripe.charges.list({ expand: ['data.balance_transaction'] })
yep
I don't know how to explain myself in english sorry
here's roughly what I would do anyway
stripe.charges.list({limit: 3, expand:["data.balance_transaction"], created:{gte:"1641994539"}, status:"paid"})
.autoPagingEach(function(charge) {
console.log(charge.amount)
if(charge.balance_transaction){
for(let fee of charge.balance_transaction.fee_details){
console.log(fee.amount)
console.log(fee.type)
}
}
});
this response looks ok
{
amount: 539,
application: null,
currency: 'bgn',
description: 'Stripe processing fees',
type: 'stripe_fee'
}
],```
yeah exactly
created:{gte:"1641994539"}, would list only charges after date
woah 🤯
and autoPagingEach is forlooping in the api
I've been amazed right now
🙂
about the fees
is there different types of fee, I mean, I have to find a test card that make fees like bank fee or transaction fee, because all my balance_transaction have type: 'stripe_fee'
the possible types are at https://stripe.com/docs/api/balance_transactions/object?lang=node#balance_transaction_object-fee_details-type
application_fee is if you're looking at a Charge on your account created by a Connect platform that took a slice of the payment (https://stripe.com/docs/connect/direct-charges#flow-of-funds-with-fees)
stripe_fee is our fee per our pricing pages on stripe.com/pricing
tax is the value-added-tax we take on the fee in certain countries
those are the only possibilities
Hey there @hexed basin I just wanted to confirm that my teammate was able to get you the information you were looking for?