<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Cannot get hosted payment page to display on deployment server in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Cannot-get-hosted-payment-page-to-display-on-deployment-server/m-p/62488#M36799</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been working on this on and off for months and cannot get it to work.&amp;nbsp; I have code to display the hosted payment page and it is working fine on my development machine.&amp;nbsp; As soon as I put it on a server (my dev server or my production server) it does not work.&amp;nbsp;&amp;nbsp; When I run it from my machine All the fields and dropdowns appear properly and everything is aligned properly.&amp;nbsp; But if I run from a server (either my development server or production server) there are no inputs displayed only things like: Description&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {{orderDescription}}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; InvoiceNumber&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{{orderInvoiceNumber}}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Some of these are in red.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have created a small sample app that reproduces the same results and here is the code for it:&lt;/P&gt;&lt;P&gt;WebForm1.aspx&lt;/P&gt;&lt;PRE&gt;&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head runat="server"&amp;gt;
    &amp;lt;title&amp;gt;&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
    
        &amp;lt;asp:Button ID="Button1" runat="server" Text="Button" /&amp;gt;
      
    
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/PRE&gt;&lt;P&gt;WebForm1.aspx.vb:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Imports AuthorizeNet.Api.Contracts.V1
imports AuthorizeNet.Api.Controllers.Bases
imports AuthorizeNet.Api.Controllers


Public Class WebForm1
    Inherits System.Web.UI.Page

  
    Private Function PostToURL(strToken As String) As String
        Response.Clear()
        Dim posturl As String = "https://test.authorize.net/payment/payment"
        Dim sb As New StringBuilder
        sb.Append("&amp;lt;html&amp;gt;")
        sb.AppendFormat("&amp;lt;body onload='document.forms[""form""].submit()'&amp;gt;")
        sb.AppendFormat("&amp;lt;form target='payframe' name='form' action='{0}' method='post'&amp;gt;", posturl)
        sb.AppendFormat("&amp;lt;input type='hidden' name'token' value='{0}'&amp;gt;", strToken)
        sb.Append("&amp;lt;/form&amp;gt;")
        sb.Append("&amp;lt;iframe style='height: 700px;width:100%;border-style: none;'name='payframe' id='payframe' id='payframe'&amp;gt;&amp;lt;/iframe&amp;gt;")
        sb.Append("&amp;lt;/body&amp;gt;")
        sb.Append("&amp;lt;/html&amp;gt;")
        Response.Write(sb.ToString())
        Response.End()
        Return strToken
    End Function

    Private Function GetHostedPaymentPageResponse(ApiLoginID As [String], ApiTransactionKey As [String], amount As Decimal) As ANetApiResponse
        Dim currentURL As String = HttpContext.Current.Request.Url.AbsoluteUri
        Dim postURL As String

            ApiOperationBase(Of ANetApiRequest, ANetApiResponse).RunEnvironment = AuthorizeNet.Environment.SANDBOX
            postURL = "https://test.authorize.net/payment/payment"


        Dim merchantAuthenticationType As New merchantAuthenticationType()
        merchantAuthenticationType.name = ApiLoginID
        merchantAuthenticationType.ItemElementName = ItemChoiceType.transactionKey
        merchantAuthenticationType.Item = ApiTransactionKey
        ApiOperationBase(Of ANetApiRequest, ANetApiResponse).MerchantAuthentication = merchantAuthenticationType

        System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12
        Dim settings As settingType() = New settingType(1) {}

        settings(0) = New settingType()
        settings(0).settingName = settingNameEnum.hostedPaymentButtonOptions.ToString()
        settings(0).settingValue = "{""text"": ""Pay Now""}"

        settings(1) = New settingType()
        settings(1).settingName = settingNameEnum.hostedPaymentOrderOptions.ToString()
        settings(1).settingValue = "{""show"": true, ""merchantName"":""My Company""}"

        Dim MylineItems(0) As AuthorizeNet.Api.Contracts.V1.lineItemType
        Dim thisLineItem As New AuthorizeNet.Api.Contracts.V1.lineItemType

        thisLineItem.itemId = "a100"
        thisLineItem.quantity = 1
        thisLineItem.name = "test"
        thisLineItem.description = "Software Training"
        thisLineItem.unitPrice = 3500.0
        MylineItems(0) = thisLineItem
        Dim thisCustomerType As New AuthorizeNet.Api.Contracts.V1.customerAddressType
        thisCustomerType.address = "123 main"
        thisCustomerType.city = "Santa Barbara"
        thisCustomerType.state = "CA"
        thisCustomerType.country = "USA"
        thisCustomerType.zip = "93111"
        Dim myorder As New AuthorizeNet.Api.Contracts.V1.orderType
        myorder.description = "Software Training"
        ' authorize capture only
        Dim transactionRequest = New transactionRequestType() With { _
             .transactionType = transactionTypeEnum.authCaptureTransaction.ToString(), _
             .amount = amount, _
             .lineItems = MylineItems.ToArray, _
        .order = myorder, _
             .billTo = thisCustomerType _
        }

        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 response1 = controller.GetApiResponse()
        Response.Clear()

        Dim sb As New StringBuilder
        sb.Append("&amp;lt;html&amp;gt;")

        sb.AppendFormat("&amp;lt;body onload='document.forms[""form""].submit()'&amp;gt;")
        sb.AppendFormat("&amp;lt;form target='payframe' name='form' action='{0}' method='post'&amp;gt;", postURL)
        sb.AppendFormat("&amp;lt;input type='hidden' name='token' value='{0}'&amp;gt;", response1.token)
        sb.Append("&amp;lt;/form&amp;gt;")
        sb.Append("&amp;lt;iframe style='height: 700px;width:100%;border-style: none;'name='payframe' id='payframe' id='payframe'&amp;gt;&amp;lt;/iframe&amp;gt;")
        sb.Append("&amp;lt;/body&amp;gt;")
        sb.Append("&amp;lt;/html&amp;gt;")
        Response.Write(sb.ToString())
        Response.End()


        Return response1
    End Function

    Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim ThisApiResponse As ANetApiResponse
        Dim currentURL As String = HttpContext.Current.Request.Url.AbsoluteUri
        
        ThisApiResponse = GetHostedPaymentPageResponse("4YHwQEj988", "3Z36s3YrJce76L2v",3500)

    End Sub
