#torkise
1 messages · Page 1 of 1 (latest)
Hi there, how can I help
I am currently trying to implement payment with different currencies in our store.
When selling a product I see in our code we create a paymentIntent, allowing me to pass a currency and unit price to the paymentIntent.
const paymentIntent = await stripe.paymentIntents.create({
customer: customerId,
metadata: {
...metadata,
priceId,
},
amount: price.currency_options[currency].unit_amount,
currency: currency,
payment_method_types: ['card'],
});
```
So this works good for me.
But when we sell subscriptions, I am not able to pass currency and unit price, only the priceID
const subscription = await stripe.subscriptions.create({
customer: customerId,
metadata: {
...metadata,
},
items: [
{
price: priceId,
},
],
I read somewhere that Stripe handles different currencies automaticly in some cases. The price has NOK, EUR and Dollars as available currencies. Will stripe handle that for me?
You can specify the currency when creating a price https://stripe.com/docs/api/prices/create#create_price-currency
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Do I need on unique Price object for each currency? The price object already has a list of available currencies
https://stripe.com/docs/payments/checkout/multi-currency-prices you mean currency_options? that's designed for Checkout.
Yeah, currencie options. What is the different between checkout and subscription creation?
https://stripe.com/payments/checkout this is checkout
So If we're not using checkout session, what would be a good sollution? Creating a uniqe price for each currency? Seems a bit over the top
Yes you can do that
Is it possible to not use the default currencie when creating the subscription?
But I'd highly recommend you using checkout for subscriptions
Sure, you can use other currencies for subscriptions
okay, and then it will be handled automaticly based on the customers location?
If you are using Checkout, yes. https://stripe.com/docs/payments/checkout/multi-currency-prices#specify-currency
Gucci gucci
Question, just trying to understand our code here.
When using stripe-subscriptions.create, will the payment be done in that line of code?
No that just create a subscription
yeah I see it now. They are using stripe.confirmCardPayment
const confirmPayment = await stripe.confirmCardPayment(
subscription.data.clientSecret,
{
payment_method: paymentMethodReq.paymentMethod.id,
}
);
This is not the same as checkout session?
No
Checkout sessions will be my recommendation. https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=stripe-hosted you can visit this page to learn how to build a subscription integration with checkout