Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do not collect Zip code with Stripe

Im trying to use Stripe v3 for payment. The guide is here https://stripe.com/docs/elements

I do not want to collect the zip code. However I cannot figure out how. My HTML is:

<form>   <label>     <div id="card-element" class="field is-empty"></div>     <span><span>Credit or debit card</span></span>   </label>   <button type="submit">Pay</button>   <div class="outcome">     <div class="error" role="alert"></div>     <div class="success">       Success! Your Stripe token is <span class="token"></span>     </div>   </div> </form> 

And javascript is:

var card = elements.create('card', {   style: {     hidePostalCode: true,     base: {       iconColor: '#666EE8',       color: '#31325F',       lineHeight: '40px',       fontWeight: 300,       fontFamily: '"Helvetica Neue", Helvetica, sans-serif',       fontSize: '15px',        '::placeholder': {         color: '#CFD7E0',       },     },   } });  card.mount('#card-element'); 

But it always asks for the zip code:

enter image description here

There is a guide to the Element tag here https://stripe.com/docs/stripe.js#element-types. But I cannot see where I can collect the card number, CVC and card expiry, but NOT the zip code...

like image 461
Mark Avatar asked Oct 21 '17 12:10

Mark


People also ask

Is ZIP code needed for stripe?

ZIP or postal code requirements for Strong Customer Authentication (SCA) : Stripe: Help & Support. The CardElement component field for ZIP and postal code is not required for Strong Customer Authentication (SCA)-compliance for a standard direct charge.

Are stripe payments safe?

PCI Compliant Stripe is a PCI Service Provider Level 1 which is the highest grade of payment processing security. You can rest assured that your donors information is safe and secure.

Why does Stripe decline my card?

Card issuer declines arising from incorrect card information (for example, incorrect card number or expiration date) are best handled by guiding your customer to correct the error or even using another card or payment method.

What is a stripe code?

Received "Your Stripe verification code is" text message from Stripe. Payments. Checkout. You received this text message because you saved your phone number for future purchases using Link. Link lets you securely save and reuse your payment information for a faster checkout at tens of thousands of online businesses.


1 Answers

Thankfully, this should be a pretty simple fix! hidePostalCode: true should be a top level property in your options, rather than nested under style here.

https://stripe.com/docs/stripe.js#element-options

var card = elements.create('card', { hidePostalCode: true, style: {  base: {   iconColor: '#666EE8',   color: '#31325F',   lineHeight: '40px',   fontWeight: 300,   fontFamily: '"Helvetica Neue", Helvetica, sans-serif',   fontSize: '15px',    '::placeholder': {     color: '#CFD7E0',    },   },   }  });  card.mount('#card-element'); 
like image 84
duck Avatar answered Sep 22 '22 17:09

duck