End Class&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So pretty simple code.&amp;nbsp; Not sure what is making it fail when put on a server.&amp;nbsp; The servers have TLS 1.2, Windows Server 2008.&amp;nbsp; Anything I should look at regarding IIS?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any help you can provide.&lt;/P&gt;</description>
    <pubDate>Wed, 04 Apr 2018 00:36:02 GMT</pubDate>
    <dc:creator>jmorgret</dc:creator>
    <dc:date>2018-04-04T00:36:02Z</dc:date>
    <item>
      <title>Cannot get hosted payment page to display on deployment server</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Cannot-get-hosted-payment-page-to-display-on-deployment-server/m-p/62488#M36799</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been working on this on and off for months and cannot get it to work.&amp;nbsp; I have code to display the hosted payment page and it is working fine on my development machine.&amp;nbsp; As soon as I put it on a server (my dev server or my production server) it does not work.&amp;nbsp;&amp;nbsp; When I run it from my machine All the fields and dropdowns appear properly and everything is aligned properly.&amp;nbsp; But if I run from a server (either my development server or production server) there are no inputs displayed only things like: Description&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {{orderDescription}}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; InvoiceNumber&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{{orderInvoiceNumber}}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Some of these are in red.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have created a small sample app that reproduces the same results and here is the code for it:&lt;/P&gt;&lt;P&gt;WebForm1.aspx&lt;/P&gt;&lt;PRE&gt;&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head runat="server"&amp;gt;
    &amp;lt;title&amp;gt;&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
    
        &amp;lt;asp:Button ID="Button1" runat="server" Text="Button" /&amp;gt;
      
    
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/PRE&gt;&lt;P&gt;WebForm1.aspx.vb:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Imports AuthorizeNet.Api.Contracts.V1
imports AuthorizeNet.Api.Controllers.Bases
imports AuthorizeNet.Api.Controllers


