#alecpope
1 messages · Page 1 of 1 (latest)
Hi @fickle moat https://stripe.com/docs/search#query-structure-and-terminology You can't use AND and OR together because they are mutually exclusive.
So it is not possible to search for multiple products with a certain ID, that are also active?
it's not about IDs, it's just that AND and OR can't be used together.
Okay, but how is it possible to search for certain products that are active? I basically have an array of IDs and now I want to filter all products that have one of the ID in the array. Also one constraint is that these products need to be active
Sure, you can use the list products API (https://stripe.com/docs/api/products/list#list_products-active) and set active to true
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Oh okay. Would the filter then look like this?
params := &stripe.ProductListParams{}
params.Filters.AddFilter("active", "", "true")
params.Filters.AddFilter("ids", "", "prod_XXX,prod_YYY")
Can you give it a try?
Sure, one moment
It's not working. It returns no result, although the products exists
Hi! Can you share the request ID (req_xxx)? Here's how you can find it: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
params := &stripe.ProductListParams{
Active: stripe.Bool(true),
IDs: []*string{
stripe.String("prod_XXX"),
stripe.String("prod_YYY"),
},
}
Can you try this instead?
Sorry for the late reply. The request ID is req_Q8w1FY4xKoFidA. The error was that the is invalid. I will try you other approach now
Yeah, that works. Thanks!
Is there a way to do similar things with Payment Intents? Like filter on IDs and Customer?
https://stripe.com/docs/api/payment_intents/list?lang=go#list_payment_intents-customer you can filter payment_intents by a customer ID, but it doesn't have a ids param like Product list API.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Hmm. So how can I solve this? Just filter on customer and filter out received payment intents in my code?
What do you want to achieve here? if you already have the payment_intent ID, you can just call the retrieve API to retrieve the payment_intent object https://stripe.com/docs/api/payment_intents/retrieve?lang=node#retrieve_payment_intent
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I want to retrieve multiple payment intents based on IDs in one request
Not possible with the current API, I'm afraid.
You need to make multiple requests to retrieve the payment_intent one by one.
What about using the query language?
ID is not a query field for payment intents (https://stripe.com/docs/search#query-fields-for-payment-intents)
Hmm okay.
In general: it is not possible to have an AND and OR inside a query? For example: (id:'XXX' AND customer:'ZZZ') OR (id:'YYY' AND customer:'ZZZ')
Not possible I'm afraid
Do you know of any plans on adding more functionalities like that? I guess it could save a lot of unnecessary requests/bandwidth/time
https://support.stripe.com/contact I don't have a roadmap, you can reach out to Stripe support and tell them your feature request.
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
Okay, thank you very much. This will help :)
One quick question: why are there always list and search params? What are the differences/Why is it separated?
They are quite similar, my personal view is that the search API is a more advanced way of listing/filtering a collection of data