#masthema-balancetransaction-fee
1 messages ยท Page 1 of 1 (latest)
Do you have the ID of the payment intent that you tried this for? If it was successful, that fee should show up there
Sure, I do! it's pi_3MMeDJKCXkxMSOdE0RFdJqvC
I can paste you what I receive, but there's nothing there in regards to a fee when I try to retrieve it
[amount] => 5900
[amount_received] => 5900
But I actually received less than that due to the fees. But I don't know how much they are
here's the API call I tried :
$paymentIntent = \Stripe\PaymentIntent::retrieve([ 'id' => 'pi_3MMeDJKCXkxMSOdE0RFdJqvC', 'expand' => ['latest_charge.balance_transaction'], ]);
I saw the "expand" thing online, thought it might work
Want me to paste you the reply I got?
(i do see the fees in the dashboard under that payment ID, but I need it in code to)
Yes, can you paste the reply that you get for that call? It looks like that balance transaction should exist and have a fee from my end
I am surprised by that. I do see the ID for txn_3MMeDJKCXkxMSOdE01ZAc7ck and looking that up should give you the fee, but if you pass 'expand' => ['latest_charge.balance_transaction'], it should give you the full object
Can you try that call again and send me the request ID from it? (req_123)
how do i get the request ID, please? in the reply I only have what I pasted, and I don't see it there
and can you please tell me what "txn_string" is? like, "pi_string" are payment intents. What's "txn_string"? So I can look up in docs how to look up txn_3MMeDJKCXkxMSOdE01ZAc7ck
txn_ IDs are for balance transaction objects, they represent changes to your account's balance. It looks like you have the right code for getting them, and the fee should be on the balance transaction object. The issue seems to be that that field is not actually expanding here for you
You can get request IDs here or via your dashboard's developer logs https://stripe.com/docs/api/request_ids
but even if it's not expanding, i can make a separate call for the charge
problem is, not even the charge call will return the fee
Was getting to that, you can retrieve the balance transaction through this call https://stripe.com/docs/api/balance_transactions/retrieve
The balance transaction is the object with the fee info, not the charge
aaah
give me a moment please to try, this looks like it should work
it wooorks!
you're a genius
thank you so much, i see the fees here
i'll need to make 2 calls, but that's life, i guess
might it be an issue in your PHP wrapper ?
long shot, i know, but it's weird
You shouldn't need to. That payment intent retrieve should be able to get it. Can you try making this call in your PHP code again and send me the request ID? I can check in to whether the parameter is getting passed along properly.
That request actually looks like it was for creating a customer. I do see your get request and the expand parameter does look to have been passed in correctly. I am trying to think of why the balance transaction wasn't expanded in your response here https://dashboard.stripe.com/test/logs/req_OKoxbdocsvESVx
๐ you're on an older API version that doesn't have latest_charge
Either you have to use the latest API version (see https://stripe.com/docs/api/versioning) or you have to expand charges.data.balance_transaction instead
I mean, I just thought the "expand" parameter would mean I'm expanding it
$paymentIntent = \Stripe\PaymentIntent::retrieve([ 'id' => 'pi_3MMeDJKCXkxMSOdE0RFdJqvC', 'expand' => ['latest_charge.balance_transaction'], ]);
I mean that's not what I said at all though ๐
aah i'm sorry, you meant "charge"
yeah, i saw that now, thank you!
Ah. Thank you so much!
Sorry about that, I'm using a plugin that's up to date and it provides Stripe
I was assuming that also means Stripe is up to date, but that was foolish of me
thank you very much for your patience with this
no worries you're not the first one confused by this. I'm flagging internally to see if we can add latest_charge to all API versions to just make it easier
thank you very much! Have a great new year!