#gunwant-Order

1 messages · Page 1 of 1 (latest)

dusty crag
#

Hi there, are you using card element or payment element?

wheat dust
#

I'm using Payment element.

#
const options = {
  clientSecret: clientSecret,
  // Fully customizable with appearance API.
  appearance: {
    theme: 'flat',
    variables: {
      fontWeightNormal: '500',
      borderRadius: '2px',
      colorBackground: 'white',
      colorPrimary: '#DF1B41',
      colorPrimaryText: 'white',
      spacingGridRow: '15px'
    },
    rules: {
      '.Label': {
        marginBottom: '6px'
      },
      '.Tab, .Input, .Block': {
        boxShadow: '0px 3px 10px rgba(18, 42, 66, 0.08)',
        padding: '12px'
      }
    }
  },
};
const elements = stripe.elements(options);

// Create and mount the Payment Element
const paymentElement = elements.create('payment');
paymentElement.mount('#payment-element');
#

In the card, elements have an option to hide/show zipcode.

hidePostalCode: true,

#

whats about payment element?

dusty crag
#

You can set it to never to hide the postal code

wheat dust
#

OKay.
Let me check it.

#

Hello

dusty crag
#

Hi there

wheat dust
#

I have applied both options 'auto' and 'never' but the stripe payment element does not respond to anything.

#
const options = {
  clientSecret: clientSecret,
  // Fully customizable with appearance API.
  appearance: {
    theme: 'flat',
    variables: {
      fontWeightNormal: '500',
      borderRadius: '2px',
      colorBackground: 'white',
      colorPrimary: '#DF1B41',
      colorPrimaryText: 'white',
      spacingGridRow: '15px'
    },
    rules: {
      '.Label': {
        marginBottom: '6px'
      },
      '.Tab, .Input, .Block': {
        boxShadow: '0px 3px 10px rgba(18, 42, 66, 0.08)',
        padding: '12px'
      }
    }
  },
  fields: {
    billingDetails: {
      address: {
        postalCode: 'never' / 'auto'
      }
    }
  }
};
const elements = stripe.elements(options);
#

Anything wrong?

dusty crag
#

Not all country requires postal code. i.e., India doesn't

#

Change the country to United States or United Kingdom, and the payment element will display the postal code.

wheat dust
#

Okay.

#

Thank you

#

Got it

#

But when I have selected county US and how can I off zipcode?

dusty crag
#

Set postalCode to never.

wheat dust
#

I have set postalCode: 'never', still shows in the stripe payment element.

dusty crag
#

Your code looks correct, can you clear the build/cache and run again?

wheat dust
#

Sure. Let me try it again.

#

Sorry, Its not working

dusty crag
#

Try it in incognito mode?

wheat dust
#

Okay

dusty crag
#

Oh wait

#

The options param that includes the fields should be passed to elements.create('payment', options);, not stripe.elements(options);

wheat dust
#

Okay

#

Let me check it.

#

Thank you.

#

Now, its working

#

Thank you so much.
Nice to talk with you

dusty crag
#

No problem! happy to help.