#alex-expand-php

1 messages ยท Page 1 of 1 (latest)

rocky acornBOT
#

Hello! We'll be with you shortly. 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.

finite cosmos
#

I try both way, no error

little swallow
#

alex-expand-php

#

@finite cosmos you want $stripe_invoice = \Stripe\Invoice::retrieve([ 'id' => $payment_intent->invoice, 'expand' => ['latest_charge', 'invoice.balance_transaction'], ]);
You're using a pretty old approach in php that requires this hack

rocky acornBOT
finite cosmos
#

I honestly don't care how to do it, I want to get fees charged by stripe for each invoice which got paid for subscription

#

regular and prorated invoices

#

if there is better way to do it please let me know

little swallow
#

I did give you the way, and then I linked you to the exact page that explains the alternative

finite cosmos
#

you said it is hack ๐Ÿ™‚

silent monolith
#

Well it's just a tweak in how to call the API. Could you just try the code?

finite cosmos
#

trying now

#

looking at code, looks I need to create checkout session/

#

?

#

I don't have checkout session

#

do I need to do for each invoice stripe subscription creates?

silent monolith
#

The example code above is just about \Stripe\Invoice:retrieve Why would you need Checkout Session ๐Ÿ™‚

finite cosmos
#

๐Ÿ˜„ oh, the code you put inside of chat, I was looking at link sorry

#

This property cannot be expanded (latest_charge).

#

Error: This property cannot be expanded (latest_charge).

silent monolith
#

Can you provide its Invoice Id here?

finite cosmos
#

I think I figure out -> $stripe_invoice = \Stripe\Invoice::retrieve([
'id' => $payment_intent->invoice,
'expand' => ['charge', 'charge.balance_transaction'
],
]);

#

should be charge and charge.balance_transaction'

#

is it correct?

#

in_1OAMpKHxrjf17jEDWvHAu8cW