#dimitar_php-expansion

1 messages ยท Page 1 of 1 (latest)

brazen sparrowBOT
#

๐Ÿ‘‹ 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.

lost ibexBOT
#

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.

earnest moat
#

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.

pulsar peak
#

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

earnest moat
#

What code are you running? My suspicion is you were expanding charges and now need to adjust that to instead expand latest_charge.

pulsar peak
#
    $intent = \Stripe\PaymentIntent::retrieve($intent_id, ['stripe_account' => $connected_stripe_account_id]);
    $intent->capture(null, ['stripe_account' => $connected_stripe_account_id]);
lost ibexBOT
pulsar peak
#

well thats my code

#

maybe the previous SDK extended this details by default?

earnest moat
#

Maybe?

Do you need the full contents of the Balance Transaction? If so, I'd recommend expanding latest_charge.balance_transaction there.

pulsar peak
#

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

hallow axle
#

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)

pulsar peak
#

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?

hallow axle
#

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

pulsar peak
#

its just this

#

i as well tried to add 'expand' => ['latest_charge'] to the capture method to the $opts var

hallow axle
#

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']
);
pulsar peak
#

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

hallow axle
#

Actually give me a second - you're using the slightly older way, so let me just tweak my code slightly

pulsar peak
#

ok

hallow axle
#

Here we go:

$pi = \Stripe\PaymentIntent::retrieve(
  [
    'id'=>'pi_123',
    'expand'=> ['latest_charge']
  ],
  ['stripe_account' => 'acct_123']
);
brazen sparrowBOT
#

dimitar_php-expansion

pulsar peak
#

Yay! Thank you so much, this works!

hallow axle
#

awesome!

pulsar peak
#

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?

hallow axle
#

Yup, apple pay and google pay would be included with card

pulsar peak
#

great

#

now i need to migrate 20 different webviews to the new Payment Element ๐Ÿฅฒ