#nimby_09436
1 messages · Page 1 of 1 (latest)
Hi there 👋 can you tell me more about what you're trying to do, are you trying to make a list request to retrieve a list of Customers?
Yes, list of customers with a given email address
Gotcha, can you share the snippet of code you're running that is encountering this error?
@GetMapping("/getCustomers")
public ResponseEntity<?> getStripeCustomers(@RequestParam String email) {
try {
List<Customer> customers = stripeService.getCustomersByEmail(email);
return ResponseEntity.ok(customers);
} catch (Exception e) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
}
}
public List<Customer> getCustomersByEmail(String email) throws StripeException {
Stripe.apiKey = secretKey;
CustomerCollection customers = Customer.list(
new HashMap<String, Object>() {{
put("email", email);
put("limit", 9999);
}}
);
return customers.getData();
}
In a controller file and a service file
I'm not sure if it's causing the error, but limit can't be that high. It caps at 100.
Okay thanks
I still have the error, do you have any other ideas? Is it related to the jackson version possibly?
I see No serializer found for class com.stripe.model.Customer$TestHelpers in the error you shared but no reference to test helpers in the snippet
Are you using test helpers?
Can you share the exact stripe-java version you use?
I'm using version 23.6.0 and no test helpers in my code
Are you seeing the request reaching Stripe in your logs? ie, is it failing on the way out, or in parsing the response?
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
I don't see any /customers in my logs
Sorry, I had it on post instead of get, I can now see the /customers
Any ideas?
Sorry, i should have been more specific, can you share the request ID that you see for this list request?
eg, req_123
sure: req_u1QAwsqZU7Fxrh
It sounds like the request is succeeding, but your client/sdk is failing to handle the result
Yes that's probably correct, just unsure what it is that is failing
Hmm looking at your code, i'm wondering if this is a mismatch between CustomerCollection and List<Customer>?
If the Customer.list() call succeeds, but then this breaks when you return customers.getData();
Okay, the getStripeCustomers previously had a return type of ResponseEntity<List<Custome>> which failed to run, so I think that would suggest that too
Is there a way I can resolve that?
Well where do things break?
Does this part work:
CustomerCollection customers = Customer.list(
new HashMap<String, Object>() {{
put("email", email);
put("limit", 9999);
}}
);
return customers.getData();
ie, can you log those customers or getData()?
Looping back here, since I need to step away soon: were you able to identify exactly where the error is thrown? Is it the return from your method, or somewhere else?