2021年4月10日星期六

Stripe Java- List Price Filter

I have been trying to filter the price records by active, product & lookup_keys. Here is the snippet of the code:

public Price getPrice(String productId, String priceLookupKey) {          Map<String, Object> params = new HashMap<>();          params.put("lookup_keys", priceLookupKey);          params.put("product", productId);          params.put("active", true);          params.put("limit", 3);          PriceCollection priceCollection = Price.list(params);          List<Price> prices = priceCollection.getData();          if (prices.isEmpty())              return null;          return prices.get(0);      }  

Getting below error:

com.stripe.exception.InvalidRequestException: Invalid array; request-id: req_xeP0JR6RoY1Him      at com.stripe.net.LiveStripeResponseGetter.handleApiError(LiveStripeResponseGetter.java:158) ~[stripe-java-20.45.0.jar:20.45.0]      at com.stripe.net.LiveStripeResponseGetter.request(LiveStripeResponseGetter.java:61) ~[stripe-java-20.45.0.jar:20.45.0]      at com.stripe.net.ApiResource.request(ApiResource.java:179) ~[stripe-java-20.45.0.jar:20.45.0]      at com.stripe.net.ApiResource.requestCollection(ApiResource.java:199) ~[stripe-java-20.45.0.jar:20.45.0]      at com.stripe.model.Price.list(Price.java:175) ~[stripe-java-20.45.0.jar:20.45.0]      at com.stripe.model.Price.list(Price.java:168) ~[stripe-java-20.45.0.jar:20.45.0]      at com.iclinica.closefriend.payment.service.StripePaymentService.getPrice(StripePaymentService.java:91) ~[classes/:na]  

Using only those parameters which are described at https://stripe.com/docs/api/prices/list?lang=java#list_prices, Is this a mistake in the docs, or am I missing something important?

https://stackoverflow.com/questions/67030980/stripe-java-list-price-filter April 10, 2021 at 01:03PM

没有评论:

发表评论