<?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>thread Re: Have SqPaymentForm report errors back to server? in Archived Discussions (Read Only)</title>
    <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Have-SqPaymentForm-report-errors-back-to-server/m-p/90495#M94302</link>
    <description>&lt;P&gt;&lt;a href="https://community.squareup.com/t5/user/viewprofilepage/user-id/81248"&gt;@dougvan&lt;/a&gt; I checked in with our API Specialists and we don't have any examples showing for this I'm afraid!&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;In the meantime,&amp;nbsp;&lt;A href=" https://stackoverflow.com/questions/8412505/send-data-from-javascript-to-a-mysql-database" target="_blank"&gt;this Stack Overflow question&lt;/A&gt; might help or you can post a new question in our &lt;A href="https://stackoverflow.com/questions/tagged/square-connect" target="_blank"&gt;Developer Community on Stack Overflow&lt;/A&gt;.&lt;/P&gt;</description>
    <pubDate>Thu, 16 Aug 2018 23:33:12 GMT</pubDate>
    <dc:creator>Helen</dc:creator>
    <dc:date>2018-08-16T23:33:12Z</dc:date>
    <item>
      <title>Have SqPaymentForm report errors back to server?</title>
      <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Have-SqPaymentForm-report-errors-back-to-server/m-p/90219#M94301</link>
      <description>&lt;P&gt;I want to monitor the type of errors our customer experience when checking out using the SqPaymentForm.&amp;nbsp; The .js code uses the "console.log" statement for development purposes, which is commented out in the production version, because those messages are only sent to the browser's console window.&amp;nbsp; What I really want is for those errors to be sent back to the server and appended to a "nonce_error.log" so I can get see the kind and frequency of problems our customers are having.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any suggestions?&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2018 05:52:32 GMT</pubDate>
      <guid>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Have-SqPaymentForm-report-errors-back-to-server/m-p/90219#M94301</guid>
      <dc:creator>dougvan</dc:creator>
      <dc:date>2018-08-15T05:52:32Z</dc:date>
    </item>
    <item>
      <title>Re: Have SqPaymentForm report errors back to server?</title>
      <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Have-SqPaymentForm-report-errors-back-to-server/m-p/90495#M94302</link>
      <description>&lt;P&gt;&lt;a href="https://community.squareup.com/t5/user/viewprofilepage/user-id/81248"&gt;@dougvan&lt;/a&gt; I checked in with our API Specialists and we don't have any examples showing for this I'm afraid!&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;In the meantime,&amp;nbsp;&lt;A href=" https://stackoverflow.com/questions/8412505/send-data-from-javascript-to-a-mysql-database" target="_blank"&gt;this Stack Overflow question&lt;/A&gt; might help or you can post a new question in our &lt;A href="https://stackoverflow.com/questions/tagged/square-connect" target="_blank"&gt;Developer Community on Stack Overflow&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Aug 2018 23:33:12 GMT</pubDate>
      <guid>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Have-SqPaymentForm-report-errors-back-to-server/m-p/90495#M94302</guid>
      <dc:creator>Helen</dc:creator>
      <dc:date>2018-08-16T23:33:12Z</dc:date>
    </item>
    <item>
      <title>Re: Have SqPaymentForm report errors back to server?</title>
      <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Have-SqPaymentForm-report-errors-back-to-server/m-p/105087#M94303</link>
      <description>&lt;P&gt;I finally got around to implementing this feature in our code.&amp;nbsp; Someone found a super slick method when all you want to do is send some info from javascript back to the website -- just create an "Image" object and set the ".src" property to a URL you have on your website!&amp;nbsp;&amp;nbsp;(he called it a "beacon")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Following is the code added to the .js file in the "if (errors)" section of the cardNonceResponseReceived function.&amp;nbsp; I just send the same error message the user was shown:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;var beacon = new Image();
beacon.src="http://example.com/nonce_err.php?error=" + encodeURIComponent(errid.innerHTML);
&lt;/PRE&gt;
&lt;P&gt;My "nonce_err.php" program is very simple.&amp;nbsp; I chose to add a date/time stamp in front of each error message.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;$str = $_REQUEST['error'];
$log = date("F j, Y, g:i a") . ": $str\n";
file_put_contents(nonce_err.log', $log, FILE_APPEND);
&lt;/PRE&gt;
&lt;P&gt;I can now see the various errors my customers see when they have trouble entering their credit card info in the "nonce_err.log" file.&amp;nbsp; Hope this helps someone else!&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jan 2019 21:15:27 GMT</pubDate>
      <guid>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Have-SqPaymentForm-report-errors-back-to-server/m-p/105087#M94303</guid>
      <dc:creator>dougvan</dc:creator>
      <dc:date>2019-01-02T21:15:27Z</dc:date>
    </item>
  </channel>
</rss>

