#Heena

1 messages · Page 1 of 1 (latest)

coral spruceBOT
rancid ivy
#

i created payment form using stripe payment element
const paymentElement = elements.create('payment', {
fields: {
billingDetails: {
name : 'auto',
email : 'auto',
address: {
postalCode: 'auto'
}
}
}

                        });
#

Hi, what's the question?

opaque raptor
#

postalCode not displayed on form

#

@rancid ivy are you here?

rancid ivy
#

Please write in this thread, and not in the main channel, thanks!

#

Let me check

opaque raptor
#

how ca i add with payment element ?

#

payment element also provide "postalCode" fields but in my form not display

rancid ivy
opaque raptor
#

not worked

#

I need postal code

rancid ivy
opaque raptor
#

ok

#

not worked

#

because both are not in same same element

coral spruceBOT
opaque raptor
#

payment element are different and address element are different

rancid ivy
#

The issue is that the address element is in mode: "shipping"

#

But payment element specifies billingDetails

#

You need to set mode: "billing"

opaque raptor
#

i tried ti billing

#

const addressElement = elements.create("address", {
mode: "billing",
});

#

is that ok ?

little radish
#

Yep, that will put the Element in billing mode

opaque raptor
#

not working

little radish
#

But I'm not sure that will work as you need

opaque raptor
little radish
#

We only collect the required billing details for the payment method type/customer location

opaque raptor
#

my question is payment element provide postalcode

little radish
#

I guess in India postal code is not deemed necessary for payment conversion

#

So we don't collect it, you'd need to collect it separately

opaque raptor
#

i did this site for UK

#

but payment element provide postalcode then why it not worked?

little radish
#

Yep, UK is one country where we do collect a postal code. As I said, it's determined on a per country basis

opaque raptor
#

ok

little radish
opaque raptor
#

const paymentElement = elements.create('payment', {
fields: {
billingDetails: {
name : 'auto',
email : 'auto',
address: {
postalCode: 'auto'
}
}
},

                                  defaultValues: {
                                    billingDetails: {
                                         
                                        address: {
                                            country: 'GB',
                                            postalCode: '90005'
                                        }
                                    }
                                }

                        });
#

I did like this

#

and removed address element

#

I did it 🙂

little radish
#

Yeah, but if you switch country to India the postal code field will disappear

opaque raptor
#

yes

little radish
#

As I said, the other address fields are determined by the billing country. In your original question you had India selected. So it was expected

opaque raptor
#

yes right

#

i not know about it

#

can you please let me know that how can i display country and postal code fields in same line

#

I need same design like that screenshot

little radish
#

You can't

opaque raptor
#

with checkbox term

#

ohh

#

above screenshot i viewed in stripe custom portal

little radish
#

What's the question?

opaque raptor
#

i need to display country and postal code in same line like above screenshot

little radish
#

The form is just responsive. I suspect that because your form is in narrow modal it collapses the fields onto separate lines. Make it wider and they'll be on the same line

opaque raptor
#

no no

#

i need country and postal code in same line

#

see here

little radish
#

Not possible I'm afraid

opaque raptor
#

ok

#

then why it display in above portal ?

#

in customer management page you can see in "Add payment method"

little radish
#

As I explained, because of the wider viewport. Shrink your browser and the fields will collapse onto their own rows

opaque raptor
#

ok

#

thanks for information

#

have a good day