S
STEVE WARBURTON
I have recived a callback.asp from worlpay. I have set up the settings in my
world pay account pointing to the script. I am presuming the transation from
world pay fires the callback.asp.
What do I have to do to extract the data that comes back from world pay.
Idiot level instructions please.
the script is as follows:
<%@ LANGUAGE=vbscript %>
<% Response.Expires = 0 %>
<% Response.Buffer = TRUE %>
<% Response.ExpiresAbsolute=#Jan 01, 1980 00:00:00# %>
<% Response.CacheControl = "Private" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Simple Callback Script</TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="Jamal Ahmed">
<META NAME="Description" CONTENT="Simple callback script demonstration">
</HEAD>
<BODY BGColor="#FFF9D5">
<!-- Please note this script is just an example. WorldPay doesn't guarantee
that it will work on your system and we don't provide support for this
script -->
<%
Response.Write "The number of variables sent in a QueryString => " &
Request.QueryString.Count() & "<BR><BR>"
Response.Write "The number of variables posted => " & Request.Form.Count()
& "<BR><BR><BR><BR>"
'You can set a callback password to check the callback is sent by WorldPay.
If you set the password
'we will send it back to you with every callback we send.
'callbackPW = Request.Form("callbackPW")
'If you are using callback to insert or get data from the database
'set obj = Server.CreateObject("ADODB.Command")
'obj.open "Your data source name"
trans = Request.form("transStatus")
' if the transaction was successful
If trans = "Y" then %>
<CENTER><B><FONT SIZE="6" COLOR="#CC0000">The Transaction Was
Successful</FONT></B><CENTER>
<!-- WorldPay receipt information -->
<WPDISPAY ITEM="banner">
<P align="center">
<%
' requesting the variables sent by WorldPay
instId = Request.Form("instId") ' Installation ID
cartId = Request.Form("cartId") ' Customer reference for the
particular transaction
amount = Request.Form("amount") ' The amount that was sent to
WorldPay in the order form
money = Request.Form("currency") ' The currency that was sent to
WorldPay in the order form
desc = Request.Form("desc") ' Description of the items purchsed
callTime = Request.Form("transTime") 'Time of the transaction
transId = Request.Form("transId") ' Transaction ID
testMode = Request.Form("testMode") ' 100 if it was a test
transaction and 0 for live
name = Request.Form("name") ' Shopper Details
address = Request.Form("address")
postcode = Request.Form("postcode")
country = Request.Form("country")
tel = Request.Form("tel")
email = Request.Form("email")
lang = Request.Form("lang") ' The language used on the payment page
cardType = Request.Form("cardType") ' The type of the card shopper
paid with
authCurrency = Request.Form("authCurrency") ' The currency that shopper
choose on payment page
authAmount = Request.Form("authAmount") ' The amount in currency the
shopper choose on payment page
authMode = Request.Form("authMode") ' Useful if you are using
pre-auth. "A" for immediate "E" for pre-auth
wafMerchMessage = Request.Form("wafMerchMessage") 'The message sent from
WorldPay to alert if it was possibly a fradulant transaction
AVS = Request.Form("AVS")' It is a four digit code for the
various checks performed by the bank
' First digit is for security code comparison, second digit is
for postcode comparison.
' third digit is for address comparison and fourth digit is for
country comparison.
'futurePayId = Request.Form("futurePayId") Agreement Id for FuturePay
if it was FuturePay transaction
' If you have got your own custom variables.
'M_variables = Request.Form("M_<variable name>")
' WorldPay will send an alert message in wafMerchMessage. It can have two
values Caution or Warning.
' If there is no value in that variable then that means the transaction
was OK
if (wafMerchMessage = "Caution") then
Response.Write "This transaction is flagged as Caution"
elseif (wafMerchMessage = "Warning") then
Response.Write "This transaction is flagged as Warning"
elseif (wafMerchMessage = "") then
Response.Write "This transaction is flagged as OK"
else
Response.Write "Invalid response for the WorldAlert"
end if
Response.Write "<BR><BR>"
' Each of the digit in AVS can have 5 possible values. "0" for not
supported, "1" for not checked, "2" for matched
' "4" for not matched and "8" for partially matched.
Dim avsR(3)
avsR(0) = "Security code check: "
avsR(1) = "Postcode check: "
avsR(2) = "Address check: "
avsR(3) = "Country check: "
Response.Write "<H3 align=center>AVS Results</H3>"
for i=0 to 3
if MID(AVS,i+1,1) = "0" then
Response.Write avsR(i) & " not supported"
elseif MID(AVS,i+1,1) = "1" then
Response.Write avsR(i) & " not checked"
elseif MID(AVS,i+1,1) = "2" then
Response.Write avsR(i) & " matched"
elseif MID(AVS,i+1,1) = "4" then
Response.Write avsR(i) & " not matched"
elseif MID(AVS,i+1,1) = "8" then
Response.Write avsR(i) & " partially matched"
else
Response.Write MID(AVS,i+1,1) & " : not a valid response for " & avsR(i)
end If
Response.Write "<BR><BR>"
next
Response.Write "<BR><BR>"
' In the callback transTime is returned as the number of milliseconds
since the start of 1970 GMT.
' To change it to ASP format you can use dateAdd function
transTime = callTime/1000
transTime = dateAdd("s",transTime,#Jan 01, 1970 00:00:00#)
Response.Write "<H3 align=center>Other Variables</H3>"
Response.Write "Installation ID: " & instId & "<BR><BR>"
Response.Write "Cart Id: " & cartId & "<BR><BR>"
Response.Write "amount: " & amount & "<BR><BR>"
Response.Write "currency: " & money & "<BR><BR>"
Response.Write "desc: " & desc & "<BR><BR>"
Response.Write "Transaction Time: " & transTime & "<BR><BR>"
Response.Write "Transaction ID: " & transId & "<BR><BR>"
Response.Write "testMode: " & testMode & "<BR><BR>"
Response.Write "name: " & name & "<BR><BR>"
Response.Write "address: " & address & "<BR><BR>"
Response.Write "postcode: " & postcode & "<BR><BR>"
Response.Write "country: " & country & "<BR><BR>"
Response.Write "Phone: " & tel & "<BR><BR>"
Response.Write "email: " & email & "<BR><BR>"
Response.Write "Language: " & lang & "<BR><BR>"
Response.Write "Card Type: " & cardType & "<BR><BR>"
Response.Write "Auth Currency: " & authCurrency & "<BR><BR>"
Response.Write "Auth Amount: " & authAmount & "<BR><BR>"
Response.Write "Auth Mode: " & authMode & "<BR><BR>"
'Response.Write "FuturePay Id: " & futurePayId & "<BR><BR>"
%>
</P>
<!-- If you would like to display images on the response page please
upload the images to WorldPay administration area
and you can reference them like <img src="/i/<installation Id>/<image
name> -->
<!-- If you would like to send your shopper to a access the particular
part of your web site after they have made the
the payment then you can use WPDISPLAY tags to take your shopper to your
selected portion
<A href="http://www.mysite.com/mypage.asp?transId=<WPDISPLAY
item=transId>&cartId=<WPDISPLAY item=cartId>">mysite</A>
-->
<% 'If the transaction was not successful
elseif trans = "C" then %>
<WPDISPLAY ITEM="banner">
<CENTER><B><FONT SIZE="6" COLOR="#CC0000">The Transaction was
cancelled</FONT></B><CENTER>
<% ' If the value transStatus of is neither "Y" or "C"
else %>
<CENTER><B><FONT SIZE="6" COLOR="#CC0000">Transaction didn't return the
correct value<BR>
of transStatus that is it is neither "Y" or "C"</FONT></B><CENTER>
<% end if %>
</BODY>
</HTML>
world pay account pointing to the script. I am presuming the transation from
world pay fires the callback.asp.
What do I have to do to extract the data that comes back from world pay.
Idiot level instructions please.
the script is as follows:
<%@ LANGUAGE=vbscript %>
<% Response.Expires = 0 %>
<% Response.Buffer = TRUE %>
<% Response.ExpiresAbsolute=#Jan 01, 1980 00:00:00# %>
<% Response.CacheControl = "Private" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Simple Callback Script</TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="Jamal Ahmed">
<META NAME="Description" CONTENT="Simple callback script demonstration">
</HEAD>
<BODY BGColor="#FFF9D5">
<!-- Please note this script is just an example. WorldPay doesn't guarantee
that it will work on your system and we don't provide support for this
script -->
<%
Response.Write "The number of variables sent in a QueryString => " &
Request.QueryString.Count() & "<BR><BR>"
Response.Write "The number of variables posted => " & Request.Form.Count()
& "<BR><BR><BR><BR>"
'You can set a callback password to check the callback is sent by WorldPay.
If you set the password
'we will send it back to you with every callback we send.
'callbackPW = Request.Form("callbackPW")
'If you are using callback to insert or get data from the database
'set obj = Server.CreateObject("ADODB.Command")
'obj.open "Your data source name"
trans = Request.form("transStatus")
' if the transaction was successful
If trans = "Y" then %>
<CENTER><B><FONT SIZE="6" COLOR="#CC0000">The Transaction Was
Successful</FONT></B><CENTER>
<!-- WorldPay receipt information -->
<WPDISPAY ITEM="banner">
<P align="center">
<%
' requesting the variables sent by WorldPay
instId = Request.Form("instId") ' Installation ID
cartId = Request.Form("cartId") ' Customer reference for the
particular transaction
amount = Request.Form("amount") ' The amount that was sent to
WorldPay in the order form
money = Request.Form("currency") ' The currency that was sent to
WorldPay in the order form
desc = Request.Form("desc") ' Description of the items purchsed
callTime = Request.Form("transTime") 'Time of the transaction
transId = Request.Form("transId") ' Transaction ID
testMode = Request.Form("testMode") ' 100 if it was a test
transaction and 0 for live
name = Request.Form("name") ' Shopper Details
address = Request.Form("address")
postcode = Request.Form("postcode")
country = Request.Form("country")
tel = Request.Form("tel")
email = Request.Form("email")
lang = Request.Form("lang") ' The language used on the payment page
cardType = Request.Form("cardType") ' The type of the card shopper
paid with
authCurrency = Request.Form("authCurrency") ' The currency that shopper
choose on payment page
authAmount = Request.Form("authAmount") ' The amount in currency the
shopper choose on payment page
authMode = Request.Form("authMode") ' Useful if you are using
pre-auth. "A" for immediate "E" for pre-auth
wafMerchMessage = Request.Form("wafMerchMessage") 'The message sent from
WorldPay to alert if it was possibly a fradulant transaction
AVS = Request.Form("AVS")' It is a four digit code for the
various checks performed by the bank
' First digit is for security code comparison, second digit is
for postcode comparison.
' third digit is for address comparison and fourth digit is for
country comparison.
'futurePayId = Request.Form("futurePayId") Agreement Id for FuturePay
if it was FuturePay transaction
' If you have got your own custom variables.
'M_variables = Request.Form("M_<variable name>")
' WorldPay will send an alert message in wafMerchMessage. It can have two
values Caution or Warning.
' If there is no value in that variable then that means the transaction
was OK
if (wafMerchMessage = "Caution") then
Response.Write "This transaction is flagged as Caution"
elseif (wafMerchMessage = "Warning") then
Response.Write "This transaction is flagged as Warning"
elseif (wafMerchMessage = "") then
Response.Write "This transaction is flagged as OK"
else
Response.Write "Invalid response for the WorldAlert"
end if
Response.Write "<BR><BR>"
' Each of the digit in AVS can have 5 possible values. "0" for not
supported, "1" for not checked, "2" for matched
' "4" for not matched and "8" for partially matched.
Dim avsR(3)
avsR(0) = "Security code check: "
avsR(1) = "Postcode check: "
avsR(2) = "Address check: "
avsR(3) = "Country check: "
Response.Write "<H3 align=center>AVS Results</H3>"
for i=0 to 3
if MID(AVS,i+1,1) = "0" then
Response.Write avsR(i) & " not supported"
elseif MID(AVS,i+1,1) = "1" then
Response.Write avsR(i) & " not checked"
elseif MID(AVS,i+1,1) = "2" then
Response.Write avsR(i) & " matched"
elseif MID(AVS,i+1,1) = "4" then
Response.Write avsR(i) & " not matched"
elseif MID(AVS,i+1,1) = "8" then
Response.Write avsR(i) & " partially matched"
else
Response.Write MID(AVS,i+1,1) & " : not a valid response for " & avsR(i)
end If
Response.Write "<BR><BR>"
next
Response.Write "<BR><BR>"
' In the callback transTime is returned as the number of milliseconds
since the start of 1970 GMT.
' To change it to ASP format you can use dateAdd function
transTime = callTime/1000
transTime = dateAdd("s",transTime,#Jan 01, 1970 00:00:00#)
Response.Write "<H3 align=center>Other Variables</H3>"
Response.Write "Installation ID: " & instId & "<BR><BR>"
Response.Write "Cart Id: " & cartId & "<BR><BR>"
Response.Write "amount: " & amount & "<BR><BR>"
Response.Write "currency: " & money & "<BR><BR>"
Response.Write "desc: " & desc & "<BR><BR>"
Response.Write "Transaction Time: " & transTime & "<BR><BR>"
Response.Write "Transaction ID: " & transId & "<BR><BR>"
Response.Write "testMode: " & testMode & "<BR><BR>"
Response.Write "name: " & name & "<BR><BR>"
Response.Write "address: " & address & "<BR><BR>"
Response.Write "postcode: " & postcode & "<BR><BR>"
Response.Write "country: " & country & "<BR><BR>"
Response.Write "Phone: " & tel & "<BR><BR>"
Response.Write "email: " & email & "<BR><BR>"
Response.Write "Language: " & lang & "<BR><BR>"
Response.Write "Card Type: " & cardType & "<BR><BR>"
Response.Write "Auth Currency: " & authCurrency & "<BR><BR>"
Response.Write "Auth Amount: " & authAmount & "<BR><BR>"
Response.Write "Auth Mode: " & authMode & "<BR><BR>"
'Response.Write "FuturePay Id: " & futurePayId & "<BR><BR>"
%>
</P>
<!-- If you would like to display images on the response page please
upload the images to WorldPay administration area
and you can reference them like <img src="/i/<installation Id>/<image
name> -->
<!-- If you would like to send your shopper to a access the particular
part of your web site after they have made the
the payment then you can use WPDISPLAY tags to take your shopper to your
selected portion
<A href="http://www.mysite.com/mypage.asp?transId=<WPDISPLAY
item=transId>&cartId=<WPDISPLAY item=cartId>">mysite</A>
-->
<% 'If the transaction was not successful
elseif trans = "C" then %>
<WPDISPLAY ITEM="banner">
<CENTER><B><FONT SIZE="6" COLOR="#CC0000">The Transaction was
cancelled</FONT></B><CENTER>
<% ' If the value transStatus of is neither "Y" or "C"
else %>
<CENTER><B><FONT SIZE="6" COLOR="#CC0000">Transaction didn't return the
correct value<BR>
of transStatus that is it is neither "Y" or "C"</FONT></B><CENTER>
<% end if %>
</BODY>
</HTML>