#dimitar_php-expansion
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1220758819148267621
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- dimitar_api, 1 hour ago, 40 messages
Hi @pulsar peak ๐ can you tell me a bit more about the problem/behavior you're experiencing.
Balance Transactions aren't referenced directly from Payment Intent objects. The Payment Intent references a Charge object, then that Charge object links to the Balance Transaction.
Hi @earnest moat yes it looks like the response is different now, previously it contained an array with all charges and result[balance_transaction] array, now it looks really stripped down.
i see [latest_charge] => ch_3OxAEWJmWnRJHtVt0eGvYCfD
but not the charge object
What code are you running? My suspicion is you were expanding charges and now need to adjust that to instead expand latest_charge.
$intent = \Stripe\PaymentIntent::retrieve($intent_id, ['stripe_account' => $connected_stripe_account_id]);
$intent->capture(null, ['stripe_account' => $connected_stripe_account_id]);
Maybe?
Do you need the full contents of the Balance Transaction? If so, I'd recommend expanding latest_charge.balance_transaction there.
Yes i need the full contents and of the charge as well, i just tried this
$intent = \Stripe\PaymentIntent::retrieve($intent_id, [
'stripe_account' => $connected_stripe_account_id,
'expand' => ['latest_charge.balance_transaction']
]);
$intent->capture(null, ['stripe_account' => $connected_stripe_account_id]);
but it doesnt seem like to do anything
Also hopping in here since toby has to head out soon - the latest verrsion of the stripe PHP SDK is pinned to API version 2023-10-16, which is why you're seeing changes to the API response. More specifically, Payment Intents were changed to no longer include the charges property and have latest_charge instead (https://docs.stripe.com/upgrades#2022-11-15)
We call this out in the changelog as well: https://github.com/stripe/stripe-php/blob/master/CHANGELOG.md#1300---2023-10-16
Oh it makes sense now, ok is there any way to expand the latest_charge within payment intent retrieve?
The charges property on PaymentIntent has been removed. You can use the latest_charge property instead.
i tried 'expand' => ['latest_charge']
or do i just need to make separate call?
Can you show me the exact code you used to expand? It shouldn't need a separate call, so there may be something subtly wrong with your code
its just this
i as well tried to add 'expand' => ['latest_charge'] to the capture method to the $opts var
I believe you need to move expand - you want smoething more like this:
$pi = $stripe->paymentIntents->retrieve('pi_123',
['expand'=> ['customer']]
['stripe_account' => 'acct_123']
);
hmmm that way it doesn't detect the connect stripe
No such payment_intent: 'pi_3OxAZXJmWnRJHtVt0tDwgxsP'
$stripe_opts = [
'stripe_account' => $connected_stripe_account_id,
['expand' => ['latest_charge']]
];
neither this works
Actually give me a second - you're using the slightly older way, so let me just tweak my code slightly
ok
Here we go:
$pi = \Stripe\PaymentIntent::retrieve(
[
'id'=>'pi_123',
'expand'=> ['latest_charge']
],
['stripe_account' => 'acct_123']
);
dimitar_php-expansion
Yay! Thank you so much, this works!
awesome!
im looking to define payment_method_types when creating payment intent, how to allow: card, apple pay and google pay, i dont see a list with all possible keys?
or card includes apple pay and google pay?
Yup, apple pay and google pay would be included with card