During the functional tests of Buckaroo Magento 2 Extension we ran into the problem that we could have a proper payment flow when we checked out as Guest, but when we created an account and tried to check out we got the error "Unable to place order. Please try again later."
What is the problem?
After some debugging we found the exception: "Magento\Framework\Exception\InputException: region is a required field. in /data/web/magento2/vendor/magento/module-customer/Model/ResourceModel/AddressRepository.php:254"
How to solve?
Login into the backend of Magento 2 and goto Stores > Configuration > General > General: and on the right side State
Select the Countries where the State is mandatory. State/Province is not required when filled in, but in step 2 of the checkout it will be checked.
But what did go wrong?
So region is a required field. When we fill in our shipping information and select country Netherlands during the checkout the region field will change into a textfield and is no longer required. But in the second step when the payment methods are selected this field is required. Changing the configuration setting will prevent this.