<?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: Error calling CreateCustomerCard in Archived Discussions (Read Only)</title>
    <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Error-calling-CreateCustomerCard/m-p/29225#M94754</link>
    <description>&lt;P&gt;I solved it – apparently the variable I used for customerid was not initialized.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 24 Jan 2017 14:34:17 GMT</pubDate>
    <dc:creator>ResultsNation</dc:creator>
    <dc:date>2017-01-24T14:34:17Z</dc:date>
    <item>
      <title>Error calling CreateCustomerCard</title>
      <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Error-calling-CreateCustomerCard/m-p/29224#M94753</link>
      <description>&lt;P&gt;So I can add a customer to square using the API and C#. &amp;nbsp;When I add a card to the customer I get this error:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Error calling CreateCustomerCard: {"errors":[{"category":"AUTHENTICATION_ERROR","code":"UNAUTHORIZED","detail":"Your request did not include an `Authorization` http header with an access token. The header value is expected to be of the format \"Bearer TOKEN\" (without quotation marks), where TOKEN is to be replaced with your access token (e.g. \"Bearer ABC123def456GHI789jkl0\"). For more information, see &lt;A href="https://docs.connect.squareup.com/api/connect/v2/#requestandresponseheaders" target="_blank"&gt;https://docs.connect.squareup.com/api/connect/v2/#requestandresponseheaders&lt;/A&gt;. If you are seeing this error message while using one of our officially supported client libraries, please report this to &lt;A href="mailto:developers@squareup.com" target="_blank"&gt;developers@squareup.com&lt;/A&gt;. "}]}&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Code below (try-catch removed for readability):&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CustomerCardApi ca = new CustomerCardApi();&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Customer cst = new Customer(txtsquarecustid.Value);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string n = cardNonce.Value;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Address address = new Address(AddressLine1: txtshipaddress1.Value, PostalCode: txtshipzip.Value);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CreateCustomerCardRequest b = new CreateCustomerCardRequest(n, address, txtclientname.Value);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CreateCustomerCardResponse resp = ca.CreateCustomerCard(_accessToken, squarecustid, b);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; JObject jObject = Newtonsoft.Json.Linq.JObject.Parse(resp.ToJson().ToString());&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cardid = (string)jObject["card"]["id"];&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2017 17:14:08 GMT</pubDate>
      <guid>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Error-calling-CreateCustomerCard/m-p/29224#M94753</guid>
      <dc:creator>ResultsNation</dc:creator>
      <dc:date>2017-01-24T17:14:08Z</dc:date>
    </item>
    <item>
      <title>Re: Error calling CreateCustomerCard</title>
      <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Error-calling-CreateCustomerCard/m-p/29225#M94754</link>
      <description>&lt;P&gt;I solved it – apparently the variable I used for customerid was not initialized.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2017 14:34:17 GMT</pubDate>
      <guid>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Error-calling-CreateCustomerCard/m-p/29225#M94754</guid>
      <dc:creator>ResultsNation</dc:creator>
      <dc:date>2017-01-24T14:34:17Z</dc:date>
    </item>
    <item>
      <title>Re: Error calling CreateCustomerCard</title>
      <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Error-calling-CreateCustomerCard/m-p/29240#M94755</link>
      <description>&lt;P&gt;&lt;a href="https://community.squareup.com/t5/user/viewprofilepage/user-id/41926"&gt;@ResultsNation&lt;/a&gt; - Glad to hear, and thanks for reporting back!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2017 17:13:43 GMT</pubDate>
      <guid>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Error-calling-CreateCustomerCard/m-p/29240#M94755</guid>
      <dc:creator>Sean</dc:creator>
      <dc:date>2017-01-24T17:13:43Z</dc:date>
    </item>
  </channel>
</rss>

