#terrybad-fee
1 messages · Page 1 of 1 (latest)
When you retrieve the payment intent, expand data.charges.data.balance_transaction
You can get this as the fee property on the balance_transaction for the charge that succeeded on this payment
Thanks
I don't get the decimal value though only a string..
"balance_transaction" => "txn_3JpCsnL7TANue3FT0LdCngIo"
That is the ID, you will need to look that up
Also I was slightly wrong, you would expand charges.data.balance_transaction if this is the retrieve call
ahh ok is that via
GET /v1/balance_transactions/:id
You can, but you cal also use expansion when making the PI call, that way you get all of this in one call https://stripe.com/docs/api/expanding_objects
So yes, try either and let me know how it works
$paymentIntent = PaymentIntent::retrieve(
$intentId,
[
'expand' => ['charges.data.balance_transaction']
]
);
the expand flag didn't seem to do anything to the response here (php stripe sdk)
use Stripe\PaymentIntent;
BalanceTransaction::retrieve($id)
works
seperate request
$balanceTransaction = BalanceTransaction::retrieve($paymentIntent->charges->data[0]->balance_transaction);
Interesting. When I do that myself it definitely expands the full balance transaction
Can you send me the request ID for that retrieve? (req_123)
paymentIntent ID pi_3JpDDoL7TANue3FT0w27kuSy
balance_transaction txn_3JpDDoL7TANue3FT0kcLPwS9
I more meant the req_123 of trying to retrieve the actual payment intent https://stripe.com/docs/api/request_ids