#ZakMcKraken

1 messages ยท Page 1 of 1 (latest)

foggy roostBOT
cunning cliff
#

what I'm trying to get is "tax": { "automatic_tax": "unrecognized_location", "ip_address": "172.29.0.1", "location": null },

#

which I get when I expand customers->create with "tax"

charred trench
#

Hello ๐Ÿ‘‹
Can you share the snippets of code that creates and retrieves the customer?

cunning cliff
#

however for retrieve it doesn't seem to work

#

hi ๐Ÿ™‚

#

the code is a little bit complex so I'm not sure that would be helpful

charred trench
#

As far as I know, yes.

#

Let me run a test

cunning cliff
#

my getCustomer function is fairly straightforward though

#
    {
        $this->setApiKey();

        $opts = ['stripe_account' => $this->network->stripe_user_id];

        if ($this->network->calculate_taxes) {
            $opts['expand'][] = 'tax';
        }

        return Customer::retrieve($stripe_cust_id, $opts);
    }```
charred trench
#

okay I do see the tax information when expanding in my tests.
Are you sure your expand parameter is being passed correctly?

cunning cliff
#

I'm not sure since the backend doesn't show much details for successful GET requests

#

If I dump $opts I see what (I think) is expected

#
  "stripe_account" => "acct_XXX"
  "expand" => array:1 [
    0 => "tax"
  ]
]```
#

but the customer object returned doesn't have the "tax" property

charred trench
#

hmm I'm not super familiar with how diff PHP syntaxes work

example in our docs have

  'ch_3K7iYRLAZYXcVxtG0y8UPBUv',
  ['expand' => ['customer', 'invoice.subscription']]
);```

and this if you have connected accounts at play

```$ch = $stripe->charges->retrieve(
  'ch_3K7iYRLAZYXcVxtG0y8UPBUv',
  [],
  ['stripe_account' => 'acct_1K7iPtLAZYXcVxtG']
);
cunning cliff
#

oh looks like there is a third parameter for that in that case

#

let me try

#

that's odd though because the stripe-php code doesn't show a third param

#

ok this is unexpected

#
            'id' => $stripe_cust_id,
        ];

        if ($this->network->calculate_taxes) {
            $params['expand'][] = 'tax';
        }

        return Customer::retrieve($params, ['stripe_account' => 'acct_XXX']);```
#

but this works

charred trench
#

Ah nice, glad that worked!

cunning cliff
#

I wonder if our stripe-php is out of date or if it's the doc

#

but thanks for the rubber ducking ๐Ÿ™‚

charred trench