<?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 Re: How to redirect to Hosted Payment Page? in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/How-to-redirect-to-Hosted-Payment-Page/m-p/67257#M40697</link>
    <description>&lt;P&gt;How did you fix that exactly?&lt;/P&gt;</description>
    <pubDate>Wed, 03 Apr 2019 20:39:03 GMT</pubDate>
    <dc:creator>Taso</dc:creator>
    <dc:date>2019-04-03T20:39:03Z</dc:date>
    <item>
      <title>How to redirect to Hosted Payment Page?</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/How-to-redirect-to-Hosted-Payment-Page/m-p/66499#M40033</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to redirect to a hosted payment page using .net with c#. I have the basic app that is getting a token using&amp;nbsp;&lt;SPAN&gt;'getHostedPaymentPageResponse', and I'm putting the token received to a form and submitting the form to&amp;nbsp;"&lt;A href="https://test.authorize.net/payment/payment" target="_blank" rel="nofollow noopener noreferrer"&gt;https://test.authorize.net/payment/payment&lt;/A&gt;" with POST method. But I keep getting "Missing or invalid token" error. Following is my code:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;HTML:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;lt;form runat="server" action="" id="formAuthorizeNetTestPage" name="formAuthorizeNetTestPage" method="POST"&amp;gt;&lt;BR /&gt;&amp;lt;input type="hidden" name="token" value="" runat="server" id="redirectToken"/&amp;gt;&lt;BR /&gt;&amp;lt;p&amp;gt;Customer ID: &amp;lt;/p&amp;gt;&lt;BR /&gt;&amp;lt;asp:TextBox runat="server" ID="customerID"&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&lt;BR /&gt;&amp;lt;p&amp;gt;Amount: &amp;lt;/p&amp;gt;&lt;BR /&gt;&amp;lt;asp:TextBox runat="server" ID="amount_input"&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&lt;BR /&gt;&amp;lt;asp:Button ID="Button1" OnClick="Button1_Click" runat="server" text="Pay"/&amp;gt;&lt;BR /&gt;&amp;lt;/form&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Code Behind:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;public void Button1_Click(object sender, EventArgs e)&lt;BR /&gt;{&lt;BR /&gt;System.Diagnostics.Debug.WriteLine("Hello, Button1 Clicked");&lt;BR /&gt;decimal amount = decimal.Parse(amount_input.Text);&lt;BR /&gt;string customerId = customerID.Text;&lt;BR /&gt;var ApiResponse = Run(LoginId, TransactionKey, amount, customerId, redirectToken, formAuthorizeNetTestPage, body_container);&lt;BR /&gt;//System.Diagnostics.Debug.WriteLine();&lt;BR /&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;public static ANetApiResponse Run(String ApiLoginID, String ApiTransactionKey, decimal amount, string customerProfileId, System.Web.UI.HtmlControls.HtmlInputHidden token_input, System.Web.UI.HtmlControls.HtmlForm formAuthorizeNetTestPage, System.Web.UI.HtmlControls.HtmlGenericControl body_container)&lt;BR /&gt;{&lt;BR /&gt;System.Diagnostics.Debug.WriteLine("GetAnAcceptPaymentPage Sample");&lt;BR /&gt;ApiOperationBase&amp;lt;ANetApiRequest, ANetApiResponse&amp;gt;.RunEnvironment = AuthorizeNet.Environment.SANDBOX;&lt;BR /&gt;ApiOperationBase&amp;lt;ANetApiRequest, ANetApiResponse&amp;gt;.MerchantAuthentication = new merchantAuthenticationType()&lt;BR /&gt;{&lt;BR /&gt;name = ApiLoginID,&lt;BR /&gt;ItemElementName = ItemChoiceType.transactionKey,&lt;BR /&gt;Item = ApiTransactionKey,&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;settingType[] settings = new settingType[]{&lt;BR /&gt;new settingType()&lt;BR /&gt;// More settings can be added here as and when required&lt;BR /&gt;};&lt;BR /&gt;settings[0] = new settingType();&lt;BR /&gt;settings[0].settingName = settingNameEnum.hostedProfileReturnUrl.ToString();&lt;BR /&gt;settings[0].settingValue = "&lt;A href="https://example.com/" target="_blank"&gt;https://example.com/&lt;/A&gt;";&lt;/P&gt;&lt;P&gt;var request = new getHostedProfilePageRequest();&lt;BR /&gt;request.customerProfileId = customerProfileId;&lt;BR /&gt;request.hostedProfileSettings = settings;&lt;/P&gt;&lt;P&gt;var controller = new getHostedProfilePageController(request);&lt;BR /&gt;controller.Execute();&lt;/P&gt;&lt;P&gt;// get the response from the service (errors contained if any)&lt;BR /&gt;var response = controller.GetApiResponse();&lt;/P&gt;&lt;P&gt;// validate response&lt;BR /&gt;if (response != null &amp;amp;&amp;amp; response.messages.resultCode == messageTypeEnum.Ok)&lt;BR /&gt;{&lt;BR /&gt;System.Diagnostics.Debug.WriteLine("Message code : " + response.messages.message[0].code);&lt;BR /&gt;System.Diagnostics.Debug.WriteLine("Message text : " + response.messages.message[0].text);&lt;BR /&gt;System.Diagnostics.Debug.WriteLine("Token : " + response.token);&lt;BR /&gt;}&lt;BR /&gt;else if (response != null)&lt;BR /&gt;{&lt;BR /&gt;System.Diagnostics.Debug.WriteLine("Error: " + response.messages.message[0].code + " " + response.messages.message[0].text);&lt;BR /&gt;System.Diagnostics.Debug.WriteLine("Failed to get hosted payment page");&lt;BR /&gt;}&lt;BR /&gt;System.Diagnostics.Debug.WriteLine(response.token);&lt;BR /&gt;token_input.Value = response.token;&lt;BR /&gt;formAuthorizeNetTestPage.Action = "&lt;A href="https://test.authorize.net/payment/payment" target="_blank"&gt;https://test.authorize.net/payment/payment&lt;/A&gt;";&lt;BR /&gt;//HttpContext.Current.Response.Redirect("&lt;A href="https://test.authorize.net/payment/payment" target="_blank"&gt;https://test.authorize.net/payment/payment&lt;/A&gt;");&lt;BR /&gt;body_container.Attributes.Add("onload", "document.getElementById('formAuthorizeNetTestPage').submit();");&lt;/P&gt;&lt;P&gt;return response;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 15:43:08 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/How-to-redirect-to-Hosted-Payment-Page/m-p/66499#M40033</guid>
      <dc:creator>toirovd</dc:creator>
      <dc:date>2019-02-22T15:43:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to redirect to Hosted Payment Page?</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/How-to-redirect-to-Hosted-Payment-Page/m-p/66525#M40050</link>
      <description>&lt;P&gt;Please read the steps in INTEGRATING THE FORM USING A REDIRECT section here:-&lt;/P&gt;&lt;P&gt;&lt;A href="https://developer.authorize.net/api/reference/features/accept_hosted.html#Integrating_the_Form_using_a_Redirect" target="_blank"&gt;https://developer.authorize.net/api/reference/features/accept_hosted.html#Integrating_the_Form_using_a_Redirect&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Feb 2019 18:18:00 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/How-to-redirect-to-Hosted-Payment-Page/m-p/66525#M40050</guid>
      <dc:creator>Shoagraw</dc:creator>
      <dc:date>2019-02-25T18:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to redirect to Hosted Payment Page?</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/How-to-redirect-to-Hosted-Payment-Page/m-p/66752#M40259</link>
      <description>&lt;P&gt;Thanks. I got it fixed. Obviously, the form was being submitted with a different token input name instead of just name="token".&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 13:48:22 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/How-to-redirect-to-Hosted-Payment-Page/m-p/66752#M40259</guid>
      <dc:creator>toirovd</dc:creator>
      <dc:date>2019-03-05T13:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to redirect to Hosted Payment Page?</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/How-to-redirect-to-Hosted-Payment-Page/m-p/67255#M40695</link>
      <description>&lt;P&gt;How did you fix that exactly?&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2019 18:40:06 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/How-to-redirect-to-Hosted-Payment-Page/m-p/67255#M40695</guid>
      <dc:creator>Taso</dc:creator>
      <dc:date>2019-04-03T18:40:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to redirect to Hosted Payment Page?</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/How-to-redirect-to-Hosted-Payment-Page/m-p/67257#M40697</link>
      <description>&lt;P&gt;How did you fix that exactly?&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2019 20:39:03 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/How-to-redirect-to-Hosted-Payment-Page/m-p/67257#M40697</guid>
      <dc:creator>Taso</dc:creator>
      <dc:date>2019-04-03T20:39:03Z</dc:date>
    </item>
  </channel>
</rss>

