This article provides a fix for errors received during order placement when selecting a region in PayPal Express Checkout. The issue is caused by changes made in the Magento v2.3.4 release and is related to how PayPal Express Checkout address fields are parsed.
Affected versions and products
- Magento Commerce Cloud v2.3.4
- Magento Commerce v2.3.4
Issue
An error occurs when entering the country and region during order placement in PayPal Express Checkout. The issue is reproducible for any country where the region field in the address section is a text field (as opposed to a drop-down menu).
Steps to reproduce:
- Enable PayPal Express Checkout.
- Add product to cart as a guest or when you are logged in.
- Go to checkout.
- Select your shipping address. For example, the UK. Then enter an input into the State/Province field. For example, Nottinghamshire.
- Click on the Place Order button to place order. You get a successful order page and email from Magento.
Expected Result:
The order is placed successfully.
Actual Result:
When the order button is clicked on an error displays:
Error 500: NOTICE: PHP message: PHP Fatal error: Uncaught Error: Call to a member
function getId() on null in httpdocs/vendor/magento/module-paypal/Model/Api/Nvp.php:1527
Solution
For On-Prem Merchants: Apply the hotfix, which is available from the Downloads section on magento.com portal in My account.
For Cloud Merchants: Magento will include the fix in the Magento Cloud Patches page 1.0.2. Please refer to DevDocs Magento Cloud patches release notes in order to find instructions on applying the latest package.
How to Apply the Patch
See How to apply a composer patch provided by Magento for instructions.
Related Reading
- DevDocs Magento Commerce 2.3.4 Release Notes: Apply the PayPal Express Checkout issue with region patch for Magento 2.3.4 to address a critical PayPal Express Checkout issue