Public Class WebForm1
    Inherits System.Web.UI.Page

  
    Private Function PostToURL(strToken As String) As String
        Response.Clear()
        Dim posturl As String = "https://test.authorize.net/payment/payment"
        Dim sb As New StringBuilder
        sb.Append("&amp;lt;html&amp;gt;")
        sb.AppendFormat("&amp;lt;body onload='document.forms[""form""].submit()'&amp;gt;")
        sb.AppendFormat("&amp;lt;form target='payframe' name='form' action='{0}' method='post'&amp;gt;", posturl)
        sb.AppendFormat("&amp;lt;input type='hidden' name'token' value='{0}'&amp;gt;", strToken)
        sb.Append("&amp;lt;/form&amp;gt;")
        sb.Append("&amp;lt;iframe style='height: 700px;width:100%;border-style: none;'name='payframe' id='payframe' id='payframe'&amp;gt;&amp;lt;/iframe&amp;gt;")
        sb.Append("&amp;lt;/body&amp;gt;")
        sb.Append("&amp;lt;/html&amp;gt;")
        Response.Write(sb.ToString())
        Response.End()
        Return strToken
    End Function

    Private Function GetHostedPaymentPageResponse(ApiLoginID As [String], ApiTransactionKey As [String], amount As Decimal) As ANetApiResponse
        Dim currentURL As String = HttpContext.Current.Request.Url.AbsoluteUri
        Dim postURL As String

            ApiOperationBase(Of ANetApiRequest, ANetApiResponse).RunEnvironment = AuthorizeNet.Environment.SANDBOX
            postURL = "https://test.authorize.net/payment/payment"


        Dim merchantAuthenticationType As New merchantAuthenticationType()
        merchantAuthenticationType.name = ApiLoginID
        merchantAuthenticationType.ItemElementName = ItemChoiceType.transactionKey
        merchantAuthenticationType.Item = ApiTransactionKey
        ApiOperationBase(Of ANetApiRequest, ANetApiResponse).MerchantAuthentication = merchantAuthenticationType

        System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12
        Dim settings As settingType() = New settingType(1) {}

        settings(0) = New settingType()
        settings(0).settingName = settingNameEnum.hostedPaymentButtonOptions.ToString()
        settings(0).settingValue = "{""text"": ""Pay Now""}"

        settings(1) = New settingType()
        settings(1).settingName = settingNameEnum.hostedPaymentOrderOptions.ToString()
        settings(1).settingValue = "{""show"": true, ""merchantName"":""My Company""}"

        Dim MylineItems(0) As AuthorizeNet.Api.Contracts.V1.lineItemType
        Dim thisLineItem As New AuthorizeNet.Api.Contracts.V1.lineItemType

        thisLineItem.itemId = "a100"
        thisLineItem.quantity = 1
        thisLineItem.name = "test"
        thisLineItem.description = "Software Training"
        thisLineItem.unitPrice = 3500.0
        MylineItems(0) = thisLineItem
        Dim thisCustomerType As New AuthorizeNet.Api.Contracts.V1.customerAddressType
        thisCustomerType.address = "123 main"
        thisCustomerType.city = "Santa Barbara"
        thisCustomerType.state = "CA"
        thisCustomerType.country = "USA"
        thisCustomerType.zip = "93111"
        Dim myorder As New AuthorizeNet.Api.Contracts.V1.orderType
        myorder.description = "Software Training"
        ' authorize capture only
        Dim transactionRequest = New transactionRequestType() With { _
             .transactionType = transactionTypeEnum.authCaptureTransaction.ToString(), _
             .amount = amount, _
             .lineItems = MylineItems.ToArray, _
        .order = myorder, _
             .billTo = thisCustomerType _
        }

        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 response1 = controller.GetApiResponse()
        Response.Clear()

        Dim sb As New StringBuilder
        sb.Append("&amp;lt;html&amp;gt;")

        sb.AppendFormat("&amp;lt;body onload='document.forms[""form""].submit()'&amp;gt;")
        sb.AppendFormat("&amp;lt;form target='payframe' name='form' action='{0}' method='post'&amp;gt;", postURL)
        sb.AppendFormat("&amp;lt;input type='hidden' name='token' value='{0}'&amp;gt;", response1.token)
        sb.Append("&amp;lt;/form&amp;gt;")
        sb.Append("&amp;lt;iframe style='height: 700px;width:100%;border-style: none;'name='payframe' id='payframe' id='payframe'&amp;gt;&amp;lt;/iframe&amp;gt;")
        sb.Append("&amp;lt;/body&amp;gt;")
        sb.Append("&amp;lt;/html&amp;gt;")
        Response.Write(sb.ToString())
        Response.End()


        Return response1
    End Function

    Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim ThisApiResponse As ANetApiResponse
        Dim currentURL As String = HttpContext.Current.Request.Url.AbsoluteUri
        
        ThisApiResponse = GetHostedPaymentPageResponse("4YHwQEj988", "3Z36s3YrJce76L2v",3500)

    End Sub
End Class&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So pretty simple code.&amp;nbsp; Not sure what is making it fail when put on a server.&amp;nbsp; The servers have TLS 1.2, Windows Server 2008.&amp;nbsp; Anything I should look at regarding IIS?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any help you can provide.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2018 00:36:02 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Cannot-get-hosted-payment-page-to-display-on-deployment-server/m-p/62488#M36799</guid>
      <dc:creator>jmorgret</dc:creator>
      <dc:date>2018-04-04T00:36:02Z</dc:date>
    </item>
  </channel>
</rss>

