Stripe Checkout postcode validation for Canada
-
Hi, I am having issues (address_zip_check: = ‘fail’) with payments coming from {“postal_code”: “S0G0H0”, “state”: “SK”, “city”: “Bethune”, “country”: “CA”,} (from stripe log). Apparently it should be passed as “postal_code”: “S0G 0H0” with a space in the middle but it is passed from the API as a unique string and the space get stripped.
Could it be the the cause of the ZIP code Validation Failure?
How can I solve this or if possible allow the API to pass the ZIP code without stripping the space in the middle?
Thanks.
-
Hi there!
We’d be happy to look into this zip code failure for you. Could you please share a copy of your site’s System Status? You can find it via WooCommerce > Status. Select “Get system report” and then “Copy for support”.? Once you’ve done that, paste it here in your response.
Hi Melinda, thanks for the answer, here the report:
### WordPress Environment ### WordPress address (URL): https://li***********k.com Site address (URL): https://li***********k.com WC Version: 5.1.0 REST API Version: ? 5.1.0 WC Blocks Version: ? 4.4.3 Action Scheduler Version: ? 3.1.6 WC Admin Version: ? 2.1.3 Log Directory Writable: ? WP Version: ? 5.7 - There is a newer version of WordPress available (5.7.1) WP Multisite: – WP Memory Limit: 512 MB WP Debug Mode: – WP Cron: ? Language: en_US External object cache: – ### Server Environment ### Server Info: nginx/1.19.2 PHP Version: 7.4.16 PHP Post Max Size: 256 MB PHP Time Limit: 300 PHP Max Input Vars: 5000 cURL Version: 7.58.0 OpenSSL/1.1.1 SUHOSIN Installed: – MySQL Version: 5.5.5-10.2.31-MariaDB-1:10.2.31+maria~bionic-log Max Upload Size: 256 MB Default Timezone is UTC: ? fsockopen/cURL: ? SoapClient: ? DOMDocument: ? GZip: ? Multibyte String: ? Remote Post: ? Remote Get: ? ### Database ### WC Database Version: 5.0.0 WC Database Prefix: wp_ Total Database Size: 279.21MB Database Data Size: 259.30MB Database Index Size: 19.91MB wp_woocommerce_sessions: Data: 0.45MB + Index: 0.01MB + Engine MyISAM wp_woocommerce_api_keys: Data: 0.00MB + Index: 0.01MB + Engine MyISAM wp_woocommerce_attribute_taxonomies: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_woocommerce_downloadable_product_permissions: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_woocommerce_order_items: Data: 0.05MB + Index: 0.05MB + Engine MyISAM wp_woocommerce_order_itemmeta: Data: 0.85MB + Index: 0.41MB + Engine MyISAM wp_woocommerce_tax_rates: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_woocommerce_tax_rate_locations: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_woocommerce_shipping_zones: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_woocommerce_shipping_zone_locations: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_woocommerce_shipping_zone_methods: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_woocommerce_payment_tokens: Data: 0.01MB + Index: 0.01MB + Engine MyISAM wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.02MB + Engine MyISAM wp_woocommerce_log: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_actionscheduler_actions: Data: 2.47MB + Index: 0.79MB + Engine MyISAM wp_actionscheduler_claims: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_actionscheduler_groups: Data: 0.00MB + Index: 0.01MB + Engine MyISAM wp_actionscheduler_logs: Data: 1.39MB + Index: 1.02MB + Engine MyISAM wp_automatewoo_abandoned_carts: Data: 0.02MB + Index: 0.08MB + Engine InnoDB wp_automatewoo_customers: Data: 0.05MB + Index: 0.09MB + Engine InnoDB wp_automatewoo_customer_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_automatewoo_events: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_automatewoo_guests: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_automatewoo_guest_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_automatewoo_logs: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_automatewoo_log_meta: Data: 0.05MB + Index: 0.03MB + Engine InnoDB wp_automatewoo_queue: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_automatewoo_queue_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_cartflows_ca_cart_abandonment: Data: 0.31MB + Index: 0.03MB + Engine MyISAM wp_cartflows_ca_email_history: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_cartflows_ca_email_templates: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_cartflows_ca_email_templates_meta: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_cartflows_visits: Data: 0.15MB + Index: 0.10MB + Engine MyISAM wp_cartflows_visits_meta: Data: 0.93MB + Index: 0.18MB + Engine MyISAM wp_commentmeta: Data: 0.00MB + Index: 0.01MB + Engine MyISAM wp_comments: Data: 0.37MB + Index: 0.21MB + Engine MyISAM wp_gf_addon_feed: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_gf_draft_submissions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_gf_entry: Data: 0.23MB + Index: 0.03MB + Engine InnoDB wp_gf_entry_meta: Data: 1.52MB + Index: 0.66MB + Engine InnoDB wp_gf_entry_notes: Data: 0.14MB + Index: 0.03MB + Engine InnoDB wp_gf_form: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_gf_form_meta: Data: 0.06MB + Index: 0.00MB + Engine InnoDB wp_gf_form_revisions: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_gf_form_view: Data: 0.06MB + Index: 0.03MB + Engine InnoDB wp_hfcm_scripts: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_jet_post_types: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_jet_taxonomies: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_jet_widgets_styles: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_links: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_options: Data: 4.66MB + Index: 0.92MB + Engine MyISAM wp_postmeta: Data: 191.71MB + Index: 12.63MB + Engine MyISAM wp_posts: Data: 16.46MB + Index: 0.70MB + Engine MyISAM wp_rank_math_404_logs: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_rank_math_internal_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_rank_math_internal_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_rank_math_redirections: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_rank_math_redirections_cache: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_rank_math_sc_analytics: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_shortpixel_folders: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_shortpixel_meta: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_termmeta: Data: 0.00MB + Index: 0.01MB + Engine MyISAM wp_terms: Data: 0.00MB + Index: 0.01MB + Engine MyISAM wp_term_relationships: Data: 0.00MB + Index: 0.01MB + Engine MyISAM wp_term_taxonomy: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_usermeta: Data: 0.53MB + Index: 0.37MB + Engine MyISAM wp_users: Data: 0.03MB + Index: 0.04MB + Engine MyISAM wp_wcs_payment_retries: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_wc_admin_notes: Data: 0.01MB + Index: 0.00MB + Engine MyISAM wp_wc_admin_note_actions: Data: 0.01MB + Index: 0.00MB + Engine MyISAM wp_wc_category_lookup: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_wc_customer_lookup: Data: 0.03MB + Index: 0.03MB + Engine MyISAM wp_wc_download_log: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_wc_order_coupon_lookup: Data: 0.00MB + Index: 0.01MB + Engine MyISAM wp_wc_order_product_lookup: Data: 0.08MB + Index: 0.08MB + Engine MyISAM wp_wc_order_stats: Data: 0.04MB + Index: 0.03MB + Engine MyISAM wp_wc_order_tax_lookup: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_wc_product_meta_lookup: Data: 0.00MB + Index: 0.01MB + Engine MyISAM wp_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_tax_rate_classes: Data: 0.00MB + Index: 0.01MB + Engine MyISAM wp_wc_webhooks: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_wfblockediplog: Data: 0.09MB + Index: 0.00MB + Engine InnoDB wp_wfblocks7: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wfconfig: Data: 1.38MB + Index: 0.00MB + Engine InnoDB wp_wfcrawlers: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wffilechanges: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wffilemods: Data: 17.55MB + Index: 0.00MB + Engine InnoDB wp_wfhits: Data: 1.02MB + Index: 0.22MB + Engine InnoDB wp_wfhoover: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wfissues: Data: 0.06MB + Index: 0.06MB + Engine InnoDB wp_wfknownfilelist: Data: 7.52MB + Index: 0.00MB + Engine InnoDB wp_wflivetraffichuman: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wflocs: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wflogins: Data: 1.02MB + Index: 0.14MB + Engine InnoDB wp_wfls_2fa_secrets: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wfls_settings: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wfnotifications: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wfpendingissues: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_wfreversecache: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wfsnipcache: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wfstatus: Data: 0.13MB + Index: 0.09MB + Engine InnoDB wp_wftrafficrates: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wsdesk_archived_tickets: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wsdesk_archived_ticketsmeta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wsdesk_settings: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wsdesk_settingsmeta: Data: 0.06MB + Index: 0.00MB + Engine InnoDB wp_wsdesk_tickets: Data: 5.52MB + Index: 0.00MB + Engine InnoDB wp_wsdesk_ticketsmeta: Data: 1.52MB + Index: 0.00MB + Engine InnoDB ### Post Type Counts ### acf-field: 40 acf-field-group: 9 attachment: 266 aw_workflow: 12 cartflows_flow: 1 cartflows_step: 2 custom_css: 5 elementor_library: 26 nav_menu_item: 1 oembed_cache: 4 pafe-form-database: 4537 page: 33 post: 9 product: 25 pys_event: 1 revision: 1114 shop_coupon: 20 shop_order: 506 shop_order_refund: 11 shop_subscription: 21 woo_discount: 2 woo_discount_cart: 1 ### Security ### Secure connection (HTTPS): ? Hide errors from visitors: ? ### Active Plugins (41) ### Gravity Forms: by Gravity Forms – 2.4.23 Advanced Custom Fields PRO: by Elliot Condon – 5.9.5 Advanced Custom Fields: by Elliot Condon – 5.9.5 Astra Pro: by Brainstorm Force – 3.1.0 AutomateWoo: by WooCommerce – 5.3.0 Booster Plus for WooCommerce: by Pluggabl LLC – 5.3.9 CartFlows Pro: by CartFlows Inc – 1.6.8 CartFlows: by CartFlows Inc – 1.6.9 Gravity Forms Drip Add-On: by gravity+ for Drip – 2.1.2 Drip for WooCommerce: by Drip – 1.1.1 Duplicate Page: by mndpsingh287 – 4.4 Elementor Pro: by Elementor.com – 3.0.5 Elementor: by Elementor.com – 3.1.4 Google Analytics for WordPress by MonsterInsights: by MonsterInsights – 7.16.2 Gravity Forms Google Spreadsheet Addon: by Webholics – 3.3 Header Footer Code Manager: by 99robots – 1.1.9 LTR Checkout organizer: by Andrea Fontebasso – 1.0 LTR Orders Quality Control Table: by Andrea Fontebasso – 1.0 Facebook for WordPress: by Facebook – 3.0.5 Piotnet Addons For Elementor Pro: by Luong Huu Phuoc (Louis Hufer) – 6.3.32 Piotnet Addons For Elementor: by Piotnet – 2.4.6 Protect WordPress Uploads: by Stephan Csorba – 1.2.2.8 Rank Math SEO: by Rank Math – 1.0.60.1 ShortPixel Image Optimizer: by ShortPixel – 4.21.2 Ultimate Addons for Gutenberg: by Brainstorm Force – 1.21.1 Ultimate Addons for Elementor: by Brainstorm Force – 1.29.2 UpdraftPlus - Backup/Restore: by UpdraftPlus.Com DavidAnderson – 2.16.50.25 Upsell Order Bump Offer for WooCommerce: by MakeWebBetter – 1.4.2 User Role Editor: by Vladimir Garagulya – 4.58.3 WooCommerce Cart Abandonment Recovery: by CartFlows Inc – 1.2.11 WooCommerce Admin: by WooCommerce – 2.1.3 WooCommerce Extended Coupon Features FREE: by Soft79 – 3.2.7 WooCommerce Cost of Goods: by SkyVerge – 2.9.8 WooCommerce Stripe Gateway: by WooCommerce – 5.0.0 WooCommerce Google Analytics Integration: by WooCommerce – 1.5.1 Booster for WooCommerce: by Pluggabl LLC – 5.3.9 WooCommerce Subscriptions: by WooCommerce – 3.0.13 WooCommerce: by Automattic – 5.1.0 (update to version 5.2.2 is available) Wordfence Security: by Wordfence – 7.4.14 WSDesk - WordPress Support Desk: by WSDesk – 4.1.6 Zoho Mail: by Zoho Mail – 1.4.2 ### Inactive Plugins (6) ### Cloudflare: by Cloudflare Inc. – 4.4.0 DW PromoBar: by DesignWall – 1.0.4 LTR Black List QC: by Andrea Fontebasso – 1.0 Password Protected: by Ben Huson – 2.4 Perfmatters: by forgemedia – 1.6.6 WP Rocket: by WP Media – 3.8.3 ### Dropin Plugins (1) ### advanced-cache.php: advanced-cache.php ### Must Use Plugins (2) ### Endurance Page Cache: by Mike Hansen – 2.0.5 SSO: by Garth Mortensen Mike Hansen – 0.3 ### Settings ### API Enabled: – Force SSL: – Currency: USD ($) Currency Position: left Thousand Separator: , Decimal Separator: . Number of Decimals: 2 Taxonomies: Product Types: external (external) grouped (grouped) simple (simple) subscription (subscription) variable (variable) variable subscription (variable-subscription) Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog) exclude-from-search (exclude-from-search) featured (featured) outofstock (outofstock) rated-1 (rated-1) rated-2 (rated-2) rated-3 (rated-3) rated-4 (rated-4) rated-5 (rated-5) Connected to WooCommerce.com: – ### WC Pages ### Shop base: #401 - /shop-2/ Cart: #97 - /cart/ Checkout: #98 - /checkout/ My account: #99 - /my-account/ Terms and conditions: #4269 - /terms-of-purchase/ ### Theme ### Name: li***********k Version: 1.0.0 Author URL: https://wpastra.com/about/ Child Theme: ? Parent Theme Name: Astra Parent Theme Version: 3.2.0 – 3.3.2 is available Parent Theme Author URL: https://wpastra.com/about/ WooCommerce Support: ? ### Templates ### Overrides: li***********k/woocommerce/checkout/form-checkout.php li***********k/woocommerce/emails/customer-on-hold-order.php ### Subscriptions ### WCS_DEBUG: ? No Subscriptions Mode: ? Live Subscriptions Live URL: https://li***********k.com Subscription Statuses: trash: 4 wc-active: 17 WooCommerce Account Connected: ? No Custom Retry Rules: ? No Custom Retry Rule Class: ? No Custom Raw Retry Rule: ? No Custom Retry Rule: ? No Retries Migration Status: ? Completed Report Cache Enabled: ? Yes Cache Update Failures: ? 0 failure ### Store Setup ### Country / State: United States (US) — Texas ### Subscriptions by Payment Gateway ### Stripe: trash: 4 wc-active: 17 ### Payment Gateway Support ### Stripe: products refunds tokenization add_payment_method subscriptions subscription_cancellation subscription_suspension subscription_reactivation subscription_amount_changes subscription_date_changes subscription_payment_method_change subscription_payment_method_change_customer subscription_payment_method_change_admin multiple_subscriptions pre-orders ### Action Scheduler ### Complete: 6,722 Oldest: 2021-03-20 08:44:45 +0000 Newest: 2021-04-20 08:24:13 +0000 Pending: 20 Oldest: 2021-04-20 08:28:53 +0000 Newest: 2021-05-19 15:38:44 +0000 ### Status report information ### Generated at: 2021-04-20 08:24:43 +00:00
Hi there,
Thank you for the report!
I was checking further this issue, and I understand that you want to know if the space on the zip could be related to the validation error.
It wouldn’t make a lot of sense from what I see, as it is a basic validation on both sides.
In this case, I suppose that it might be because the zip associated with the card and the one provided on the checkout might not be matching.
You can see more about that here: https://stripe.com/docs/radar/rules/reference#post-authorization-attributes
I recommend you ask them to contact the card issuer and ask your customer to make sure that it is the same zip added there.
Hi Felipe,
thank you for the answer, sadly we did already all those checks with Stripe and the client and from their side they confirm that all is fine apart the ZIP that should be split in 2 parts with a space in the middle, this actually is the only thing i can think of.
Here you can see how it is passed in the API: https://drive.google.com/file/d/1yk3t9BphxnoQsS-3ymjNXsoa7Z6aqXLz/view?usp=drivesdk
Is there maybe a filter I can apply for testing purpose where I can intercept this specific ZIP and pass it into the API with a space?
Thanks
Hi there @pecoramannaraweb,
I tested this exact scenario and couldn’t reproduce the problem using the post code
S0G0H0
. I entered it without a space at checkout, and the WooCommerce Stripe extension passed it as a string with the space included:It also was received by Stripe with the space:
I noticed in your screenshot that the postal code without the space appears in the
Owner
properties, which is not a value the WooCommerce Stripe extension sends in payment requests. Is the customer’s billing address somehow set like that in the Stripe dashboard?Hey Tijosh, thanks for the answer, you make a good point with the “owner” properties, however we didn’t entered it. I assumed it came from the transactions and then Stripe saved it?
But as the client is also a developer and use regularly Stripe, he himself integrated it directly at the checkout of other sites (not using woocommerce integrations but the stripe checkout directly), and he keep saying he has never had this problem before in years, so I will keep investigating the issue more, hopefully something comes up.
Thanks
BTW, I tested it adding the space in the ZIP and I can confirm that same to me, I get it separate in the API call and also I can say that other clients are using it separate and get passed correctly, so there is nothing filtering it before the API call.
Hi, @pecoramannaraweb!
This is interesting as I just came across a similar issue with another user using a different Canadian zip code. Can you clarify for us, is the error coming up just for this one user?
The reason I ask is that, with
:address_zip_check: = 'fail'
, at least according to Stripe’s documentation, the block would be coming from the card issuer, i.e., the zip code provided by the customer at checkout does not match what their bank has on file. And if that’s the case, then it would be best that the customer take it up with their bank. Do you think this might be the case here?Actually I did some more in depth investigation after this suggestion (should have done it before probably), I exported all the payments and dive into the data more in depth to properly understand the matter.
We have plenty of completed payments from Canada, and I notice that there is a variety of approach, as many use space in the middle, other are uppercase, lowercase, mixed case, etc.. and all passed the Zip validation, no matter how the zip was used.
Only 6 didn’t pass in the first attempt, but 4 of those using another Zip they passed with the same card, so I definitely suspect that in this specific case, there is a mismatch between the zip code used by the client and the one from the bank, I can’t see another way to solve the issue.
Thanks for the help!
Hey, @pecoramannaraweb!
Thanks for the help!
First, you’re most welcome!
Second, really impressive digging. Thank you too for taking the time to validate our theory and update us with your findings. That’s really helpful!
- The topic ‘Stripe Checkout postcode validation for Canada’ is closed to new replies.