#Alex-LeanXcale

1 messages ยท Page 1 of 1 (latest)

glossy axleBOT
pseudo thunder
#

And what error did you have?

willow edge
#

No error, I just don't have the tax section in the response

#

Maybe the syntax of the expand parameter is not correct?

ember juniper
#

๐Ÿ‘‹ taking over for my colleague. would you mind sharing the code your using?

willow edge
#

Yeah, let me prepare a code snippet for you.

ember juniper
#

yes that would be great

willow edge
#

Actually it's very simple

#

I don't know if this is enough for you ...

#

use Stripe\Customer;

$stripeUserInfo = Customer::retrieve($stripeUserID, ['expand' => ['tax']]);

$automatic_tax = $stripeUserInfo['tax']['automatic_tax'];

#

And if I try to print the value of automatic_tax I get the following

#

automatic_tax: [] []

#

Hope this is enough, I'm sorry but Im'm completelly new in Stripe and also in PHP ๐Ÿ˜ณ

#

I appreciate so mucho your time and help

ember juniper
#

no worries

#

let me take a look

willow edge
#

Thanks a lot!

ember juniper
#

ok so basically the retrieve function in PHP works a bit differently

#

you need to pass in the id and the expand like so

#

$stripeUserInfo = Customer::retrieve(['id'=> $stripeUserID, 'expand' => ['tax']]);

#

would you mind trying that out

willow edge
#

Yeah, sure!. I have a meeting right now, but I'll try and let you know.

#

Thanks!!

ember juniper
#

let me know if you need any more help

willow edge
#

Yeah! Now the tax section is correctly expanded

#
        (
            [automatic_tax] => supported
            [ip_address] => 
            [location] => Stripe\StripeObject Object
                (
                    [country] => ES
                    [source] => billing_address
                    [state] => 
                )

        )

    [tax_exempt] => none
    [test_clock] => 
)
#

But how can I get the automatic_tax value?

#

I was trying like this:

#

$automatic_tax = $stripeUserInfo['tax']['automatic_tax'];

#

Ahhhh, forget about it!!!

#

My mistake

#

It's completelly OK

#

Many thanks for this!!!

ember juniper
#

no worries, I'm glad it worked out for you

#

let me know if you need any more help

willow edge
#

Sure!, have a great day!