cancel
Showing results for 
Search instead for 
Did you mean: 

Accept Hosted Form Page is displayed as a blank page

I am able to generate a token and populate a hidden form field with that token.  The Submit button posts to "https://accept.authorize.net/payment/payment".  But all that is show in a blank page.  What am I missing?

 

I am using our production environment which is set to Live.

 

I have searched and I can't find any help on this.  Thank you.

 

'--------------------------------------

Here is the some of content of the last token retrieved

----------------------------------------

<input type="hidden" name="Token" id="Token" value="UnNqerae/80nyUnUUXKonp47t [REMOVED THE REST OF THIS BUT YOU GET THE IDEA]">

 

 

-------------------------------------------------------

Here is where I request the token:

-------------------------------------------------------

 

Function getHostedPaymentPageToken(amount As Decimal) As string
Console.WriteLine("GetAnAcceptPaymentPage Sample")
AuthorizeNet.Api.Controllers.Bases.ApiOperationBase(Of ANetApiRequest, ANetApiResponse).RunEnvironment = AuthorizeNet.Environment.PRODUCTION
***"
Dim transactionKey as string="***"

Dim merchantAuthType as new merchantAuthenticationType()

With merchantAuthType
.name = loginID
.ItemElementName = ItemChoiceType.transactionKey
.Item = transactionKey
End With

AuthorizeNet.Api.Controllers.Bases.ApiOperationBase(Of ANetApiRequest,ANetApiResponse).MerchantAuthentication=merchantAuthType

Dim settings As settingType() = New settingType(1) {}

settings(0) = New settingType()
settings(0).settingName = settingNameEnum.hostedPaymentButtonOptions.ToString()
settings(0).settingValue = "{""text"": ""Pay""}"

settings(1) = New settingType()
settings(1).settingName = settingNameEnum.hostedPaymentOrderOptions.ToString()
settings(1).settingValue = "{""show"": true}"

' authorize capture only
Dim transactionRequest = New transactionRequestType()
With transactionRequest
.transactionType = transactionTypeEnum.authCaptureTransaction.ToString()
.amount = amount
End With

Dim request = New getHostedPaymentPageRequest()
request.transactionRequest = transactionRequest
request.hostedPaymentSettings = settings

' instantiate the contoller that will call the service
Dim controller = New getHostedPaymentPageController(request)
controller.Execute()

' get the response from the service (errors contained if any)
Dim aResponse = controller.GetApiResponse()

'validate
If aResponse IsNot Nothing AndAlso aResponse.messages.resultCode = messageTypeEnum.Ok Then
trace.write("Message code : " + aResponse.messages.message(0).code)
trace.write("Message text : " + aResponse.messages.message(0).text)
trace.write("Token : " + aResponse.token)
ElseIf aResponse IsNot Nothing Then
trace.write("Error: " & aResponse.messages.message(0).code & " " & aResponse.messages.message(0).text)
trace.write("Failed to get hosted payment page")
End If

Return aResponse.token
End Function

 

 

 

 

 

zozo
Member
4 REPLIES 4

Hello @zozo

 

Are you able to duplicate this in the sandbox?

 

Richard

RichardH
Administrator Administrator
Administrator

I am not using sandbox. Is this because of the token I am passing as a hidden field? What can cause this?

It is not because of the token being in a hidden input. Are you getting an error message like "Missing or invalid token" or just a completely blank page? Are you targeting an iframe?

Powered by NexWebSites.com -
Certified Authorize.net developers
NexusSoftware
Trusted Contributor

Additional troubleshooting steps:

 

Try stripping it down to its most basic level. Make a basic HTML form like this:

 

<html>
<head>
<title>Form test page</title>
</head>

<body>
<form method="post" action="https://accept.authorize.net/payment/payment">

Token: <textarea rows="8" cols="100" name="token" value="" ></textarea>
<br><br>
<input type="submit" value="Get the payment form" />

</form>
</body>

</html>

 

Generate a token. Paste that token into this form. Submit the form. If you get a payment page, everything's working correctly and there's some other problem in your production code. If this test still ends up with a blank page, either there's a problem on our end, or something you submitted in the token request is in error, but still generated a token even though that token couldn't be used.