#memekyTeam

1 messages ยท Page 1 of 1 (latest)

wooden canopyBOT
sinful gate
#

Hello

willow portal
#

Hello ๐Ÿ™‚

sinful gate
#

So it looks like you are retrieving multiple times here when really you can do this all in one go using expansion

#

You want to expand the latest_charge.balance_transaction when you retrieve the PaymentIntent

willow portal
#

Excuse me, but I don't understand. We are a team from Spain and this part is difficult for us due to the language issue.

#

The objective is to arrive with a payment id to the function below As shown in the picture

sinful gate
#

Instead of posting a picture can you post your code in text here using three backticks like: this

#

Then I can show you what to do

willow portal
#

okay

#

$PI = 'pi_3MMXAwFX2ddxx3Qo1hCKmRCX';
$intentA = \Stripe\PaymentIntent::retrieve($PI);
$latest_charge = $intentA->latest_charge->balance_transaction;

echo $latest_charge;
$intentB = $stripe->charges->retrieve(
$latest_charge,
['expand' => ['data', 'source']]
);

$IDBalanceTransactions = $intentB->expand->data->source;

$intentC = $stripe->balanceTransactions->retrieve(
$IDBalanceTransactions,
[]
);

#

It's okay like that?

sinful gate
#

That works

#

So all you should need is: $PI = 'pi_3MMXAwFX2ddxx3Qo1hCKmRCX'; $intentA = \Stripe\PaymentIntent::retrieve($PI, [ 'expand' => ['latest_charge.balance_transaction']);

#

Can you try that?

willow portal
#

$PI = 'pi_3MMXAwFX2ddxx3Qo1hCKmRCX';
$intentA = \Stripe\PaymentIntent::retrieve($PI);
$latest_charge = $intentA->latest_charge->balance_transaction;

$intentB = $stripe->charges->retrieve(
$latest_charge,
['expand' => ['latest_charge.balance_transaction']]
);

$IDBalanceTransactions = $intentB->expand->latest_charge.balance_transaction;

$intentC = $stripe->balanceTransactions->retrieve(
$IDBalanceTransactions,
[]
);

#

that's OK?

sinful gate
#

No you expand the latest_charge.balance_transaction when you retrieve the PaymentIntent

#

Not the Charge

willow portal
#

$PI = 'pi_3MMXAwFX2ddxx3Qo1hCKmRCX';
$intentA = \Stripe\PaymentIntent::retrieve($PI, [
'expand' => ['latest_charge.balance_transaction']]);

sinful gate
#

Yep

willow portal
#

$PI = 'pi_3MMXAwFX2ddxx3Qo1hCKmRCX';
$intentA = \Stripe\PaymentIntent::retrieve($PI, ['expand' => ['latest_charge.balance_transaction']]);

$cus = $intentA->expand->latest_charge.balance_transaction;

echo $cus;

#

Pardon my ignorance but to print it?

sinful gate
#

expand isn't a property

willow portal
#

Sorry*

sinful gate
#

try just printing $intentA

willow portal
#

okok

sinful gate
#

so echo $intentA

#

And you should see the entirety of the object

willow portal
#

$stripe->balanceTransactions->retrieve(
$unkown_variable,
[]
);

#

and the $unknown_variable is in there?

sinful gate
#

Hmm looks the expansion didn't work

willow portal
#

the goal is with a payment intent to reach the $variable_uknow

#

$unkown_variable*

sinful gate
#

Ooops try $paymentIntent = \Stripe\PaymentIntent::retrieve([ 'id' => 'pi_3MMXAwFX2ddxx3Qo1hCKmRCX', 'expand' => ['latest_charge.balance_transaction'], ]);

willow portal
#

it works ๐Ÿ™‚

#

thank you so much

sinful gate
#

๐Ÿ™‚

willow portal
#

echo $paymentIntent -> balance_transaction -> id;

#

how do i print it like this?

#

I'm sorry I know I look like a fool I'm giving you a lot of work

sinful gate
#

echo $paymentIntent -> latest_charge -> balance_transaction -> id;

#

No worries!

#

We are here to help

willow portal
#

Okay, thank you very much, it has helped me a lot. It is difficult for the team to understand English because we are all Spanish, really, thank you very much ๐Ÿ™‚ Have a good day, excellent service! gg ๐Ÿ™‚