#sandhya_api

1 messages ¡ Page 1 of 1 (latest)

lost mortarBOT
#

👋 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/1289101053039607880

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

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.

gloomy raptor
#

Hi there, so can you tell me what problem that you are trying to solve?

south laurel
#

hi

#

I am trying to using lozalized payment methods but its take parameter as currency and amount . Based on currency localized payment methods are getting listed.

#

I want these methods to be listed as per customer country selection

#

and payment should happen only in one currency which we have setup while creating payment intent.

gloomy raptor
south laurel
#

what are the exact changes that I needs to do in code

#

while creating a payment intent

gloomy raptor
#

If your integration uses an API version prior to 2023-08-16, you must replace payment_method_types with automatic_payment_methods.

south laurel
#

$checkout_session = \Stripe\Checkout\Session::create([
'line_items' =>
[[
'price_data' => [
'currency' => 'USD',
'product_data' => ['name' => 'T-shirt'],
'unit_amount' => 2000,
],
'quantity' => 1,
]],
'mode' => 'payment',
'success_url' => 'http://localhost:4242/success',
'cancel_url' => 'http://localhost:4242/cancel',
'payment_method_types' => [
'bancontact',
'card',
'eps',
'giropay',
'ideal',
'p24',
'sepa_debit',
]
]);

#

This is how I am passing but its giving error

#

Invalid currency options usd. The payment method bancontact only supports the following currencies: eur.

gloomy raptor
#

Hmm? I thought you said you are creating PaymentIntents?

south laurel
#

I am trying it by both way. Either payment intent or stripe checkout

gloomy raptor
#

So basically you should remove the payment_method_types

south laurel
#

I did passed the say way as given in example but its giving an error

#

Invalid currency options usd. The payment method bancontact only supports the following currencies: eur.

gloomy raptor
#

But you still pass payment_method_types, the example code told you to remove payment_method_types

#
If you list payment methods manually in an existing integration and want to manage payment methods in your Dashboard, remove payment_method_types from your integration code.```
south laurel
#

yeah, if I remove then it willlist payment methods as per set currency

#

but my usecase is, I want the payment methods should get displayed as per customer country selection and payment should happen in set currency for either session checkout or payment intent.

#

it should be same as shown in this demo example

#

when we change country, payment methods for that country gets listed

#

same things I am trying to achieve

gloomy raptor
#

The demo shows how Stripe checkout automatically display a different list of payment methods based on the customer's location.

#

Either Stripe PaymentElement or Checkout page would automatically determine the customer's location, and there's no API to programmatically set the location.

south laurel
#

but how does Stripe PaymentElement or Checkout automatically determine customer location? there is no parameter to set customer location

#

it just accepts currency and based on currency payment methods gets displayed in Stripe PaymentElement or Checkout

gloomy raptor
#

But why do you need to set the location?

south laurel
#

as I said my usecase is that, as per custome country selection payment methods should get changed

#

the way it shown in example

#

same thing I want to implement

gloomy raptor
#

No, there's no API to set a location, and this is not something that you can implement

south laurel
#

so does stripe has any API by which I can do currency conversion from USD to EUR or vice versa