#devs-cardelement-postalcode

1 messages · Page 1 of 1 (latest)

whole remnantBOT
true totem
#

Hello what is your question?

pliant rover
#

On this support page

#

what it would look like I wanted to add an options in the elements.create function in Javascript ?

#

For example if I wanted to set a the postal code to 94110

true totem
#

Are you looking to pre-set the postal code and the user can change it? Or is that the postal code that you will always use when confirming your payments?

#

I don't think there is a way to pre-set the postal code like that. You can hide the postal code and pass your own one in when confirming the payment, but I don't think we support pre-setting

pliant rover
#

Yeah, Im looking to pre-set the Country actually. Right now its defaulted to Canada it seems.. Even for our customer across the world, the default is always Canada

true totem
#

Gotcha. And to be clear, you want to take payments outside of Canada, you just want that to be the default?

sly copper
#

devs-cardelement-postalcode

pliant rover
#

I want the Country to be the one where the card is being registered.

#

We already take payment from outside Canada, but when they enter their card, the default Country is Canada.. I want the default country to be the country where the customer is.

sly copper
#

@pliant rover there's no "country" in the legacy CardElement so I'm not sure I follow what you are describing. Can you share a screenshot?

pliant rover
#

the card number, expiration, cvc, country and postal code come from Stripe

sly copper
#

that Country is not a Stripe UI

pliant rover
#

really ?

sly copper
#

Or you're using PaymentElement and not CardElement (you said card earlier)

#

what's your exact code?

pliant rover
#

this is the html

#

corresponding UI

#

js code :

#

$ctrl.viewModel.stripe_payment = $ctrl.stripe_elements.create('payment')

            $ctrl.viewModel.stripe_payment.mount('#payment-element')
sly copper
#

okay the last bit is what I needed. You're using PaymentElement not the legacy card one

#

So the country dropdown is based on your IP address.

#

If your customer is in France, they'll see France there

pliant rover
#

oh really. Ok.