<?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: how to Link checkout to customer id ? in Archived Discussions (Read Only)</title>
    <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Checkout-API-How-to-link-checkout-to-customer-id/m-p/208547#M94186</link>
    <description>&lt;P&gt;I see the new customer being created afterwards when searching via the square dashboard, but when the customer is redirected back to my site (redirect_url) after completing the checkout, I use the transactions API to get the transaction (I don't get an orderId as a query parameter), and from there I get the orderId, but after batch searching for the order, there's no customerId in it.&amp;nbsp; why is that?&lt;/P&gt;</description>
    <pubDate>Wed, 07 Oct 2020 02:15:50 GMT</pubDate>
    <dc:creator>rrrecords</dc:creator>
    <dc:date>2020-10-07T02:15:50Z</dc:date>
    <item>
      <title>Checkout API: How to link checkout to customer id?</title>
      <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Checkout-API-How-to-link-checkout-to-customer-id/m-p/111706#M94182</link>
      <description>&lt;P&gt;how can i link an existing customer to a new checkout before submiting a transaction ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;    //Replace your access token and location ID
    $accessToken = 'xxxxxxxxxxxx';
    $locationId = 'yyyyyyyyyyyyy';

    // Create and configure a new API client object
    $defaultApiConfig = new \SquareConnect\Configuration();
    $defaultApiConfig-&amp;gt;setAccessToken($accessToken);
    $defaultApiClient = new \SquareConnect\ApiClient($defaultApiConfig);
    $checkoutClient = new SquareConnect\Api\CheckoutApi($defaultApiClient);

    //Create a Money object to represent the price of the line item.
    $price = new \SquareConnect\Model\Money;
    $price-&amp;gt;setAmount(20);
    $price-&amp;gt;setCurrency('CAD');

    //Create the line item and set details
    $book = new \SquareConnect\Model\CreateOrderRequestLineItem;
    $book-&amp;gt;setName('The Shining');
    $book-&amp;gt;setQuantity('1');
    $book-&amp;gt;setBasePriceMoney($price);
    //Puts our line item object in an array called lineItems.
    $lineItems = array();
    array_push($lineItems, $book);

    // Create an Order object using line items from above
    $order = new \SquareConnect\Model\CreateOrderRequest();

    $order-&amp;gt;setIdempotencyKey(uniqid()); //uniqid() generates a random string.

    //sets the lineItems array in the order object
    $order-&amp;gt;setLineItems($lineItems);

    $checkout = new \SquareConnect\Model\CreateCheckoutRequest();
    $checkout-&amp;gt;setIdempotencyKey(uniqid()); //uniqid() generates a random string.
    $checkout-&amp;gt;setRedirectUrl('http://expertshipping.ca/login'); //uniqid() generates a random string.
    $checkout-&amp;gt;setOrder($order); //this is the order we created in the previous step
    try {
        $result = $checkoutClient-&amp;gt;createCheckout(
            $locationId,
            $checkout
        );
        //Save the checkout ID for verifying transactions
        $checkoutId = $result-&amp;gt;getCheckout()-&amp;gt;getId();
        //Get the checkout URL that opens the checkout page.
        $checkoutUrl = $result-&amp;gt;getCheckout()-&amp;gt;getCheckoutPageUrl();
        print_r( $checkoutUrl );
    } catch (Exception $e) {
        echo 'Exception when calling CheckoutApi-&amp;gt;createCheckout: ', $e-&amp;gt;getMessage(), PHP_EOL;
    }&lt;/PRE&gt;</description>
      <pubDate>Fri, 29 May 2020 16:45:10 GMT</pubDate>
      <guid>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Checkout-API-How-to-link-checkout-to-customer-id/m-p/111706#M94182</guid>
      <dc:creator>elouadifi</dc:creator>
      <dc:date>2020-05-29T16:45:10Z</dc:date>
    </item>
    <item>
      <title>Re: how to Link checkout to customer id ?</title>
      <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Checkout-API-How-to-link-checkout-to-customer-id/m-p/111942#M94183</link>
      <description>&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":waving_hand:"&gt;👋&lt;/span&gt; &lt;a href="https://community.squareup.com/t5/user/viewprofilepage/user-id/158030"&gt;@elouadifi&lt;/a&gt;. Unfortunately, at this time, there isn't a way to add an existing customer with a payment processed through the Checkout API. It’ll always create a new customer after each successful payment. But you can &lt;A href="https://squareup.com/help/us/en/article/5498#duplicatehttps://squareup.com/help/us/en/article/5498#duplicates" target="_blank"&gt;merge&amp;nbsp;duplicate&amp;nbsp;customers&lt;/A&gt; from your online&amp;nbsp;Square Dashboard when this happens.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2019 18:13:34 GMT</pubDate>
      <guid>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Checkout-API-How-to-link-checkout-to-customer-id/m-p/111942#M94183</guid>
      <dc:creator>Helen</dc:creator>
      <dc:date>2019-03-04T18:13:34Z</dc:date>
    </item>
    <item>
      <title>Re: how to Link checkout to customer id ?</title>
      <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Checkout-API-How-to-link-checkout-to-customer-id/m-p/119688#M94184</link>
      <description>&lt;P&gt;You can assign a customer to a an order through a transaction. But you have to do it at the time you process the order. Join the slack community it’s much more useful for API help. Tons of great developers over there too&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;heres an example&amp;nbsp;&lt;A href="https://github.com/square/connect-php-sdk/blob/master/docs/Model/ChargeRequest.md" target="_blank"&gt;https://github.com/square/connect-php-sdk/blob/master/docs/Model/ChargeRequest.md&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2019 23:11:47 GMT</pubDate>
      <guid>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Checkout-API-How-to-link-checkout-to-customer-id/m-p/119688#M94184</guid>
      <dc:creator>Dugasmike</dc:creator>
      <dc:date>2019-05-01T23:11:47Z</dc:date>
    </item>
    <item>
      <title>Re: how to Link checkout to customer id ?</title>
      <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Checkout-API-How-to-link-checkout-to-customer-id/m-p/208546#M94185</link>
      <description>&lt;P&gt;are there recommended secure ways of authenticating a customer so that I can link them to the checkout order?&lt;/P&gt;</description>
      <pubDate>Wed, 07 Oct 2020 02:12:16 GMT</pubDate>
      <guid>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Checkout-API-How-to-link-checkout-to-customer-id/m-p/208546#M94185</guid>
      <dc:creator>rrrecords</dc:creator>
      <dc:date>2020-10-07T02:12:16Z</dc:date>
    </item>
    <item>
      <title>Re: how to Link checkout to customer id ?</title>
      <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Checkout-API-How-to-link-checkout-to-customer-id/m-p/208547#M94186</link>
      <description>&lt;P&gt;I see the new customer being created afterwards when searching via the square dashboard, but when the customer is redirected back to my site (redirect_url) after completing the checkout, I use the transactions API to get the transaction (I don't get an orderId as a query parameter), and from there I get the orderId, but after batch searching for the order, there's no customerId in it.&amp;nbsp; why is that?&lt;/P&gt;</description>
      <pubDate>Wed, 07 Oct 2020 02:15:50 GMT</pubDate>
      <guid>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Checkout-API-How-to-link-checkout-to-customer-id/m-p/208547#M94186</guid>
      <dc:creator>rrrecords</dc:creator>
      <dc:date>2020-10-07T02:15:50Z</dc:date>
    </item>
    <item>
      <title>Re: how to Link checkout to customer id ?</title>
      <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Checkout-API-How-to-link-checkout-to-customer-id/m-p/208673#M94187</link>
      <description>&lt;P&gt;&lt;a href="https://community.squareup.com/t5/user/viewprofilepage/user-id/321463"&gt;@rrrecords&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Talked with an API specialist. Here's a word from them:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;The&lt;STRONG&gt; customer_id&amp;nbsp;&lt;/STRONG&gt;might appear on the Payment object, the Transaction object, or the Order object (or a combination of any) depending on how it was created. If the customer is not on the Order object, chances are it’s on the Transaction or Payment object.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you can’t find it anywhere, provide the&amp;nbsp;&lt;STRONG&gt;order_id&lt;/STRONG&gt;&amp;nbsp;and our API Team can dig&amp;nbsp;to find out what it’s attached to.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 19:56:49 GMT</pubDate>
      <guid>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Checkout-API-How-to-link-checkout-to-customer-id/m-p/208673#M94187</guid>
      <dc:creator>JustinC</dc:creator>
      <dc:date>2020-10-08T19:56:49Z</dc:date>
    </item>
    <item>
      <title>Re: how to Link checkout to customer id ?</title>
      <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Checkout-API-How-to-link-checkout-to-customer-id/m-p/208825#M94188</link>
      <description>&lt;P&gt;&lt;a href="https://community.squareup.com/t5/user/viewprofilepage/user-id/207381"&gt;@JustinC&lt;/a&gt;&amp;nbsp; - thanks for your reply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I took a closer look at the transaction fetch response -- the tenders array's single object has a customer_id after all.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 02:31:17 GMT</pubDate>
      <guid>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Checkout-API-How-to-link-checkout-to-customer-id/m-p/208825#M94188</guid>
      <dc:creator>rrrecords</dc:creator>
      <dc:date>2020-10-08T02:31:17Z</dc:date>
    </item>
    <item>
      <title>Re: how to Link checkout to customer id ?</title>
      <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Checkout-API-How-to-link-checkout-to-customer-id/m-p/209005#M94189</link>
      <description>&lt;P&gt;&lt;a href="https://community.squareup.com/t5/user/viewprofilepage/user-id/321463"&gt;@rrrecords&lt;/a&gt; Oh sweet! Let us know if you need anything else!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 19:57:49 GMT</pubDate>
      <guid>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Checkout-API-How-to-link-checkout-to-customer-id/m-p/209005#M94189</guid>
      <dc:creator>JustinC</dc:creator>
      <dc:date>2020-10-08T19:57:49Z</dc:date>
    </item>
  </channel>
</rss>

