square/connect-php-sdk

How to pass external system unique Customer ID?

Closed this issue · 1 comments

I'm using the SDK with the CheckOut payment page option: $checkoutUrl = $result->getCheckout()->getCheckoutPageUrl();

Our student portal system has the unique identifier for the student submitting a payment. I am trying to pass that through to the payment page so it will appear in the Square website transactions export CSV in the field customer reference ID. I am able to successfully use $checkout->setPrePopulateBuyerEmail($customerEmail); ... and it appears as the Customer Name in the export.

Based on this reference https://www.sellercommunity.com/t5/Developer-Discussions/Connect-V2-API-Linking-a-transaction-to-customer-id/td-p/11858 I tried to add customer_id into the checkout object.

I have attached my revision to CheckoutOrderRequest.php (as
[CreateCheckoutRequest.txt] (https://github.com/square/connect-php-sdk/files/2225168/CreateCheckoutRequest.txt)

and based on that I used $checkout->setCustomerID($tmp_customer_nbr);

But still no joy on customer reference ID being filled in. Any guidance?

Hi @thrunch !

The Checkout API does not take a customer_id, and will always result in a new customer being created. If you would like to attach a customer to a transaction, you would need to utilize our Transactions API instead of our Checkout API. Please see details here: https://docs.connect.squareup.com/payments/sqpaymentform/overview
https://docs.connect.squareup.com/payments/transactions/overview

Let me know if you have any questions about this.