#richie138
1 messages · Page 1 of 1 (latest)
Hello, can you send me your code that is getting this error?
sure
"get",
"/v1/charges/search",
[
"query" => "payment_method_details.card.last4:" . $last4
],
[]
);
foreach($searchResult->data as $charge) {
$foundCustomer = $stripe->customers->retrieve($charge->customer);
$foundCustomer->subscriptions = $stripe->subscriptions->all(['customer' => $foundCustomer->id,'limit' => 100]);
$foundCustomer->charge = $charge;
if (strpos($response,$foundCustomer->id) === false) {
$response = $response . json_encode($foundCustomer,JSON_PRETTY_PRINT) . ',';
}
}
```
Basically, from a last4 digits, I'm finding the charges, then finding the customer(s), and thier subscription(s) and outputting as JSON
I'm not sure what has changed that I'm getting the error, as all was well in the beta for a long time
Thank you. That code does look fine as far as I can see now. Do you have the request ID (req_123) from a time that you got this error?
If not, can you try making the call again and get your ID either with this method[1] or from your dashboard[2]?
[1] https://stripe.com/docs/api/request_ids
[2] https://dashboard.stripe.com/test/logs
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
req_VzqdKxDFsLP0oB
Yes, but the response is the error text above
So I'm thinking the BETA endpoint maybe was returning something that the new endpoint no longer is, or is in some way incompatible with my version of stripe-php perhaps
Was hoping to seek some insight before I start trial and error and breaking things worse
So it looks like this is an exception being thrown locally. https://github.com/stripe/stripe-php/blob/ef98d5b4/lib/Service/AbstractService.php#L97
And to be clear, you are getting this on your $searchResult = $stripe->request call?
Is it possible that that exception is getting thrown at a later line?
From the stack trace it seems to be here $foundCustomer = $stripe->customers->retrieve($charge->customer);
I think this error might be coming from $charge->customer being null or an empty string. Can you print out its value and see if you get null or empty right before this exception?
Great to hear! Let me know if you run in to anything else