This is a continuation of the message:
I could not post another message in the former topic (the message woupld post but then disappear), so I am starting another thread here.
RaynorC1emen7 wrote:
Just want to make sure it not your account that is having issue, not returning any response. It look like you posting the data to the /datavalidation/ page. What we need change the relay response url to https://developer.authorize.net/tools/paramdump/index.php to see if it might be an account issue that it not post any data.
Does the code still work in the sandbox with the test account?
If I try to use https://developer.authorize.net/tools/paramdump/index.php for the callback url, the system will not even navigate to the payment page, but will return "url not found" error message. The code fails in the same way on the main site in both production and test modes. I am getting other errors when I try it from the sandbox account, but that may be because my sandbox account is old/expired.
Bottom line - when we need is for Authorize.net to optionally save a log of the callback messages it sends.
08-10-2015 01:06 PM
So the code does NOT work anywhere?
If I try to use https://developer.authorize.net/tools/paramdump/index.php for the callback url, the system will not even navigate to the payment page, but will return "url not found" error message.
You keep saying callback url, is that the relay response url?
but will return "url not found" error message.
Where? on the browser windows? that the exact message? What on the url address bar?
08-10-2015 01:20 PM - edited 08-10-2015 01:21 PM
By "callback" I mean "relay response" in your terminology
I just tried it again using https://developer.authorize.net/tools/paramdump/index.php as the default relay response url.
This time I didn't get an error, but I also didn't see any page displayed. My callback form collects the the "x-blahblah" parameters that the authorize.net site is supposed to send in the message, and passes them to another form which logs the results and sends a page back to the user explaining what happened and telling them what to do next.
Some time ago I added logic to the callback form which logs the html and all of the query parameters from the relay response message. There are no query parameters in the callback message - hence the problem.
08-10-2015 02:03 PM
1)So the url on the address bar is https://developer.authorize.net/tools/paramdump.index.php but the content is blank?
On the blank screen can you look at the page source?
2)What happened if you put that in a new browswer windows? does it display anything at all?
https://developer.authorize.net/tools/paramdump/index.php
08-10-2015 04:23 PM
Maybe a Mod would read this and get what you need
08-10-2015 05:00 PM
Was playing on your website, look like you have testmode on because I was using a test # 4111111111111111
and it said payment was successfuly process.
That doesn't make sense as the there are only a few different between testmode on or testmode off.
One being transactionID is always 0 on testmode on.
Can you post the code in your RegisterCallback.aspx page so we can look how you are getting value?
08-10-2015 05:25 PM
I am posting responses that display as being posted, but them they don't show up when I reload the topic.
Why?
08-12-2015 11:57 AM
If you are posting code, please use the Insert Code option in the comment box. It looks like this <>
Richard
08-12-2015 12:26 PM
1. When I use https://developer.authorize.net/tools/paramdump/index.php as the sole relay response url, I get the following response when the Authorize.net payment page should be displayed:
The following errors have occurred.
(14) The referrer, relay response or receipt link URL is invalid.
2. If I then try navigaing to the above URL I get an Authorize.net "Page Not Found" error.
3. I tried this for both my live and sandbox accounts and I am now having the same issue for both - blank relay response. Here is the contents of my log of the message:
Host: 50.244.14.225 50.244.14.225 Browser: Firefox39, 39.0 BrowserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0 Query String: Url: /PageRegister/RegisterResult.aspx UrlReferrer: /PageRegister/RegisterCallback.aspx Log: Message: Length: 0 Request URL: /PageRegister/RegisterCallback.aspx
4. Here are the authorize.net keys I am using:
Live:
<add key="AUTHORIZE_NET_API_LOGIN" value="4C7B2Zyfq"/>
<add key="AUTHORIZE_NET_TRANSACTION_KEY" value="***"/>
<add key="AUTHORIZE_NET_URL_MODE" value="LIVE"/>
<add key="AUTHORIZE_NET_URL_LIVE" value="https://secure.authorize.net/gateway/transact.dll"/>
Sandbox:
<add key="AUTHORIZE_NET_API_LOGIN" value="5QK6Z2FuUt58"/>
<add key="AUTHORIZE_NET_TRANSACTION_KEY" value="***"/>
<add key="AUTHORIZE_NET_URL_MODE" value="TEST"/>
<add key="AUTHORIZE_NET_URL_TEST" value="https://test.authorize.net/gateway/transact.dll"/>
5. The code is in the next message.
08-13-2015
06:15 AM
- last edited on
08-13-2015
06:26 AM
by
RichardH
1. Here is the markup and the code for the "Checkout" page which calls the Authorize.net payment page:
<%@ Page
Title="Checkout"
Language="vb"
AutoEventWireup="false"
ViewStateMode="Disabled"
MasterPageFile="~/PageMaster/MasterLogin.master"
CodeBehind="RegisterCheckout.aspx.vb"
Inherits="RegisterCheckout" %>
<%@ MasterType virtualpath="~/PageMaster/MasterLogin.master" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="ctlBody" ContentPlaceHolderID="ctlContentBody" runat="server">
<h3>Checkout</h3>
<input type="hidden" name="x_invoice_num" id="x_invoice_num" value="<%= AuthorizeNet_x_invoice %>" />
<input type="hidden" name="x_amount" id="x_amount" value="<%= AuthorizeNet_x_amount %>" />
<input type="hidden" name="x_description" id="x_description" value="<%= AuthorizeNet_x_description %>" />
<input type="hidden" name="x_company" id="x_company" value="<%= AuthorizeNet_x_company %>" />
<input type="hidden" name="x_ship_to_company" id="x_ship_to_company" value="<%= AuthorizeNet_x_company %>" />
<input type="hidden" name="x_first_name" id="x_first_name" value="<%= AuthorizeNet_x_first_name %>" />
<input type="hidden" name="x_ship_to_first_name" id="x_ship_to_first_name" value="<%= AuthorizeNet_x_first_name %>" />
<input type="hidden" name="x_last_name" id="x_last_name" value="<%= AuthorizeNet_x_last_name %>" />
<input type="hidden" name="x_ship_to_last_name" id="x_ship_to_last_name" value="<%= AuthorizeNet_x_last_name %>" />
<input type="hidden" name="x_address" id="x_address" value="<%= AuthorizeNet_x_address %>" />
<input type="hidden" name="x_ship_to_address" id="x_ship_to_address" value="<%= AuthorizeNet_x_address %>" />
<input type="hidden" name="x_city" id="x_city" value="<%= AuthorizeNet_x_city %>" />
<input type="hidden" name="x_ship_to_city" id="x_ship_to_city" value="<%= AuthorizeNet_x_city %>" />
<input type="hidden" name="x_state" id="x_state" value="<%= AuthorizeNet_x_state %>" />
<input type="hidden" name="x_ship_to_state" id="x_ship_to_state" value="<%= AuthorizeNet_x_state %>" />
<input type="hidden" name="x_zip" id="x_zip" value="<%= AuthorizeNet_x_zip %>" />
<input type="hidden" name="x_ship_to_zip" id="x_ship_to_zip" value="<%= AuthorizeNet_x_zip %>" />
<input type="hidden" name="x_country" id="x_country" value="<%= AuthorizeNet_x_country %>" />
<input type="hidden" name="x_ship_to_country" id="x_ship_to_country" value="<%= AuthorizeNet_x_country %>" />
<input type="hidden" name="x_email" id="x_email" value="<%= AuthorizeNet_x_email %>" />
<input type="hidden" name="x_phone" id="x_phone" value="<%= AuthorizeNet_x_phone %>" />
<input type="hidden" name="x_cancel_url" id="x_cancel_url" value="<%= AuthorizeNet_x_cancel_url %>" />
<input type="hidden" name="x_relay_url" id="x_relay_url" value="<%= AuthorizeNet_x_relay_url %>" />
<input type='hidden' name="x_receipt_link_url" id="x_receipt_link_url" value="<%= AuthorizeNet_x_receipt_link_url %>" />
<input type="hidden" name="x_login" id="x_login" value="<%= AuthorizeNet_x_login %>" />
<input type="hidden" name="x_test_request" id="x_test_request" value="<%= AuthorizeNet_x_test_request %>" />
<input type="hidden" name="x_fp_sequence" id="x_fp_sequence" value="<%= AuthorizeNet_x_fp_sequence %>" />
<input type="hidden" name="x_fp_timestamp" id="x_fp_timestamp" value="<%= AuthorizeNet_x_fp_timestamp %>" />
<input type="hidden" name="x_fp_hash" id="x_fp_hash" value="<%= AuthorizeNet_x_fp_hash %>" />
<input type="hidden" name="x_version" id="x_version" value="<%= AuthorizeNet_x_version %>" />
<input type="hidden" name="x_relay_response" id="x_relay_response" value="TRUE" />
<input type="hidden" name="x_show_form" id="x_show_form" value="PAYMENT_FORM" />
<br />
<br />
<table class="Admin">
<tr>
<td>
Registration Fee:
</td>
<td>
<asp:Label ID="lblFee" runat="server" />
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td>
Discount:
</td>
<td>
<asp:Label ID="lblDiscount" runat="server" />
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td>
Payment Amount:
</td>
<td>
<asp:Label ID="lblAmount" runat="server" />
</td>
</tr>
</table>
<br />
<br />
<asp:Button ID="btnPay" runat="server" Text="Proceed to Payment Screen" CssClass="button" />
<asp:Button ID="btnCancel" runat="server" Text="Cancel" CssClass="button" />
</asp:Content>
Public Class RegisterCheckout
Inherits PageBase
' Test credit card numbers
' American Express 370000000000002
' Discover 6011000000000012
' MasterCard 5424000000000015
' Visa 4007000000027
' Visa 4012888818888
' Diners Club 38000000000006
' JCB 3088000000000017
#Region "Page Routines"
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
CurrentApp.ResultSequence = AuthorizeNet.Crypto.GenerateSequence()
CurrentApp.ResultTimeStamp = AuthorizeNet.Crypto.GenerateTimestamp().ToString
lblFee.Text = CurrentApp.Fee.ToString("C")
lblDiscount.Text = CurrentApp.Discount.ToString("C")
lblAmount.Text = CurrentApp.Amount.ToString("C")
If Config.AUTHORIZE_NET_URL_MODE = "TEST" Then
btnPay.PostBackUrl = Config.AUTHORIZE_NET_URL_TEST
Else
btnPay.PostBackUrl = Config.AUTHORIZE_NET_URL_LIVE
End If
End Sub
Protected Sub btnCancel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCancel.Click
CurrentSession.RedirectToPrev(Response, Session)
End Sub
#End Region
#Region "Properties"
Public ReadOnly Property AuthorizeNet_x_invoice() As Integer
Get
Return CurrentApp.ID
End Get
End Property
Public ReadOnly Property AuthorizeNet_x_amount() As String
Get
Return CurrentApp.Amount.ToString("#####0.00")
End Get
End Property
Public ReadOnly Property AuthorizeNet_x_description() As String
Get
Return "Registration Fee for " & CurrentApp.FirstName & " " & CurrentApp.LastName
End Get
End Property
Public ReadOnly Property AuthorizeNet_x_company() As String
Get
Return CurrentApp.Company
End Get
End Property
Public ReadOnly Property AuthorizeNet_x_first_name() As String
Get
Return CurrentApp.FirstName
End Get
End Property
Public ReadOnly Property AuthorizeNet_x_last_name() As String
Get
Return CurrentApp.LastName
End Get
End Property
Public ReadOnly Property AuthorizeNet_x_address() As String
Get
Return CurrentApp.Address1
End Get
End Property
Public ReadOnly Property AuthorizeNet_x_city() As String
Get
Return CurrentApp.City
End Get
End Property
Public ReadOnly Property AuthorizeNet_x_state() As String
Get
Return CurrentApp.State
End Get
End Property
Public ReadOnly Property AuthorizeNet_x_zip() As String
Get
Return CurrentApp.Zip
End Get
End Property
Public ReadOnly Property AuthorizeNet_x_country() As String
Get
Return CurrentApp.Country
End Get
End Property
Public ReadOnly Property AuthorizeNet_x_email() As String
Get
Return CurrentApp.Email
End Get
End Property
Public ReadOnly Property AuthorizeNet_x_phone() As String
Get
Return CurrentApp.Phone
End Get
End Property
Public ReadOnly Property AuthorizeNet_x_cancel_url() As String
Get
Return AuthorizeNet_x_relay_url
End Get
End Property
Public ReadOnly Property AuthorizeNet_x_relay_url() As String
Get
Return AppConstants.PageRegisterCallback.Replace("~", Config.SiteURL)
End Get
End Property
Public ReadOnly Property AuthorizeNet_x_receipt_link_url() As String
Get
Return AuthorizeNet_x_relay_url
End Get
End Property
Public ReadOnly Property AuthorizeNet_x_login() As String
Get
Return Config.AUTHORIZE_NET_API_LOGIN
End Get
End Property
Public ReadOnly Property AuthorizeNet_x_test_request() As String
Get
Dim sResult = "TRUE"
Dim osettings As settings = New settings(AppConstants.SettingsID)
If Not IsNothing(osettings) AndAlso osettings.Exists Then
sResult = osettings.paymenttestmode.ToString.ToUpper
End If
Return sResult
End Get
End Property
Public ReadOnly Property AuthorizeNet_x_version() As String
Get
Return Config.AUTHORIZE_NET_VERSION
End Get
End Property
Public ReadOnly Property AuthorizeNet_x_fp_sequence() As String
Get
Return CurrentApp.ResultSequence
End Get
End Property
Public ReadOnly Property AuthorizeNet_x_fp_timestamp() As String
Get
Return CurrentApp.ResultTimeStamp
End Get
End Property
Public ReadOnly Property AuthorizeNet_x_fp_hash() As String
Get
Return AuthorizeNet.Crypto.GenerateFingerprint(
Config.AUTHORIZE_NET_TRANSACTION_KEY,
Config.AUTHORIZE_NET_API_LOGIN,
Decimal.Parse(AuthorizeNet_x_amount),
CurrentApp.ResultSequence,
CurrentApp.ResultTimeStamp)
End Get
End Property
#End Region
End Class
2. Here is the markup and the code for the "Callback" page which is the relay response form:
<%@ Page
Language="vb"
AutoEventWireup="false"
ViewStateMode="Disabled"
CodeBehind="RegisterCallback.aspx.vb"
Inherits="RegisterCallback" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<script type="text/Javascript">
window.location = "<%= AuthorizeNet_x_result_url %>";
</script>
</body>
</html>
Imports System.IO
Public Class RegisterCallback
Inherits PageBase
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
' This page cannot use the normal error handling...
'
' It is called by Authorize.NET and doesn't contain cookies (ALL Session info is missing).
' Whatever this page returns is "piped" through Authorize.NET and is rendered in the client browser.
' So it is basically required to return a redirect, so we can return to "sanity" (valid
' Session variables) as soon as possible.
'
' ALSO: Anything you render in this page (i.e., if you fail to do the redirect), will be rendered
' to the client browser... and because the browser's URL won't be pointing to this page,
' links will likely break.
Dim oStream As Stream = Request.InputStream
Dim iLength As Integer = CInt(oStream.Length)
Dim bArray(iLength) As Byte
oStream.Read(bArray, 0, iLength)
Dim sMessage As String = ""
For iX As Integer = 0 To iLength - 1
sMessage &= bArray(iX).ToString()
Next
errormessage.LogMessage("Message: " & sMessage & " Length: " & iLength & " Request URL: " & Request.Url.PathAndQuery)
Dim ocurrentpayment As currentpayment = New currentpayment(AppConstants.SettingsID)
If Not IsNothing(ocurrentpayment) AndAlso ocurrentpayment.Exists Then
With ocurrentpayment
.resultcode = GetRequestParam("x_response_code")
If String.IsNullOrWhiteSpace(.resultcode) Then
Else
.resultmessage = GetRequestParam("x_response_reason_text").Replace("+", " ") & " - Reason Code: " & GetRequestParam("x_response_reason_code")
.ccno = GetRequestParam("x_account_number")
.hashvalue = GetRequestParam("x_MD5_Hash")
.userid = CInt(GetRequestParam("x_invoice_num"))
If IsNumeric(GetRequestParam("x_amount")) Then
.amount = CDbl(GetRequestParam("x_amount"))
Else
.amount = 0
End If
End If
End With
ocurrentpayment.Update(CurrentSession.UserRef, New List(Of String))
End If
'Response.RedirectPermanent(sUrl, True)
' Other Authorize.Net parameters
'x_avs_code=
'x_auth_code=
'x_trans_id=
'x_method=
'x_card_type=
'x_first_name=
'x_last_name=
'x_company=
'x_address=
'x_city=test
'x_state=IN
'x_zip=11111
'x_country=
'x_phone=
'x_fax=
'x_email=
'x_description=
'x_type=auth_capture
'x_cust_id=
'x_ship_to_first_name=
'x_ship_to_last_name=
'x_ship_to_company=
'x_ship_to_address=
'x_ship_to_city=
'x_ship_to_state=
'x_ship_to_zip=
'x_ship_to_country=
'x_tax=
'x_duty=
'x_freight=
'x_tax_exempt=
'x_po_num=
'x_cvv2_resp_code=
'x_cavv_response=
End Sub
Public ReadOnly Property AuthorizeNet_x_result_url() As String
Get
Dim sUrl = AppConstants.PageRegisterResult.Replace("~", Config.SiteURL)
errormessage.LogMessage("Result URL: " & sUrl)
Return sUrl
End Get
End Property
Private Function GetRequestParam(sParamName As String) As String
Dim sResult As String = ""
Try
sResult = Request(sParamName)
Catch
End Try
Return sResult
End Function
End Class
3. Here is the markup and the code for the "Register" page which is launched by the Callback page, and returns a response to the user:
<%@ Page
Title="Registration Payment Result"
Language="vb"
AutoEventWireup="false"
ViewStateMode="Disabled"
MasterPageFile="~/PageMaster/MasterLogin.master"
CodeBehind="RegisterResult.aspx.vb"
Inherits="RegisterResult" %>
<%@ MasterType virtualpath="~/PageMaster/MasterLogin.master" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="ctlBody" ContentPlaceHolderID="ctlContentBody" runat="server">
<h3>Registration Payment Result</h3>
<asp:Panel ID="pnlAdmin" runat="server" CssClass="Admin">
<br />
<br />
<table>
<tr>
<td>Payment Result: </td>
<td><asp:Label ID="lblResult" runat="server" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Next Step: </td>
<td><asp:Label ID="lblNextStep" runat="server" /></td>
</tr>
</table>
</asp:Panel>
<br />
<br />
<asp:Button ID="btnLogin" runat="server" Text="Continue to Login" CssClass="button" />
<asp:Button ID="btnRegister" runat="server" Text="Return to Register" CssClass="button" />
</asp:Content>
Public Class RegisterResult
Inherits PageBase
#Region "Page Routines"
Private Const sOK As String = "0"
Private Const sApproved As String = "1"
Private Const sDeclined As String = "2"
Private Const sError As String = "3"
Private Const sHeldForReview As String = "4"
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
If Not Page.IsPostBack Then
Dim bError As Boolean = True
Dim ocurrentpayment As currentpayment = New currentpayment(AppConstants.SettingsID)
lblResult.Text = ""
lblNextStep.Text = "Click 'Return to Register' to repeat the registration and payment process"
If IsNothing(ocurrentpayment) OrElse Not ocurrentpayment.Exists Then
lblResult.Text = "Payment processing failure - payment record not found"
Else
With ocurrentpayment
If .resultcode = sDeclined Then
lblResult.Text = "Payment authorization denied"
ElseIf .resultcode = sError Then
lblResult.Text = "Error in payment authorization"
ElseIf .resultcode = sHeldForReview Then
lblResult.Text = "Payment held for review"
ElseIf .resultcode <> sApproved AndAlso .resultcode <> sApproved AndAlso Not String.IsNullOrWhiteSpace(.resultcode) Then
lblResult.Text = "Transaction was cancelled"
Else
Dim ouser As users = New users(.userid)
If IsNothing(ouser) OrElse Not ouser.Exists Then
lblResult.Text = "Transaction database record was not found"
ElseIf Not ouser.pending Then
lblResult.Text = "Transaction reference was corrupted"
ElseIf .amount <> ouser.ccamount Then
lblResult.Text = "Transaction amount was corrupted: " & .amount
Else
bError = False
lblResult.Text = "Payment was successfully processed" & CStr(IIf(.paymenttestmode, " in test mode", ""))
lblNextStep.Text = "Click the 'Continue to Login' to proceed to login with your newly selected username and password"
With ouser
Dim oReplacementParams As New Hashtable
oReplacementParams.Add("%firstname%", .firstname)
oReplacementParams.Add("%username%", .username)
oReplacementParams.Add("%password%", SessionContext.DecryptString(.password))
oReplacementParams.Add("%note%", IIf(ocurrentpayment.paymenttestmode, "Payment was made in test mode, so the user record is still pending", ""))
AppContext.SendEmail(AppConstants.EmailUser_LoginWelcome, "", .email, oReplacementParams)
.active = True
.pending = CBool(IIf(ocurrentpayment.paymenttestmode, True, False))
.ccno = ocurrentpayment.ccno
.Update(CurrentSession.UserRef, Master.ErrorMsgList)
End With
End If
End If
If bError Then
errormessage.LogMessage("Payment failure - UserID: " & .userid & " Msg: " & lblResult.Text & " - code" & .resultcode & " message: " & .resultmessage)
End If
.resultcode = ""
.resultmessage = ""
.hashvalue = ""
.userid = 0
.amount = 0
ocurrentpayment.Update(CurrentSession.UserRef, Master.ErrorMsgList)
End With
End If
End If
Catch oEx As Exception
errormessage.LogException(oEx, Me.GetType.Name, New System.Diagnostics.StackFrame().GetMethod.Name, Request)
End Try
End Sub
Private Sub btnLogin_Click(sender As Object, e As System.EventArgs) Handles btnLogin.Click
CurrentSession.RedirectToPage(AppConstants.PageLogin, Request, Response, CurrentApp)
End Sub
Private Sub btnRegister_Click(sender As Object, e As System.EventArgs) Handles btnRegister.Click
Dim ocurrentpayment As currentpayment = New currentpayment(AppConstants.SettingsID)
If Not IsNothing(ocurrentpayment) AndAlso ocurrentpayment.Exists Then
CurrentApp.ID = ocurrentpayment.userid
End If
CurrentSession.RedirectToPage(AppConstants.PageRegister, Request, Response, CurrentApp)
End Sub
#End Region
End Class
08-13-2015 06:22 AM