#masthema-balancetransaction-fee

1 messages ยท Page 1 of 1 (latest)

fierce trellisBOT
inland patio
#

Do you have the ID of the payment intent that you tried this for? If it was successful, that fee should show up there

mystic holly
#

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)

inland patio
#

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

mystic holly
#

this is what I get using the call I wrote above

inland patio
#

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)

mystic holly
#

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

inland patio
#

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

mystic holly
#

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

inland patio
#

The balance transaction is the object with the fee info, not the charge

mystic holly
#

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

inland patio
#

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.

mystic holly
#

sure! thank you for that

#

req_xUPSizsij0G3vP

inland patio
#

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

modest crest
#

๐Ÿ‘‹ you're on an older API version that doesn't have latest_charge

mystic holly
#

Give me 2 min to check please

#

@modest crest - i already expanded that, though.

modest crest
#

Where?

#

masthema-balancetransaction-fee

mystic holly
#

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'], ]);

modest crest
#

I mean that's not what I said at all though ๐Ÿ˜…

mystic holly
#

aah i'm sorry, you meant "charge"

modest crest
#

chargeS

#

basically you use an old API version

mystic holly
#

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

modest crest
#

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

mystic holly
#

thank you very much! Have a great new year!