fix: amazon pay test address in test mode#11608
Conversation
Test the buildOption 1. Jetpack Beta
Option 2. Jurassic Ninja - available for logged-in A12s🚀 Launch a JN site with this branch 🚀 ℹ️ Install this Tampermonkey script to get more options. Build info:
Note: the build is updated when a new commit is pushed to this PR. |
|
Size Change: 0 B Total Size: 959 kB ℹ️ View Unchanged
|
There was a problem hiding this comment.
Pull request overview
This PR fixes a checkout validation failure in Express Checkout flows (notably Amazon Pay on EU Stripe accounts in test mode) where providers can send an empty first address line and place the street in the second line, causing WooCommerce Store API to reject the address.
Changes:
- Add address-line normalization to shift
address_2intoaddress_1whenaddress_1is empty/whitespace. - Apply the normalization to both shipping and billing addresses in the tokenized-cart Store API interception logic.
- Add unit tests covering shifting behavior and no-op behavior when
address_1is already populated.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| includes/express-checkout/class-wc-payments-express-checkout-ajax-handler.php | Adds transform_ece_address_lines_data() and applies it during tokenized cart address normalization. |
| tests/unit/express-checkout/test-class-wc-payments-express-checkout-ajax-handler.php | Adds unit tests for the new address-line normalization behavior. |
| changelog/fix-amazon-pay-eu-account-test-mode | Adds a patch-level changelog entry describing the fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
mgascam
left a comment
There was a problem hiding this comment.
LGTM!
I verified on an EU Stripe test account in test mode. Signed in with an Amazon Pay sandbox buyer and placed an order against the exact payload from the PR description (line1: "", line2: "Meininger Strasse 58", city: Neunkirchen, DE). Order placed successfully and the billing address landed with address_1 correctly populated; no "Street address is a required field" error.
Fixes WOOPMNT-6113
Changes proposed in this Pull Request
Amazon Pay on EU Stripe accounts in test mode sometimes returns a billing address where
line1is empty and the street sits inline2:{ "city": "Neunkirchen", "line1": "", "line2": "Meininger Strasse 58", "postal_code": "66538", "state": "", "country": "DE" }WooCommerce Core fails validation:

Adding a
transform_ece_address_lines_data()in the ECE ajax handler, same pattern as the existing HK state / postcode massaging. It shiftsaddress_2intoaddress_1whenaddress_1is empty (or whitespace-only).The fix primarily targets Amazon Pay, but any express checkout path that hits the tokenized cart endpoint benefits.
Testing instructions
1111Visanpm run changelogto add a changelog file, choosepatchto leave it empty if the change is not significant. You can add multiple changelog files in one PR by running this command a few times.Post merge