Sagepay form Integration keeps giving error 5080 (Form transaction registration failed)

我的未来我决定 提交于 2019-12-11 04:45:42

问题


I have been trying to implement sage pay's form integration. Every time i submit a form i keep getting error code:5080 (Error description: transaction registration failed). I tried searching for error code in sagepays website (https://www.sagepay.co.uk/support/error-codes) but apparently this error code doesn't exist. If i type in the error description in sagepay's error code page, rather than the error code then i get the following result screenshot

However both my success url and failure url are present.

What is going on here?

Edit:

 VendorTxCode=16-07-20-12-43-55-145161808&ReferrerID=&Amount=3,500.00&Currency=GBP&Description=Clarice Cliff SUNRAY LOTUS JUG C.1930&SuccessURL=http://test.co.uk/baskets/sagepay_success&FailureURL=http://test.co.uk/baskets/sagepay_failure&CustomerName=&CustomerEMail=&VendorEMail=&SendEMail=&eMailMessage=&BillingSurname=Tester&BillingFirstnames=Tester&BillingAddress1=Test Street&BillingAddress2=&BillingCity=London&BillingPostCode=TE14 1EE&BillingCountry=UNITED KINGDOM&BillingState=&BillingPhone=&DeliverySurname=Tester&DeliveryFirstnames=Tester&DeliveryAddress1=Test Street&DeliveryAddress2=&DeliveryCity=London&DeliveryPostCode=TE14 1EE&DeliveryCountry=UNITED KINGDOM&DeliveryState=&DeliveryPhone=&Basket=&AllowGiftAid=&ApplyAVSCV2=&Apply3DSecure=&BillingAgreement=&BasketXML=&CustomerXML=&SurchargeXML=&VendorData=&ReferrerID=&Language=&Website=

回答1:


It was your BillingCountry and DeliveryCountry fields - you should use ISO 2 character values. You had 'UNITED KINGDOM' in there - should be 'GB'.




回答2:


I have finally figured it out. I was sending the crypt field across but not the other data like txt type.

It was me being silly, although it would have been nice to get a error from Sagepay which actually was relevant to the issue rather than something so general you start looking in irrelevant places to solve the issue.




回答3:


Login to your Sagepay account & go to the invalid transactions, click a transaction & you will see the exact error that is causing the 5080 error.




回答4:


Sample PHP code:

function addPKCS5Padding($input)
{
     $blockSize = 16;
     $padd = "";
     $length = $blockSize - (strlen($input) % $blockSize);
     for ($i = 1; $i <= $length; $i++)
{
     $padd .= chr($length);
}
     return $input . $padd;
}

function removePKCS5Padding($input)
{
    $blockSize = 16;
    $padChar = ord($input[strlen($input) - 1]);
    $unpadded = substr($input, 0, (-1) * $padChar);
    return $unpadded;
}


function encryptAes($string, $key)
{
    $string = addPKCS5Padding($string);
    $crypt = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $string, MCRYPT_MODE_CBC, $key);
    return  strtoupper(bin2hex($crypt));
}


function decryptAes($strIn, $myEncryptionPassword)
{

#Sagepay specific - remove the '@'
$strIn = substr($strIn,1);

    $strInitVector = $myEncryptionPassword;
    $strIn = pack('H*', $hex);
    $string = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $myEncryptionPassword, $strIn, MCRYPT_MODE_CBC,$strInitVector);
    return removePKCS5Padding($string);
}



回答5:


Check your encryption key!

I had exactly the same issue this morning. I have been using the test Sage Pay gateway for development but wanted to check that my crypt string worked on the live gateway. An error 5080 was reported. I realised that I was using my test encryption key instead of the live key!




回答6:


I had this exact problem and thought I would add my problem/solution to this. I had this error in test and found that the DNS entry for our test site had been removed. I got this error because SagePay could not get to the return URL I gave it.

Once I put the DNS entry back, SagePay could get to the site and the error went away.




回答7:


I had the same problem and the reason was I had accidentally left out one of the address fields that I was sure was included.

Check what you are posting to Sage, via var_dump($_POST)

Failing that, speak to SagePay customer support on 0845 111 4466 (I think it costs to call that number) and tell them the problem. They may ask you to post your form to https://test.sagepay.com/showpost/showpost.asp, and they can watch on their end to see what data you're POSTing and verify if something is missing on their end.




回答8:


I had this very same issue. Turns out one of my variables was blank due to a database retrieval error - so check you're actually filling in every field by stepping through your form generation code (I dynamically built mine in the server side script, so was easy enough to identify).

In my case, the "billingaddress" was actually feeding a string value of "", which errored when it was posted to SagePay.




回答9:


On Woocomerce go to setting for Sagepay - make sure "select shipping address" is put to billing address instead of auto - simple fix.



来源:https://stackoverflow.com/questions/38480452/sagepay-form-integration-keeps-giving-error-5080-form-transaction-registration

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!