phppayment-gatewayopayo

Having trouble with integrating Sagepay payment gateway in PHP


I am implementing Sagepay payment gateway in PHP, it is working fine with 2.23 protocol. But when i change it to 3.00 it gives my an error code: 3195, which means that the line item amount details do not add up correctly.

I have tried all the solutions but nothing helped me.

Here is some of my code which I am using currently:

$sagePay = new SagePay();
$sagePay->setCurrency('GBP');
$sagePay->setAmount($_SESSION['amount']);
$sagePay->setDescription($_SESSION['tripcode']);
$sagePay->setBillingSurname('Mustermann');
$sagePay->setBillingFirstnames('Amrinder');
$sagePay->setBillingCity('London');
$sagePay->setBillingPostCode('GL51 3AA');
$sagePay->setBillingAddress1('Bahnhofstr. 1');
$sagePay->setBillingCountry('de');
$sagePay->setDeliverySameAsBilling();


<form method="POST" id="SagePayForm" action="https://live.sagepay.com/gateway/service/vspform-register.vsp" style="display:none;">
    <input type="hidden" name="VPSProtocol" value= "2.23">
    <input type="hidden" name="TxType" value= "PAYMENT">
    <input type="hidden" name="Vendor" value= "alpinetravelint">
    <input type="hidden" name="Crypt" value= "<?php echo $sagePay->getCrypt(); ?>">
    <input type="submit" value="continue to SagePay">
</form>

How can I resolve this problem?


Solution

  • The error refers to the basket field. You have the first item value as 100, tax as 10 and the line total as 100. The fields in the basket are Quantity:Item Value:Item Tax:Item Total:Line Total

    The item value should be the net amount if you are going to use the tax field, so your values should be 1:90.00:10.00:100.00:100.00