Post code validation

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #19771
    Michael Maccar
    Participant

      Hi Olly

      Just wondering if there is an easy way to turn on zip/post code validation in Stripe ?
      the option is turned on in my account but looks like something needs to be turned on in the plugin in order for it to work. Just trying to reduce fraud.

      Thanks

      #19783
      Olly
      Admin & Mod

        Out of the box, no.
        However , I would be happy to add this as an option if you could run a test for me by editing
        wppizza-gateway-stripe.php like so and tell me if this works (i would then have to make this a more dynamic option in the plugin itself, but as a test this should be fine).

        wppizza-gateway-stripe.php on approx line 393 AFTER

        
        $js[]="if (stripeEmail == null){var stripeEmailVal='';}else{var stripeEmailVal=stripeEmail.value;}";
        

        ADD

        
        $input_field_id = 'ccustom6'; /* set the id of the field enabled and set for entering Post/Zip codes in wppizza->order form settings */
        $js[]="var stripeZip = document.getElementById('".$input_field_id ."');";
        $js[]="if (stripeZip == null){var stripeZipVal='';}else{var stripeZipVal=stripeZip.value;}";
        

        setting the $input_field_id (the field you are using in wppizza->order form settings for the customer to enter his/her zipcode). Make sure you set this field in the settings there as being required

        then, wppizza-gateway-stripe.php on approx line 407 AFTER

        
        $js[]="name: '".$name."',";
        

        ADD

        
        $js[]="address_zip: ''+stripeZipVal+'',";
        

        for this to have any effect, enable declines on verification failures in your stripe account settings.

        let me know

        #19784
        Michael Maccar
        Participant

          Thank you for your reply, that’s for the zip code in the delivery address not in stripe popup window right ?

          #19785
          Olly
          Admin & Mod

            wrong.
            it will be passed on to stripe (but you don’t have to enter it again in the stripe popup)

            #19786
            Michael Maccar
            Participant

              I know it will be passed on to stripe but what if the delivery zip code is different than the billing zip code, I thought that there is an option to have another field in stripe popup window for the billing zip code.

              #19790
              Olly
              Admin & Mod

                >I know it will be passed on to stripe but what if the delivery zip code is different than the billing zip code,
                the you would have to label that filed “billing zip code” i would have though

                > I thought that there is an option to have another field in stripe popup window for the billing zip code.

                if there is, that would be great/better. got an example somewhere that does that ?

                #19792
                Michael Maccar
                Participant

                  >the you would have to label that filed “billing zip code” i would have though
                  what if cash payment is selected ? do you think I can only show billing zip code field when stripe is selected using css ?

                  >if there is, that would be great/better. got an example somewhere that does that ?
                  I saw this elsewhere but I might get in touch with stripe for this if needed

                  #19793
                  Olly
                  Admin & Mod

                    >but I might get in touch with stripe for this if needed
                    i had a look myself, but cannot see the option of adding a zipcode field to the popup in any documntation. Personally I agree that this should be there/optional. Maybe you can persuade them to do this sort of thing. Would certainly be th emost elegant solution

                    > do you think I can only show billing zip code field when stripe is selected using css ?
                    somwhat in conjunction with js.
                    i.e if wppizza-gateway-stripe is checked, set css of field visible and required , else hide and unset required(just off the top of my head, there may be other solutions too)

                    #19794
                    Michael Maccar
                    Participant

                      I will see what I can do, will keep you updated.
                      Thanks for your help

                    Viewing 9 posts - 1 through 9 (of 9 total)
                    • The topic ‘Post code validation’ is closed to new replies.