Showing results for 
Search instead for 
Did you mean: 

Checkout - Payment Method - Billing address Country always missing

Checkout - Payment Method - Billing address Country always missing

After creating a custom payment module, I have realize that I'm able to get pretty much all order information except a very important one which is the billing address country.


namespace SomeName\ExtensionName\Model;

class ModelName extends \Magento\Payment\Model\Method\Cc

    public function authorize(\Magento\Payment\Model\InfoInterface $payment, $amount)
$order = $payment->getOrder(); $billing = $order->getBillingAddress(); $billingCountry = $billing->getCountry(); //$billingCountry always returning empty ... } }

Initially the test store was set for one country only, therefore I tried with allowing a second country. I also tried using shipping and billing addresses from different countries in case this would affect some default behavior.


Unfortunately after multiple different trials, the result is always the same; no billing country output.


I could of course get the country using the regionCode but this would be very inefficient knowing that the country should simply get passed with the other billing information.


I could of course use the default customer or shipping country but these could be different in the case where a customer would pay with a foreign credit card but still get delivered in the designated country.


There is so many variation cases to evaluate and bottom line:

We need this value to get passed as it should.


From my understanding, having taken a look into other default Magento payment modules as Authorizenet, it seems that all payment modules are using similar methods and would not be getting the country.


Magento version: 2.1.0

Extensions Installed: 3

Payment Extension Installed: 1 (Only this one)


I did not take the time to dig in the core code to see where the billing country does not get passed. Still this issue should be easy enough to resolve.