omnipay-sagepay icon indicating copy to clipboard operation
omnipay-sagepay copied to clipboard

The BillingCountry value is invalid.

Open SM-Prasad opened this issue 3 years ago • 1 comments
trafficstars

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.

SM-Prasad avatar Oct 21 '22 11:10 SM-Prasad

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

judgej avatar Oct 21 '22 12:10 judgej