<?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: Creating Customer Card in Archived Discussions (Read Only)</title>
    <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Creating-Customer-Card/m-p/30333#M94830</link>
    <description>&lt;P&gt;Hi&amp;nbsp;tristansokol,&lt;/P&gt;
&lt;P&gt;I am using this same flow but still getting the&amp;nbsp;"Card nonce already used; please request new nonce." error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm requesting and receiving a nonce, creating a customer, saving the card, then attempting an authorization but it fails. If I do NOT save the customer card, it works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can see the response of saving the card returns an id. Do I need to use that id as the &lt;SPAN&gt;&lt;STRONG&gt;customer_card_id&lt;/STRONG&gt; and &lt;STRONG&gt;customer_id&lt;/STRONG&gt; to create the transaction instead?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Is it saying the nonce has already been used to save the card therefor it cannot be used to charge as well?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 06 Feb 2017 23:06:44 GMT</pubDate>
    <dc:creator>iamface</dc:creator>
    <dc:date>2017-02-06T23:06:44Z</dc:date>
    <item>
      <title>Creating Customer Card</title>
      <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Creating-Customer-Card/m-p/27378#M94827</link>
      <description>&lt;P&gt;&lt;STRONG&gt;This is my code:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;$nonce = $_POST['nonce']; &amp;nbsp;// from square form on prev. page&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;$request_body = array( &lt;BR /&gt; 'card_nonce' =&amp;gt; $nonce, &lt;BR /&gt; 'amount_money' =&amp;gt; array( &lt;BR /&gt; 'amount' =&amp;gt; (int)$_POST['amount'], &lt;BR /&gt; 'currency' =&amp;gt; 'USD' &lt;BR /&gt; ), &lt;BR /&gt; 'idempotency_key' =&amp;gt; uniqid() &lt;BR /&gt;);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;$cust_obj&amp;nbsp;= array( &lt;BR /&gt; 'given_name' =&amp;gt; $_SESSION['firstname'], &lt;BR /&gt; 'family_name' =&amp;gt; $_SESSION['lastname'], &lt;BR /&gt; 'email_address' =&amp;gt; $_SESSION['email'], &lt;BR /&gt; 'phone_number' =&amp;gt; $_SESSION['cellPhone'] &lt;BR /&gt;);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;$result = $transaction_api-&amp;gt;charge($access_token, $location_id, $request_body); &lt;BR /&gt; $newCustomer = $customer_api-&amp;gt;createCustomer($access_token, $cust_obj)-&amp;gt;getCustomer(); &lt;BR /&gt; &lt;BR /&gt; $body = array( &lt;BR /&gt; 'card_nonce' =&amp;gt; $nonce, &lt;BR /&gt; 'cardholder_name' =&amp;gt; $customer['given_name'].' '.$customer['family_name'] &lt;BR /&gt; ); &lt;BR /&gt; $customerCard = $customerCard_api-&amp;gt;createCustomerCard($access_token, $newCustomer-&amp;gt;getId(), $body);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;This is my error:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;object(stdClass)#43 (3) {
      ["category"]=&amp;gt;
      string(21) "INVALID_REQUEST_ERROR"
      ["code"]=&amp;gt;
      string(15) "CARD_TOKEN_USED"
      ["detail"]=&amp;gt;
      string(50) "Card nonce already used; please request new nonce."&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I use the same nonce that was generated from the SquareForm on prev. page to create the the transaction, then the customer and then the customerCard.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The transaction and customer get recorded fine, but creating the customerCard fails with that error. What am I missing here? Shouldn't/couldn't the same nonce be used to create the customerCard as well?&lt;/P&gt;</description>
      <pubDate>Sun, 01 Jan 2017 18:04:58 GMT</pubDate>
      <guid>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Creating-Customer-Card/m-p/27378#M94827</guid>
      <dc:creator>funk101</dc:creator>
      <dc:date>2017-01-01T18:04:58Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Customer Card</title>
      <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Creating-Customer-Card/m-p/27397#M94828</link>
      <description>&lt;P&gt;This Error means that you are trying to use the card nonce more than once.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should create the customer first, create the customer card, and then charge that card on file. Does that make sense?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead of charging, creating customer and adding the card on file. If you wan't to charge first, you'll have to request a new nonce.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Dec 2016 20:39:09 GMT</pubDate>
      <guid>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Creating-Customer-Card/m-p/27397#M94828</guid>
      <dc:creator>tristansokol</dc:creator>
      <dc:date>2016-12-30T20:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Customer Card</title>
      <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Creating-Customer-Card/m-p/27441#M94829</link>
      <description>&lt;P&gt;Ok, cool, thank you.&lt;/P&gt;</description>
      <pubDate>Sat, 31 Dec 2016 19:04:33 GMT</pubDate>
      <guid>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Creating-Customer-Card/m-p/27441#M94829</guid>
      <dc:creator>funk101</dc:creator>
      <dc:date>2016-12-31T19:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Customer Card</title>
      <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Creating-Customer-Card/m-p/30333#M94830</link>
      <description>&lt;P&gt;Hi&amp;nbsp;tristansokol,&lt;/P&gt;
&lt;P&gt;I am using this same flow but still getting the&amp;nbsp;"Card nonce already used; please request new nonce." error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm requesting and receiving a nonce, creating a customer, saving the card, then attempting an authorization but it fails. If I do NOT save the customer card, it works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can see the response of saving the card returns an id. Do I need to use that id as the &lt;SPAN&gt;&lt;STRONG&gt;customer_card_id&lt;/STRONG&gt; and &lt;STRONG&gt;customer_id&lt;/STRONG&gt; to create the transaction instead?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Is it saying the nonce has already been used to save the card therefor it cannot be used to charge as well?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2017 23:06:44 GMT</pubDate>
      <guid>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Creating-Customer-Card/m-p/30333#M94830</guid>
      <dc:creator>iamface</dc:creator>
      <dc:date>2017-02-06T23:06:44Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Customer Card</title>
      <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Creating-Customer-Card/m-p/30335#M94831</link>
      <description>&lt;P&gt;Correct, you can either charge a chard or create a card on file with a card nonce.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After you save the card on file you should create a charge request with the customer card id. You can see an example in Ruby here:&amp;nbsp;&lt;A href="https://docs.connect.squareup.com/articles/processing-recurring-payments-ruby/" target="_self"&gt;Recurring payments&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2017 23:55:50 GMT</pubDate>
      <guid>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Creating-Customer-Card/m-p/30335#M94831</guid>
      <dc:creator>tristansokol</dc:creator>
      <dc:date>2017-02-06T23:55:50Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Customer Card</title>
      <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Creating-Customer-Card/m-p/30336#M94832</link>
      <description>&lt;P&gt;Great, thank you for confirming this!&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2017 23:59:00 GMT</pubDate>
      <guid>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Creating-Customer-Card/m-p/30336#M94832</guid>
      <dc:creator>iamface</dc:creator>
      <dc:date>2017-02-06T23:59:00Z</dc:date>
    </item>
  </channel>
</rss>

