#richie138

1 messages · Page 1 of 1 (latest)

hearty spindleBOT
icy star
#

Hello, can you send me your code that is getting this error?

pulsar wedge
#

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

icy star
#

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

pulsar wedge
#

req_VzqdKxDFsLP0oB

icy star
#

Interesting, we show that call as returning successfully

#

Looking more in to that error

pulsar wedge
#

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

icy star
#

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?

pulsar wedge
#

From the stack trace it seems to be here $foundCustomer = $stripe->customers->retrieve($charge->customer);

icy star
#

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?

pulsar wedge
#

Sure working on it

#

Thank you

#

I've got it working

#

I think

icy star
#

Great to hear! Let me know if you run in to anything else

pulsar wedge
#

Thank you sir

#

Have a great day