#Reinhardt
1 messages · Page 1 of 1 (latest)
Do you see this with other calls/objects or just the customer?
Just this Customer object
and oddly enough just one Customer when others work perfectly fine
Can you send me the request ID from a time that you retrieved that customer and one from a time when you retrieved another customer properly? You may be able to find these IDs in your dashboard logs https://dashboard.stripe.com/test/logs or it may be easier to make both of those calls again and print out their request IDs https://stripe.com/docs/api/request_ids
well luckily I just found the Request ID for the weird Customer
req_IRKD6Dp0FebtDz
I'll find one for a successful one
Thank you, once i have the other request id, I can help further debug this.
ok here is another
req_F322FymK5oTmKS
however that one actually. has the bug intermittently
I'll find another just in case
From looking at the two requests I see that you're using the same php and SDK version. Since we don't log what is returned on these GET requests I was unable to see the issue.
When you say intermittent, how often does this happen?
Has it just started happening? Are you able to share a screenshot of when this happens vs. when it's working?
hmmm ok it is no longer intermittent
it seems to be an issue any time I do the Customer Retrieval
this is the error I get
Mar 21 19:28:29 3.99.252.237 logger [2023-03-22 02:28:28] staging.ERROR: Attempt to read property "id" on string {"userId":136,"exception":"[object] (ErrorException(code: 0): Attempt to read property \"id\" on string at /var/task/src/Domains/Payments/Doyo/Actions/AddCustomerPaymentMethodAction.php:60)
And when logging the API call I get this:
"Stripe\\Customer JSON: {
\"id\": \"cus_NZ1yJR4jqu193z\",
\"object\": \"customer\",
\"address\": null,
\"balance\": 0,
\"created\": 1679361753,
\"currency\": null,
\"default_source\": null,
\"delinquent\": false,
\"description\": null,
\"discount\": null,
\"email\": \"eden+client1@jetpack.to\",
\"invoice_prefix\": \"0249EABF\",
\"invoice_settings\": {
\"custom_fields\": null,
\"default_payment_method\": null,
\"footer\": null,
\"rendering_options\": null
},
\"livemode\": false,
\"metadata\": [],
\"name\": \"Eden Client\",
\"next_invoice_sequence\": 1,
\"phone\": null,
\"preferred_locales\": [],
\"shipping\": null,
\"tax_exempt\": \"none\",
\"test_clock\": null
}"}
and a json_decode of this just results to a NULL
@patent root can you share more code? There's no reason at all for you to use json_decode when using stripe-php
Like ultimately, you can do this
$stripe = new \Stripe\StripeClient('sk_test_123');
$customer = $stripe->customers->retrieve('cus_ABC', []);
echo $customer->id;```
So I'd recommend trying that first. I assume the error is not where you think it is
that is exactly where the error is
the error the log tells me,
shows up when I do
'customer' => $stripeCustomer->id,
Sure but that's one line of code. Where is $stripeCustomer coming from? Please share your exact code surrounding that line
ok
$stripeCustomer = Stripe::client()->customers->retrieve($user->stripe_customer_id, $params);
where Stripe::client() sets the API key in the background
Sure, then take that, and switch to my example, hardcode the key, hardcode the customer id, log the response, see what happens
ok
let me know what you get (and share the exact code, except hide your API key)
That seems to work in isolation
is there any settings in Laravel that might prevent this from working as expected?
No, my guess is that the code that is erroring is not what you think really
I'm fairly confident that if you change your code to
echo $stripeCustomer->id;``` that code just works fine. So the problem is somewhere else in your code, but it wouldn't be what our library returns at least
Thanks unfortunately. that still doesn't work for some reason.
But I have thought of a work around at this point
thanks for your time!
I'm really confused how this could not work unless Stripe::client() is not what you think it is and is a Laravel only thing