0
我正在电子商务网站上工作,我必须整合鼠尾草支付支付网关。一切工作正常,除了尝试结帐时出现以下错误。 请看下面的细节和我使用的代码。现在尝试在我们的网站上集成鼠尾草支付时出现错误3121
<?php
$serverLive="https://test.sagepay.com/gateway/service/vspform-register.vsp";
$YOUR_VENDOR_LOGIN_NAME = "alpinetravelint";
$PAYMENT_CRYPT="VendorTxCode=406227821909&Amount=320.00&Currency=GBP&Description=1ACMEWidget&SuccessURL=http://salentro.com/core/snowtrax/index.php&FailureURL=http://salentro.com/core/snowtrax/login.php&BillingSurname=Smith&BillingFirstnames=John&BillingAddress1=123 Main Street&BillingCity=Anywhere&BillingPostCode=W1A 1BL&BillingCountry=GB&DeliverySurname=Smith&DeliveryFirstnames=test&DeliverAddress1=123Main Street&DeliveryCity=Anywhere&DeliveryPostCode=W1A 1BL&DeliveryCountry=GB";
function pkcs5_pad($text, $blocksize)
{
$pad = $blocksize - (strlen($text) % $blocksize);
return $text . str_repeat(chr($pad), $pad);
}
function encryptFieldData($input)
{
$key = "4bBtA2UYvZKry3tb";
$iv = $key;
$cipher = mcrypt_module_open(MCRYPT_RIJNDAEL_128, "", MCRYPT_MODE_CBC, "");
if (mcrypt_generic_init($cipher, $key, $iv) != -1)
{
$cipherText = mcrypt_generic($cipher,$input);
mcrypt_generic_deinit($cipher);
$enc = bin2hex($cipherText);
}
return $enc;
}
$str = $PAYMENT_CRYPT;
$datapadded = pkcs5_pad($str,16);
$cryptpadded = "@" . encryptFieldData($datapadded);
?>
<form action="<?php echo $serverLive ;?>" method="POST" id="SagePayForm" name="SagePayForm">
<input type="hidden" name="VPSProtocol" value="2.23" />
<input type="hidden" name="TxType" value="PAYMENT" />
<input type="hidden" name="Vendor" value="<?php echo $YOUR_VENDOR_LOGIN_NAME ?>" />
<input type="hidden" name="Crypt" value="<?php echo $cryptpadded ?>">
<input type="image" src="images/buynow-sagepay.png" />
</form>
,问题是,当我尝试运行这段代码,我得到了下面的错误代码: 3121:该DeliveryFirstnames值太长。 请给我一些适当的解决方案来解决这个问题。