#mrelliot69

1 messages ยท Page 1 of 1 (latest)

stable oceanBOT
dawn temple
#

hi! whats's the question exactly?

oblique rune
#

Heyy, im trying to use the query api to search charges
but needed to do this with the header of stripe connected account in order to search the pys_ objects by customer_id

dawn temple
#

hmm let me check if that's possible

oblique rune
#

img using curl and semms that when i pass the stripe-account and query using the customer property returns allways no results

dawn temple
#

can you share more context like the exact curl command you're using and the account ID acct_xxx? you can remove the secret key sk_xxxx

oblique rune
#
$url_api = "https://api.stripe.com/v1/charges/search";
            $headers_api = array(
                    "Stripe-Version: 2022-08-01",
                    'Authorization: Bearer '.$strPrivate,
                    'Stripe-Account: '. @$stripeKeys["stripe_account"]
                );
 
           
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers_api);

            $params = array(
                "query" =>  $customerIdQuery,
                "limit" => 10,
            );

            $url_api = sprintf("%s?%s", $url_api, http_build_query($params));
dawn temple
#

any reason you are not using our PHP library and writing your own curl code?

oblique rune
#

because the sdk version that i have do not support the search query

dawn temple
#

things to check :

  • is @$stripeKeys["stripe_account"] definitely set and not null? Same question for customerIdQuery
  • what is the account ID acct_xxx?
  • what's the request ID req_xxx from the request you made so I can look on our side?
  • are you sure your query would acutally have hits on the account you run it on?
dawn temple
oblique rune
#

its a normal api call

#
  • stripe account its not null,
  • custommmer id is not null,
  • req_id : req_uIlBIc1ghVTori
dawn temple
#

your query is "customer:'cus_Mfi5s8cfm8gUYO'"

#

that customer ID exists on your platform account, not the connected account you pass to Stripe-Account

#

so naturally there are no results

oblique rune
#

When i list all charges im able to filter by stripe account.
why when do the search by charges im not able to?

dawn temple
#

not sure what you mean, could you clarify or give an example?

oblique rune
#

so basically my issue is that i want to search only on the connected account their payments.

I am able to list all the charges for that connected account,
im just not able to search it

dawn temple
#

if you're referring to the code you posted above, I explained what the problem with it is(you pass a query which is "get all charges for a Customer X" but that customer exists on the platform account not that connected account, so it makes no sense and naturally has no results)

#

if you mean you tried something else, please share the details of what you did try

oblique rune
#

im sorry, maybe im confusing things.
what im trying to understand is if there's a way to search charges when i pass the stripe account (from the connected acc) on the header.

#

i understand that the customer exists on the platform, but what other way i have to search on the connected account

dawn temple
dawn temple
#

so it depends what you're looking for exactly really and what the criteria for your search is

oblique rune
#

my search would be customerID, but since that's off the table because it belongs on the platform, the other way would be by metadata?

dawn temple
#

that might work yes, if you have metadata on the charges on the connected account

oblique rune
#

the thing is that it falls in the same problem from the customerid that is from the platform

dawn temple
#

yes, so you need to figure something out

#

do you use Destination charges?

oblique rune
#

yes

dawn temple
#

if you set such metadata/descriptions then you have something to search for