thephpleague / omnipay-sagepay

Sage Pay driver for the Omnipay PHP payment processing library
MIT License
55 stars 78 forks source link

The BillingCountry value is invalid. #189

Open SM-Prasad opened 2 years ago

SM-Prasad commented 2 years ago

I have installed Omnipay via composer and used below added code

require_once('vendor/autoload.php');

use Omnipay\Omnipay;
use Omnipay\Common\CreditCard;

$gateway = OmniPay::create('SagePay\Direct')->initialize([
    'vendor' => 'profarmadirect',
    'testMode' => true,
]);

$card = new CreditCard([
    'firstName' => 'Card',
    'lastName' => 'User',
    'number' => '4929000000006',
    'expiryMonth' => '12',
    'expiryYear' => '2030',
    'CVV' => '123',
]);

$requestMessage = $gateway->purchase([
    'amount' => '99.99',
    'currency' => 'GBP',
    'card' => $card,
    'transactionId' => '123',
    'description' => 'Pizzas for everyone at PHPNE',
    'clientip' => $_SERVER['REMOTE_ADDR'],
     'billingCountry' => 'GB',
    // If 3D Secure is enabled, then provide a return URL for
    // when the user comes back from 3D Secure authentication.
    "apply3DSecure" => 1 ,//"Disable", // 
    'returnUrl' => $returnUrl,
]);

$responseMessage = $requestMessage->send();
echo "<pre>"; print_r($responseMessage);

And getting error "The BillingCountry value is invalid." in response. I have tried in proxy as well and IP is of US but still getting the same error.

judgej commented 2 years ago

The billingCountry should be a part of the CreditCard object. The full billing address, and shipping address is on the card. Documented here