#torkise

1 messages ยท Page 1 of 1 (latest)

rough fossilBOT
#

Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

  • torkise, 16 hours ago, 15 messages
urban eagle
#

Which APIs or UIs are you using to process payments?

#

How are prices shown on your website today?

wise scroll
#

I am a bit unsure. Relatively new to the codebase, and the developer that set it up has quit ๐Ÿ˜ฆ

It seems like we are fetching the price objects belonging to each product object, and showing the currency and unit amout of that response.

urban eagle
#

If you can share a pi_xx ID for a payment that would help me

wise scroll
#

what's a pi_xx ID? How can I find it?

#

Safe to share in this server?

urban eagle
#

Yep, totally fine

wise scroll
#

pm_1NmggQJmp1IbLmZSfB0zmhfF

#

Here you go ๐Ÿ˜‰

urban eagle
#

That's the ID of the payment method. Is there a payment ID? pi_xxx

wise scroll
#

pi_3NmggbJmp1IbLmZS1YRdWMFq

urban eagle
#

Taking a look!

#

When you say 'price object has multiple currencies', is that configure in Stripe?

wise scroll
#

yepp, multiple currencies are are added to the price object

urban eagle
#

But your integration is not using those price_xxx objects in your API calls (see above). You're simply passing the amount and currency parameters which probably reflect the values of what you've configured

#

If you want to use a different currency, your integration will need to provide that in your API call

wise scroll
#

So, all our payments are only done in 1 currency now?

urban eagle
#

I'm not sure if they all are, you've only provided me with one example

#

But you should be able to determine that from your code

wise scroll
#

I can see the products are fethed with this code
"""const stripeProducts = await stripe.products.list({
ids: ids,
});

const basicProduct = stripeProducts.data.find(
  (p) => p.id === process.env.NEXT_PUBLIC_STRIPE_BASIC_PRODUCT_ID
);
const premiumProduct = stripeProducts.data.find(
  (p) => p.id === process.env.NEXT_PUBLIC_STRIPE_PREMIUM_PRODUCT_ID
);
const basicPrices = await stripe.prices.list({
  product: basicProduct.id,
});
const premiumPrices = await stripe.prices.list({
  product: premiumProduct.id,
});
const premiumProductWithPrices = {
  ...premiumProduct,
  prices: premiumPrices,
};
const basicProductWithPrices = {
  ...basicProduct,
  prices: basicPrices,
};

"""

urban eagle
#

We aren't automatically changing the currency like you think we are though

wise scroll
#

I think i read somewhere in the docs that if a price has multiple currencies, Stripe chooses the appropriate currency based on the currency of the card of the customer?

urban eagle
wise scroll
#

ahh okei. I see we have most our payments in NOK, and a few that are done in Euro. Is the payment done in the correct currency, even tho only the main currency is shown in the interface?

How do I extract the correct currencie from the API call? Seems to me like the API only returns the main currency

urban eagle
#

Is the payment done in the correct currency, even tho only the main currency is shown in the interface?
The presentment currency would be whatever you pass to the API via currency parameter. It may settle in a difeerent currency on your account dependent on bank accounts etc

#

How do I extract the correct currencie from the API call? Seems to me like the API only returns the main currency
Not sure what you mean by 'correct currency'

simple blade
#

๐Ÿ‘‹ taking over for my colleague. Let me know if there's any follow-up Qs I can answer!

wise scroll
#

The corrrect currency is the currency in the country the user connects from. How do I get it from the API?

urban eagle
#

We wouldn't have that information in the API unless you provided it to us, which you're seemingly not

wise scroll
#

ok, so if I have understood it correctly, the payment may be done in one of the currencies added to the price depending on the bank account of the customer. So the issue seems to be the price that is shown to the customer on the shop interface

wise scroll
urban eagle
#

Your integration seems to work like this:

  • You fetch Price objects from the Stripe API
  • There's some kind of checkout/store UI that renders them. Customers select a product that maps to a Price in Stripe
  • You seemingly pass values (unit_amount, currency) from those objects to the API when creating the Payment Intent
  • How you determine which currency is used for the payment would depend on your application logic
#

You keep referencing 'correct currency' and 'main currency', yet there's only one currency field on the payment and that is eur in the example you shared

wise scroll
#

Can I send you the id of a price object?

urban eagle
#

There's no currency conversion/FX done on Stripe

urban eagle
wise scroll
#

hmmm okay. The Unit_amount and currency values are fetched from the Price API

urban eagle
#

Yes, I understand that. But how your application determines which currency to use is the missing piece and something you control, not us

wise scroll
#

okay

#

I have not been able to get all available currencies in a price object in the response. How do I do that?

If I can get a hash with currency as key and the corresponding unit amount as the value I will be a happy man

urban eagle
#

It's not included in default API responses

wise scroll
#

okey! Thanx.
So seems like i should do the following:

  • Expand the respons to get multiple CURRENCIES and the corresponding UNIT_AMOUNT.
  • Pass the correct CURRENCY and UNIT_AMOUNT to the checkout (I should fix this with my own logic).

Anythin else I need to think about?

urban eagle
#

Sounds about right yep. Obviously you need to determine customer location somehow in order to use the local currency for them

wise scroll
#

Thank you!

urban eagle
#

Worth understanding too that if you present in non-settlement currency, then there will be FX on Stripe