<?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 implement getHostedpaymentPageRequest in Javascript in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/implement-getHostedpaymentPageRequest-in-Javascript/m-p/83078#M52372</link>
    <description>&lt;P&gt;I need to call&amp;nbsp; getHostedpaymentPageRequest and generate a token using javascript with in HTML. I am using authorize.net provided code to display the form. But i need to generate token and pass the token information to my payment page. there is no example of javascript code on their webiste to generate the token.&amp;nbsp;&lt;A href="https://developer.authorize.net/api/reference/index.html#accept-suite-get-an-accept-payment-page" target="_blank"&gt;https://developer.authorize.net/api/reference/index.html#accept-suite-get-an-accept-payment-page&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Here is my code:&lt;/P&gt;&lt;P&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;BR /&gt;&amp;lt;html&amp;gt;&lt;BR /&gt;&amp;lt;meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"&amp;gt;&lt;BR /&gt;&amp;lt;head&amp;gt;&lt;BR /&gt;&amp;lt;title&amp;gt;HostedPayment Test Page&amp;lt;/title&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;lt;script src="scripts/lib/jquery.min.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;/P&gt;&lt;P&gt;$(function () {&lt;/P&gt;&lt;P&gt;$("#btnOpenAuthorizeNetIFrame").click(function () {&lt;BR /&gt;$("#add_payment").show();&lt;BR /&gt;$("#send_token").attr({ "action": "&lt;A href="https://test.authorize.net/payment/payment" target="_blank"&gt;https://test.authorize.net/payment/payment&lt;/A&gt;", "target": "add_payment" }).submit();&lt;BR /&gt;&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;/head&amp;gt;&lt;BR /&gt;&amp;lt;body&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;lt;div&amp;gt;&lt;BR /&gt;Open Authorize.net in an iframe to complete transaction&lt;BR /&gt;&amp;lt;button id="btnOpenAuthorizeNetIFrame" onclick=""&amp;gt;Show Payment Form&amp;lt;/button&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;div id="iframe_holder" class="center-block" style="width:90%;max-width: 1000px;height:90%max-height: 1000px"&amp;gt;&lt;BR /&gt;&amp;lt;iframe id="add_payment" class="embed-responsive-item panel" name="add_payment" width="100%" height="1000" frameborder="0" scrolling="yes" hidden="false"&amp;gt;&lt;BR /&gt;&amp;lt;/iframe&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;form id="send_token" action="" method="post" target="add_payment" &amp;gt;&lt;BR /&gt;&amp;lt;input type="hidden" name="token" value="TOKEN VALUE" /&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;lt;/form&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;/P&gt;&lt;P&gt;(function () {&lt;BR /&gt;if (!window.AuthorizeNetIFrame) window.AuthorizeNetIFrame = {};&lt;BR /&gt;AuthorizeNetIFrame.onReceiveCommunication = function (querystr) {&lt;BR /&gt;var params = parseQueryString(querystr);&lt;BR /&gt;switch (params["action"]) {&lt;BR /&gt;case "successfulSave":&lt;BR /&gt;break;&lt;BR /&gt;case "cancel":&lt;BR /&gt;break;&lt;BR /&gt;case "resizeWindow":&lt;BR /&gt;var w = parseInt(params["100%"]);&lt;BR /&gt;var h = parseInt(params["100%"]);&lt;BR /&gt;var ifrm = document.getElementById("add_payment");&lt;BR /&gt;ifrm.style.width = w.toString() + "px";&lt;BR /&gt;ifrm.style.height = h.toString() + "px";&lt;BR /&gt;break;&lt;BR /&gt;case "transactResponse":&lt;BR /&gt;var ifrm = document.getElementById("add_payment");&lt;BR /&gt;ifrm.style.display = 'none';&lt;BR /&gt;}&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;function parseQueryString(str) {&lt;BR /&gt;var vars = [];&lt;BR /&gt;var arr = str.split('&amp;amp;');&lt;BR /&gt;var pair;&lt;BR /&gt;for (var i = 0; i &amp;lt; arr.length; i++) {&lt;BR /&gt;pair = arr[i].split('=');&lt;BR /&gt;vars.push(pair[0]);&lt;BR /&gt;vars[pair[0]] = unescape(pair[1]);&lt;BR /&gt;}&lt;BR /&gt;return vars;&lt;BR /&gt;}&lt;BR /&gt;}());&lt;BR /&gt;&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;/body&amp;gt;&lt;BR /&gt;&amp;lt;/html&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help I need to generate token using javascript.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 10 Jun 2022 15:44:09 GMT</pubDate>
    <dc:creator>furqanmajeed007</dc:creator>
    <dc:date>2022-06-10T15:44:09Z</dc:date>
    <item>
      <title>implement getHostedpaymentPageRequest in Javascript</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/implement-getHostedpaymentPageRequest-in-Javascript/m-p/83078#M52372</link>
      <description>&lt;P&gt;I need to call&amp;nbsp; getHostedpaymentPageRequest and generate a token using javascript with in HTML. I am using authorize.net provided code to display the form. But i need to generate token and pass the token information to my payment page. there is no example of javascript code on their webiste to generate the token.&amp;nbsp;&lt;A href="https://developer.authorize.net/api/reference/index.html#accept-suite-get-an-accept-payment-page" target="_blank"&gt;https://developer.authorize.net/api/reference/index.html#accept-suite-get-an-accept-payment-page&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Here is my code:&lt;/P&gt;&lt;P&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;BR /&gt;&amp;lt;html&amp;gt;&lt;BR /&gt;&amp;lt;meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"&amp;gt;&lt;BR /&gt;&amp;lt;head&amp;gt;&lt;BR /&gt;&amp;lt;title&amp;gt;HostedPayment Test Page&amp;lt;/title&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;lt;script src="scripts/lib/jquery.min.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;/P&gt;&lt;P&gt;$(function () {&lt;/P&gt;&lt;P&gt;$("#btnOpenAuthorizeNetIFrame").click(function () {&lt;BR /&gt;$("#add_payment").show();&lt;BR /&gt;$("#send_token").attr({ "action": "&lt;A href="https://test.authorize.net/payment/payment" target="_blank"&gt;https://test.authorize.net/payment/payment&lt;/A&gt;", "target": "add_payment" }).submit();&lt;BR /&gt;&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;/head&amp;gt;&lt;BR /&gt;&amp;lt;body&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;lt;div&amp;gt;&lt;BR /&gt;Open Authorize.net in an iframe to complete transaction&lt;BR /&gt;&amp;lt;button id="btnOpenAuthorizeNetIFrame" onclick=""&amp;gt;Show Payment Form&amp;lt;/button&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;div id="iframe_holder" class="center-block" style="width:90%;max-width: 1000px;height:90%max-height: 1000px"&amp;gt;&lt;BR /&gt;&amp;lt;iframe id="add_payment" class="embed-responsive-item panel" name="add_payment" width="100%" height="1000" frameborder="0" scrolling="yes" hidden="false"&amp;gt;&lt;BR /&gt;&amp;lt;/iframe&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;form id="send_token" action="" method="post" target="add_payment" &amp;gt;&lt;BR /&gt;&amp;lt;input type="hidden" name="token" value="TOKEN VALUE" /&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;lt;/form&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;/P&gt;&lt;P&gt;(function () {&lt;BR /&gt;if (!window.AuthorizeNetIFrame) window.AuthorizeNetIFrame = {};&lt;BR /&gt;AuthorizeNetIFrame.onReceiveCommunication = function (querystr) {&lt;BR /&gt;var params = parseQueryString(querystr);&lt;BR /&gt;switch (params["action"]) {&lt;BR /&gt;case "successfulSave":&lt;BR /&gt;break;&lt;BR /&gt;case "cancel":&lt;BR /&gt;break;&lt;BR /&gt;case "resizeWindow":&lt;BR /&gt;var w = parseInt(params["100%"]);&lt;BR /&gt;var h = parseInt(params["100%"]);&lt;BR /&gt;var ifrm = document.getElementById("add_payment");&lt;BR /&gt;ifrm.style.width = w.toString() + "px";&lt;BR /&gt;ifrm.style.height = h.toString() + "px";&lt;BR /&gt;break;&lt;BR /&gt;case "transactResponse":&lt;BR /&gt;var ifrm = document.getElementById("add_payment");&lt;BR /&gt;ifrm.style.display = 'none';&lt;BR /&gt;}&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;function parseQueryString(str) {&lt;BR /&gt;var vars = [];&lt;BR /&gt;var arr = str.split('&amp;amp;');&lt;BR /&gt;var pair;&lt;BR /&gt;for (var i = 0; i &amp;lt; arr.length; i++) {&lt;BR /&gt;pair = arr[i].split('=');&lt;BR /&gt;vars.push(pair[0]);&lt;BR /&gt;vars[pair[0]] = unescape(pair[1]);&lt;BR /&gt;}&lt;BR /&gt;return vars;&lt;BR /&gt;}&lt;BR /&gt;}());&lt;BR /&gt;&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;/body&amp;gt;&lt;BR /&gt;&amp;lt;/html&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help I need to generate token using javascript.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2022 15:44:09 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/implement-getHostedpaymentPageRequest-in-Javascript/m-p/83078#M52372</guid>
      <dc:creator>furqanmajeed007</dc:creator>
      <dc:date>2022-06-10T15:44:09Z</dc:date>
    </item>
    <item>
      <title>Re: implement getHostedpaymentPageRequest in Javascript</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/implement-getHostedpaymentPageRequest-in-Javascript/m-p/83124#M52408</link>
      <description>&lt;P&gt;&lt;a href="https://community.developer.cybersource.com/t5/user/viewprofilepage/user-id/61113"&gt;@furqanmajeed007&lt;/a&gt;&amp;nbsp;to get the token you don't use client side JS. You use node.js.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2022 21:48:54 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/implement-getHostedpaymentPageRequest-in-Javascript/m-p/83124#M52408</guid>
      <dc:creator>Renaissance</dc:creator>
      <dc:date>2022-06-14T21:48:54Z</dc:date>
    </item>
    <item>
      <title>Re: implement getHostedpaymentPageRequest in Javascript</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/implement-getHostedpaymentPageRequest-in-Javascript/m-p/83217#M52473</link>
      <description>&lt;P&gt;The problem with doing this client-side isn't a technical issue but a security issue. &amp;nbsp; You'd be initiating requests from the client's ip address and running it on the client's browser and having to expose your credentials to do so.&amp;nbsp; So it seems like a bad idea.&lt;/P&gt;&lt;P&gt;But there's probably nothing stopping you from doing this client-side.&lt;/P&gt;&lt;P&gt;You can find code examples here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/orgs/AuthorizeNet/repositories?type=all" target="_blank"&gt;https://github.com/orgs/AuthorizeNet/repositories?type=all&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2022 11:44:14 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/implement-getHostedpaymentPageRequest-in-Javascript/m-p/83217#M52473</guid>
      <dc:creator>mkienenb</dc:creator>
      <dc:date>2022-06-23T11:44:14Z</dc:date>
    </item>
  </channel>
</rss>

