<?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: Double-click in SqPaymentForm created a duplicate charge in Archived Discussions (Read Only)</title>
    <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Double-click-in-SqPaymentForm-created-a-duplicate-charge/m-p/72810#M98093</link>
    <description>&lt;P&gt;&lt;SPAN&gt;You'll get an error about submitting a request that is different with the same idempotency key.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 28 Feb 2018 20:57:15 GMT</pubDate>
    <dc:creator>tristansokol</dc:creator>
    <dc:date>2018-02-28T20:57:15Z</dc:date>
    <item>
      <title>Double-click in SqPaymentForm created a duplicate charge</title>
      <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Double-click-in-SqPaymentForm-created-a-duplicate-charge/m-p/72741#M98090</link>
      <description>&lt;P&gt;We have experienced some duplicate charges being processed through the Square API.&amp;nbsp; I discovered the two charges were recorded at virtually the same time.&amp;nbsp; I narrowed it down to a glitchy mouse on one of our work computers that sometimes sends a double-click even though the button was only hit once.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The "Pay with card" button in SqPaymentForm is handling a double-click as two seperate single clicks.&amp;nbsp; And it initiated two seperate events to retrieve a nonce which made two submissions to my target webpage that actually invokes the Transaction/Charge Endpoint.&amp;nbsp; Thus two charges were made from the single SqPaymentForm.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My first fix was replacing the dang mouse.&amp;nbsp; My second "hack" was to disable the "Pay with card" button after the first click.&amp;nbsp; Although I needed to re-enable the button if the RetrieveNonce routine returned an error.&amp;nbsp; Not the prettiest patch, but it does prevent a duplicate charge on a double-click!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is something the clever Square API guys ought to address...&amp;nbsp; (I mean that in a good way!)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2018 04:50:45 GMT</pubDate>
      <guid>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Double-click-in-SqPaymentForm-created-a-duplicate-charge/m-p/72741#M98090</guid>
      <dc:creator>dougvan</dc:creator>
      <dc:date>2018-02-28T04:50:45Z</dc:date>
    </item>
    <item>
      <title>Re: Double-click in SqPaymentForm created a duplicate charge</title>
      <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Double-click-in-SqPaymentForm-created-a-duplicate-charge/m-p/72799#M98091</link>
      <description>&lt;P&gt;There actually is functionality to address this, the idempotency key.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How are you creating your&amp;nbsp;&lt;SPAN&gt;idempotency key?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2018 19:40:06 GMT</pubDate>
      <guid>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Double-click-in-SqPaymentForm-created-a-duplicate-charge/m-p/72799#M98091</guid>
      <dc:creator>tristansokol</dc:creator>
      <dc:date>2018-02-28T19:40:06Z</dc:date>
    </item>
    <item>
      <title>Re: Double-click in SqPaymentForm created a duplicate charge</title>
      <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Double-click-in-SqPaymentForm-created-a-duplicate-charge/m-p/72803#M98092</link>
      <description>&lt;P&gt;That's an even better solution!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I currently create the idempotency key in my target webpage that calls the Transaction/Charge Endpoint.&amp;nbsp; But if I create the idempotency key in the page where I embed SqPaymentForm and pass it as a POST parameter, then the possible duplicate charge should not take place since they both will have the same idempotency key.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now, what happens when two charges are submitted with the same idempotency key, but a different nonce?&amp;nbsp; Is one of them (I assume the latter) discarded?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is a good solution, and probably worthy of being mentioned in the documentation for SqPaymentForm.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2018 19:59:00 GMT</pubDate>
      <guid>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Double-click-in-SqPaymentForm-created-a-duplicate-charge/m-p/72803#M98092</guid>
      <dc:creator>dougvan</dc:creator>
      <dc:date>2018-02-28T19:59:00Z</dc:date>
    </item>
    <item>
      <title>Re: Double-click in SqPaymentForm created a duplicate charge</title>
      <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Double-click-in-SqPaymentForm-created-a-duplicate-charge/m-p/72810#M98093</link>
      <description>&lt;P&gt;&lt;SPAN&gt;You'll get an error about submitting a request that is different with the same idempotency key.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2018 20:57:15 GMT</pubDate>
      <guid>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Double-click-in-SqPaymentForm-created-a-duplicate-charge/m-p/72810#M98093</guid>
      <dc:creator>tristansokol</dc:creator>
      <dc:date>2018-02-28T20:57:15Z</dc:date>
    </item>
  </channel>
</rss>

