Reputation: 85
I am hosting a Discord Bot on a server in Canada. When I do
let response = await fetch("http://store.steampowered.com/api/appdetails?appids=251570")
I get a response with the price_overview
information in CAD. I would like it in USD because I am located in the US. Is there anyway to get the USD response instead of the CAD response? (preferably without just doing the math to convert CAD to USD)
Upvotes: 1
Views: 130
Reputation: 7303
You can append &cc=us&l=en
to the URL to get the price in USD:
https://store.steampowered.com/api/appdetails?appids=251570&cc=us&l=en
which yields:
price_overview: {
currency: "USD",
initial: 2499,
final: 2499,
discount_percent: 0,
initial_formatted: "",
final_formatted: "$24.99"
},
So in your code:
let response = await fetch("https://store.steampowered.com/api/appdetails?appids=251570&cc=us&l=en")
Note: This is an unofficial API and could change anytime.
Upvotes: 3