#_api

1 messages ¡ Page 1 of 1 (latest)

chilly riverBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1326612875284054036

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

zinc scroll
#

Hello! Not sure I understand. Are you trying to retreive the amount you set for those currencies from the API?

fresh marlin
#

retrieve the price in a specific currency

#

For example, I need the currency in CAD to make the checkout session, how do I get the CAD currency for that product?

zinc scroll
#

You mean one of the currencies you specified or one you haven't specified?

fresh marlin
#

so I have a product with two prices: price A in USD and price B in CAD. I want to make a checkout session with the CAD currency, how do I make sure the price I retrieve is the CAD one?

#

and price A is the default one

zinc scroll
#

You would specify Price B when you create the Checkout Session.

fresh marlin
#

I only know the product id here, how would I retrieve price B for the product ID, given that the default price is price A

zinc scroll
#

You have to specify a Price ID, you can't just use the Product ID.

fresh marlin
#

I know

#

given the product ID, how can I get price B for that product?

zinc scroll
#

Is that what you need?

fresh marlin
#

is there a way we can get the price based on the currency? does the API support something like this?

zinc scroll
#

No. Sorry, I'm just not quite understanding your issue. You're the one who created the Prices, so you should already know the currencies involved. Typically people keep the Price IDs and other info about them they need (like currency) on their end so they don't have to check with the API every time.

Can you provide more context and details about why you're trying to fetch a specific Price with a specific currency via the API? Maybe there's a better alternative I can suggest.

fresh marlin
#

Sure I can add more clarity to this

#

I have a product with two price: one in USD (price A, default price) and price B in CAD. The reason we're doing this is to allow our CAN customers pay the same amount as our US customer without them paying the exchange rate.

When we're creating the checkout sessions, the developers only have access to the product ID (we don't want to store the price ID in the code base since it changes frequently) so I want to be able to get price B for my CAN customers and price A for my US customers when I'm creating the checkout sessions

zinc scroll
#

Gotcha. You would need to use the Price list API I linked to above to get all the Prices for the Product in question, then loop through them until you found the correct CAD one.

fresh marlin
#

hm okay

#

so there isn't any other way around looping the price list, correct?

zinc scroll
#

The Search API has a delay, but the list API doesn't.

fresh marlin
#

okay, sounds good! thanks for presenting me all the options

zinc scroll
#

Happy to help!