#mrelliot69
1 messages ยท Page 1 of 1 (latest)
hi! whats's the question exactly?
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
hmm let me check if that's possible
I think it just works, you pass the StripeAccount to the library in the same way as you usually would. For example in Node, this worked for me
const charge = await stripe.charges.search({
query: 'amount>99',
}, {stripeAccount:"acct_1LKfzXQoPjJAG63y"});
https://stripe.com/docs/connect/authentication#stripe-account-header
img using curl and semms that when i pass the stripe-account and query using the customer property returns allways no results
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
$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));
any reason you are not using our PHP library and writing your own curl code?
because the sdk version that i have do not support the search query
things to check :
- is
@$stripeKeys["stripe_account"]definitely set and not null? Same question forcustomerIdQuery - what is the account ID
acct_xxx? - what's the request ID
req_xxxfrom 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?
then.. upgrade to the latest? ๐
-.-, stripe have the option to use curl so thats not the problem
its a normal api call
- stripe account its not null,
- custommmer id is not null,
- req_id : req_uIlBIc1ghVTori
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
When i list all charges im able to filter by stripe account.
why when do the search by charges im not able to?
not sure what you mean, could you clarify or give an example?
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
to be clear, when you say, "not able", what did you try?
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
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
there is, you are doing it in the code you shared. It would work perfectly fine if your query was correct.
not sure what you mean, you can all use the same exact query options and they do the same thing https://stripe.com/docs/search#query-fields-for-charges
so it depends what you're looking for exactly really and what the criteria for your search is
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?
that might work yes, if you have metadata on the charges on the connected account
the thing is that it falls in the same problem from the customerid that is from the platform
yes
if so then you can do things like call https://stripe.com/docs/api/charges/update#update_charge-metadata using the Stripe-Account header, on the payment_intent.charges.data[0].transfer.destination_payment
if you set such metadata/descriptions then you have something to search for