Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When using an Irish address (no postcode) PayPal is failing with incorrect billing address.
Delving deeper and getting the long error description it states that the postalcode field is required. According to PayPal WPP spec (http://www.paypalobjects.com/en_GB/pdf/PP_WebsitePaymentsPro_IntegrationGuide.pdf) this field is not mandatory.
Comment | File | Size | Author |
---|---|---|---|
#11 | wpp_countries_no_postal_code-2006722-11.diff | 633 bytes | jackbravo |
#10 | wpp_countries_no_postal_code-2006722-10.diff | 2.21 KB | Marko B |
Comments
Comment #1
daveetheridge CreditAttribution: daveetheridge commentedTo correct change line 279 to
to
this will work with all countries that currently don't have post codes. This is supported by PayPal as the post code / zip field is NOT mandatory.
Comment #2
rszrama CreditAttribution: rszrama commentedHmm, technically speaking (according to that PDF), none of the address fields would be required. However, that PDF is 6 years old, so I'm hesitant to make any sweeping changes based on it alone. One thought - perhaps it would just be better to let the merchant specify which address fields must be present to consider the address valid?
Moving to 2.x; we'd implement the new code here and backport.
Comment #3
rszrama CreditAttribution: rszrama commentedHere's the relevant documentation I could turn up, which shows postal code as required at least for US usage:
https://developer.paypal.com/webapps/developer/docs/classic/api/merchant...
That leads me to believe making this configurable is the best solution for now. I doubt it's realistic to find all the different countries that don't require a postal code by trial and error and keep the code up to date. Could lead to subpar integration for international companies where some addresses require a postal code and others don't, but at least it gives folks like yourself a working solution.
Comment #4
daveetheridge CreditAttribution: daveetheridge commentedGood solution. The required field issue may also apply to PayPal WPS and other payment gateway modules.
Comment #5
Anonymous (not verified) CreditAttribution: Anonymous commentedHello,
Has there been any movement on this ticket?
I noticed someone else has posted symptoms that sound like the underlying issue here. https://drupal.org/node/2154365
While Reading #3 on this thread , I wonder if a clever way to get around this "magically" would be to piggy back off of dynamic address field and get the required fields that way since their module handles the collection of Billing Information and they're using standardized rules for what to show for what countries.
Just a thought.
Thanks,
Stan
Comment #6
lluisandreu CreditAttribution: lluisandreu commentedI guess you can always use the Commerce Single Address module, if you are only operating in one country/region.
Comment #7
Bird-Kid CreditAttribution: Bird-Kid commentedI was not sure whether I should comment, update this issue or submit this as a new issue, so I figured I would just append it as a new comment.
Problem/Motivation
Today we have received notice of a consumer that he could not complete the checkout, being given the error message
Upon looking at his order details and diving into the code, apparently the reason lies within the missing
postal_code
value in the address. It was missing because the country he was ordering from does not have postal codes (example for such countries: Ireland, Hong Kong, etc.).The issue can be reproduced with these steps:
Proposed resolution
I did not want to completely remove the check on the postal code value (as was proposed above), so I borrowed some code from the addressfield module's format plugin and replaced this:
with this:
Remaining tasks
Arguably a nicer way to handle this would be to integrate the structure outputted by the addres.inc format plugin from the addressfield module directly into here, see if the field postal_code has been set and only flag the shipping address as not valid (read: invalid) if the array key has been set in the returned format array AND is empty in $shipping_address. However, being rather new to Drupal (been five exciting months for me now) I could not manage to integrate the addressfield_format_address_generate function into the Commerce PayPal WPP module.
Comment #8
swentel CreditAttribution: swentel commentedSOLVED
Oh wow, this was fantastic .. at some point we switched the order of the 'Payment' and 'Billing information' pane. This has influence of the order of the submit functions which are triggered. Setting the billing information first solves the problem. But we want it in a different order, which I can probably solve otherwise.
Created separate bug report, see https://drupal.org/node/2284307
------------------------------
Ironically, I'm able to reproduce this as well, but in a different context. In our case, the validation /always/ fails the first time, second time everything is right.
Note: everything is filled in, so the required validation that Drupal performs passed fine.
All other validations go fine to, so we enter commerce_paypal_wpp_submit_form_submit().
The first time, the first if statement in the code underneath is returning the false, so for some reason, the address/billing values are not populated on either the $order or the $order_wrapper object. I'm not sure how and why this is not happening. However, clicking to go forward again /without/ changing anything on the form then works and we can start paying.
I'm not sure yet who's responsible for populating the commerce_customer_billing key, but once I figure that one out, I'll be able to get around this.
Note: we're currently on commerce paypal 7.x-2.2 and commerce 7.x-1.8 - but looking at the diff between both latest release, there isn't anything I can see that would affect or fix this (although, granted, I didn't test it yet).
Comment #9
Marko B CreditAttribution: Marko B commented#7 Bird-Kid solution is certanly something we could use for start. There are significant no. of countries without postal code. Currently you can complete purchase for this countries because postal_code is required and there is non available to enter so basically PayPal WPP is not useable in those countries.
Comment #10
Marko B CreditAttribution: Marko B commentedI made patch from that code above. Works good.
Comment #11
jackbravo CreditAttribution: jackbravo commentedI agree with @rzrama in #3: it would be very hard to keep track this list of countries without postal codes inside of the commerce_paypal module.
We should do like @sshivell suggests in #5 and let the addressfield module keep track of which countries have postal_code as a required field. It already does that. For example, postal code is already a required field for the US, not required for Ireland (IE), so I don't think there is a need to double check that in commerce_paypal.
Comment #12
NewZeal CreditAttribution: NewZeal at Passing Phase Web Development commentedA foolproof way of solving this problem without using a patch or hacking is to supply the following function to your custom module. This saves the postal code as the (meaningless) ' - ' so that it passes WPP validation and doesn't cause confusion when printed in invoices.
Comment #13
scotwith1tFor me, the key was this:
I don't see it documented anywhere that the name field is required for WPP. While it may be fairly obvious, since WPP is basically a credit card processor and every CC processor requires a name to go with the CC, because we were upgrading from WPS and hadn't needed the Name fields on our form before, it wasn't exactly clear why it wasn't working for us initially. Hope this helps someone else out.
Comment #14
Igor Mancos CreditAttribution: Igor Mancos commentedFor existing billing profiles work this code:
Comment #15
mglamanThis was fixed in #2939890: Some countries erroneously fail address validation., which checks the required address format properly. This was tested for the Irish address use case.