#King Ducky ๐ฅ
1 messages ยท Page 1 of 1 (latest)
Can you share example requests to search and example results you think should be included?
eg, req_123 https://stripe.com/docs/api/request_ids / https://support.stripe.com/questions/finding-the-id-for-an-api-request
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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.
so it says that im missing parameters, im assuming they would go in the body request for the API but it wont let me access that section to input the name {option_cuetomer} variable i would be using to grab the info the team inputs. thats what i believe the issue is currently.
ive got my request ID here:
req_eVgNn409ZvM5sp if that helps?
With the search API the query parameter is required
but it wont let me access that section to input the name {option_cuetomer} variable
what do you mean by this?
See example requests here:
https://stripe.com/docs/search#customers-email-search
so im using an API request block in the command builder i use.
there are 4 sections: URL Params, HTTP Headers, Body Requests, Test Request
for example: if i have command to get a users email by formatting the command like this /email name:John Doe in the body request i would have to put
Key: name Value: {option_name} for it to take that information in and use it for what i want to do with it
i hope this makes sense?
however i cannot access that section to do it which leads me to believe the curl doesn't support that, so my question is.. where would i go about putting that information in the API block to be able to search for a users account VIA a command in discord /account name:john doe
Why can't you add the query parameter? I don't really know the tool you're using or why it wouldnt allow that
But it's not a limitation of the stripe api
Can you use it to set query parameters?
eg: https://api.stripe.com/v1/customers/search?query=name~%22test%22
so for example if i just include the {option_name} in the url.. it should work?
You need to provide a valid query structure - I'm not sure what you mean by {option_name}
If you use the example I gave you but replace test with part of a name of one of your customers, it should return results
so {option_user} is the variable used to grab the information inputted by the command user
so in this case that would be the account holders name
sure, ok, so thats the value you'd use in query=name~"value"
ah i see ok so: https://api.stripe.com/v1/customers/search?query=name~%22{option_name}%22
with or without the %22?
That's just URL encoding the "
The quotation marks are needed for a valid query strcuture
ah right gotcha so just add " before and after the option var
ahhhh yess i got it!!
so is there a way to check if they used a discount code? because in the return it shows as NULL
Yay! ๐
check if they used a discount code
In what context? That's a more complicated question
so basically to see what discount code they used if they used one
so i can see in the return that there is a discount return but the customer i used this on did in fact use a discount code when purchasing the material however it returns NULL
Use where? Do you have an example of what you mena?
You wouldn't that's not how that works. That shows when coupons are applied to customers.
Instead you'd need to retrieve the sessions for a customer:
https://stripe.com/docs/api/checkout/sessions/list#list_checkout_sessions-customer
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ahhh gotcha ok makes sense
The you can use the session total_details to look at discounts:
https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-total_details-breakdown-discounts
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 nice ok, i didnt realise there was this much stuff i could turn into commands haha
Note total_details.breakdown is includable and requires using expansion: https://stripe.com/docs/expand
So you can first check total_details.amount_discount to see if there was any discount
then retrieve that specific session using expand=total_details.breakdown to get the details
hmm ok ill have a look into that. i cannot guarantee you wont see me again as im super new to all of this, thanks for all your help ๐