#King Ducky ๐Ÿฅ

1 messages ยท Page 1 of 1 (latest)

jade falconBOT
cold mural
#

Can you share example requests to search and example results you think should be included?

#
unborn cedar
#

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?

cold mural
#

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?

unborn cedar
#

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

cold mural
#

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

unborn cedar
#

so for example if i just include the {option_name} in the url.. it should work?

cold mural
#

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

unborn cedar
#

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

cold mural
#

sure, ok, so thats the value you'd use in query=name~"value"

unborn cedar
#

ah i see ok so: https://api.stripe.com/v1/customers/search?query=name~%22{option_name}%22

#

with or without the %22?

cold mural
#

That's just URL encoding the "

#

The quotation marks are needed for a valid query strcuture

unborn cedar
#

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

cold mural
#

Yay! ๐ŸŽ‰

check if they used a discount code
In what context? That's a more complicated question

unborn cedar
#

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

cold mural
#

Use where? Do you have an example of what you mena?

unborn cedar
#

how would i get this to return the discount code they used when checking out?

cold mural
#

You wouldn't that's not how that works. That shows when coupons are applied to customers.

unborn cedar
#

ahhh gotcha ok makes sense

cold mural
jade falconBOT
unborn cedar
#

oh nice ok, i didnt realise there was this much stuff i could turn into commands haha

cold mural
#

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

unborn cedar
#

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 ๐Ÿ™‚