#mike-p_code

1 messages ยท Page 1 of 1 (latest)

mighty jungleBOT
#

๐Ÿ‘‹ 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/1349910606198865933

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

surreal falcon
vocal bluff
#

Hi, the currency is decided when you are intializing the Payment Elements, either by PaymentIntent on backend or on initialization on frontend. When the PaymentElements is showed, the currency is already fixed

surreal falcon
#

I am setting the "currency" when the payment intent is created to "CAD" on the backend. (I just checked and verified this is the value being set as expected.)

#

I posted the front-end initialization of the Stripe Element in the initial question sent to StripeBot.

#

I'm invoking the V1 PaymentIntents Create API on the backend.

vocal bluff
#

Sorry let me clarify, is your question about

entering the Canada test CC number, only US Zip Code is acceptable, not a Canadian postal code
?

surreal falcon
#

The goal is to only allow Canadian payments (with Canadian postal code) or only allow US payments (with US zip code)

#

Setting the currency to 'CAD' when creating the PaymentIntent does not look like it is causing the Payment Element to only support 'CAD'. With the country: 'never' set on the Element, the country drop down is not visible, but the zip code entry must always be a US Zip Code (even with the PaymentIntent currency as CAD)

vocal bluff
#

So I think the country : never only changes its display or not. IF you drop that never option, does the country display US by default?

surreal falcon
#

It is defaulting to US

vocal bluff
#

Something like this

  defaultValues: {
    billingDetails: {
      address: {
        country: "CA", 
      }
    }
  },
  fields: {
    billingDetails: {
      address: {
        country: "never",
      }
    }
  }
surreal falcon
#

trying ...

#

It does not look to be defaulting to Canada. I am not using country: "never" so i can see the coutry drop down.

#

(i also put a debugger statement to ensure the code is loading as expected)

#

... i missed address element. Let me try again.

#

... with the address element, that now works as i would expect.

#

I think that got what I am looking for. Thank you! โค๏ธ

#

It does look like the 4242 4242 4242 4242 test card does accept a Canadian Postal Code (i used V6A 2W5). My expectation was that this would fail, but it did not.

vocal bluff
#

Yes that's a general purpose test card ๐Ÿ™‚ Happy to hear it works!