-->

SagePay Form - Classic ASP - Currency Field is mis

2019-02-19 09:55发布

问题:

I am trying to add the Form Intergration SagePay payment gateway in Classic ASP. I have a working PHP version that I sourced from SO. I have translated it into VBSCRIPT, everything seems to be working fine but the encryption.

I am using all the same inputs as the PHP script so that the Cryptstring is exactly the same as the PHP Cryptstring before it is encrypted.

I've downloaded and using the Rijndael.asp & includes.asp files found here: Encrypting Crypt field using Classic ASP for SagePay Form Integration

But I continue to receive the following error:

Status: MALFORMED
Status Detail:  3045 : The Currency field is missing.

Cryptstring: VendorTxCode=542534345&ReferrerID=&Amount=200.00&Currency=GBP
&Description=Lorem ipsum&SuccessURL=http://www.testserver.co.uk/sagepaytest/success.php
&FailureURL=https://www.yoururl.org/fail.php&CustomerName=&CustomerEMail=&VendorEMail=
&SendEMail=&eMailMessage=&BillingSurname=Mustermann&BillingFirstnames=Max
&BillingAddress1=Bahnhofstr. 1&BillingAddress2=&BillingCity=Cologne&BillingPostCode=50650
&BillingCountry=DE&BillingState=&BillingPhone=&DeliverySurname=Mustermann
&DeliveryFirstnames=Max&DeliveryAddress1=Bahnhofstr. 1&DeliveryAddress2=
&DeliveryCity=Cologne&DeliveryPostCode=50650&DeliveryCountry=DE&DeliveryState=
&DeliveryPhone=&Basket=&AllowGiftAid=&ApplyAVSCV2=&Apply3DSecure=&BillingAgreement=
&BasketXML=&CustomerXML=&SurchargeXML=&VendorData=&ReferrerID=&Language=&Website=

I've tried manually adding certain fields into the crypt string, I've tried GET to anther page without the encryption to view the full output.

My encryption password is correct, I've double and triple checked it. Its entered in the includes.php file.


index.asp

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>

<!-- #include file="classes/includes.asp" -->

<!-- #include file="classes/sagepay.asp" -->

<% Set objSagePay=new SagePay %>

<% objSagePay.setCurrency("GBP") %>
<% objSagePay.setAmount(200) %>
<% objSagePay.setDescription("Lorem ipsum") %>
<% objSagePay.setBillingSurname("Mustermann") %>
<% objSagePay.setBillingFirstnames("Max") %>
<% objSagePay.setBillingCity("Cologne") %>
<% objSagePay.setBillingPostCode("50650") %>
<% objSagePay.setBillingAddress1("Bahnhofstr. 1") %>
<% objSagePay.setBillingCountry("de") %>
<% objSagePay.setDeliverySameAsBilling() %>

<% objSagePay.setSuccessURL("http://www.testserver.co.uk/sagepaytest/success.php") %>
<% objSagePay.setFailureURL("https://www.yoururl.org/fail.php") %>

<% Crypt=objSagePay.getCrypt() %>
<%= Crypt %>

<div id="content">
  <form method="POST" id="SagePayForm" action="https://test.sagepay.com/gateway/service/vspform-register.vsp">
  <input type="hidden" name="VPSProtocol" value= "3.00">
  <input type="hidden" name="TxType" value= "PAYMENT">
  <input type="hidden" name="Vendor" value= "vendorname">
  <input type="hidden" name="Crypt" value= "<%= objSagePay.getCrypt() %>">
  <input type="submit" value="continue to SagePay">
</form>

Any guidance would be appreciated.

回答1:

I'm in the same boat. I can encrypt and decrypt perfectly with exactly the same results but when it is passed to Sagepay I get the error - Currency field is missing.

Update: I have managed to solve this error. Make sure in the 'includes.asp' that you change the existing line:

strEncryptionPassword="mcAX65PTadrrsKQ3"

to include the password that is in your original Sagepay 'includes.asp' file. Do not use the default password that comes with the download link in your post.