Error when trying to identify customer with QR code

I would like to use the built-in camera on the Square terminal to identify customers by scanning a QR code like what is shown in this article: Scan QR Codes and Barcodes to Identify Customers | Square Support Center - US

I have generated a QR code and saved the customer’s reference id in the QR code link but I receive the error “code not valid” when I try to scan the customer’s QR code with my iPhone within the Square app.

I haven’t been able to find anything about this error and I’m hoping I might be able to get some help here. Thank you!

Currently with the Terminal there isn’t a built in camera that can be used to scan QR codes. The scanning that’s being highlighted in that article is with the Square app for customer QR codes. :slightly_smiling_face:

Ah, I see. Thank you Bryan!

If a business is using customer profiles within Square, is the customer that makes a transaction recognized as a customer when they input their phone number at the end to get a receipt, or does it happen before this point, like when a customer’s card is swiped or is that only if the Square POS is set up to save customer cards?

The app I’m building relies on being able to grab the customer id from the Retrieve Order API. I’m wondering if the customer making the transaction doesn’t say they want a receipt, will they still be linked to the transaction within the system - even if the Square POS is set up to not save a customer’s card?

Is there any way to recognize a customer if they only pay cash?
Or is there a way to recognize a customer if they have paid with a card, then make a cash purchase?

Thanks again, Bryan!

You’ll want to look to the payment from the Payments API to get the customer_id. Instant profiles are customer profiles that are automatically created in a seller’s Customer Directory following a payment. Future purchases made with the same card update the profile history with new payment details and other activities for your business.

If a customer is not assigned to a payment, Square attempts to infer the associated customer. First, Square checks the customer_id field in the corresponding order. If this field is not set, Square searches the Customer Directory for a matching profile using payment or related information (such as the billing and shipping address, email address, and payment source). If one cannot be found, Square attempts to create an instant profile. Note that this process is asynchronous and might take some time before customer_id is added to the payment.

If Square cannot find a matching customer profile and cannot create an instant profile, the customer_id field of the payment remains unset. :slightly_smiling_face:

Thank you for the information!

Will I be able to get the customer id from the Payments API within the Sandbox environment when I use the Square Dashboard virtual terminal to charge a test payment?

I’ve noticed when I don’t add a customer under the “Payment Details” section I am not seeing the customer Id in the payments API.

My testing process looks like this:

  1. In the Sandbox dashboard create a virtual terminal checkout
  2. Enter the transaction amount and enter the test card details (4111 1111 1111 1111)
  3. Charge the card
  4. The payment.updated webhook fires and sends the payload to my application
  5. In my application, I receive the Order Id, Payment Id, and Merchant Id
  6. I use the Order Id and Payment Id to search for the customer id

I can easily see the customer id if the customer is added under the “Payment Details” section when I am charging a test payment within the virtual terminal in the Sandbox Dashboard.

However, if I don’t add a customer, I do not receive any kind of customer id in the Payment API or the Order API.

How long does it take to add a customer id to a payment when Square searches the Customer Directory and tries to create an instant profile?

A couple more questions:

  1. Can you provide an example of a time when Square wouldn’t be able to find a matching profile and cannot create an instant profile?
  2. If a customer uses card A and then it expires, so they start using card B, will Square try to match them with a phone number, email, etc. and then the customer profile will be merged?
  3. If a customer profile is merged, how does Square decide which customer id to give them? The new or the old?
  4. Is there any way to recognize a customer if they only pay cash?

With sandbox if a customer isn’t added to the payment for a Virtual Terminal Payment it won’t have a customer_id.

The time it takes to add a customer to a payment can be immediate or take several minutes for Square to infer a customer to a payment in production. We don’t have an exact timeframe cause customer directories will differ in size.

An example of a time when Square wouldn’t be able to find a matching profile and cannot create an instant profile is a cash payment where they elected not to receive a receipt.

If card A expires and card B are the same numbers Square gets updates from the card company and will associate the customer to the payment. If card A and card B are totally different and they use the same profile information like phone number, email, etc we will infer that its the same customer and not create a new customer.

When a customer profile is merged an entirely new customer_id is generated. You can still retrieve the customer profile with the old customer_id but the new ID will be in the response.

With cash payments if were able to infer the customer with the information they give on checkout like phone number or email for receipt we will try to add the customer_id. :slightly_smiling_face:

1 Like

Thank you, Brian, for a thorough and informative answer, I appreciate it!

Going back to the message that started this thread.

I created a customer in Square and gave them a reference id number. Then I created a QR code and saved the reference id into the data of the link within the QR code.

If I am using the scan customer option on the Square app on my iPhone should I be able to bring up the corresponding customer?

This is what I did originally and received the error shown in the image in the first message of this thread.

The link to the QR code that you provided is https://www.uchat.com.au/p/web/0et4dmyxszav0kcx/full?ref=referenceid--f41380u25779066 which isn’t any of the recommended links for generating QR codes. You’ll need to use one of the URL:

Or you can also try using:

Thank you for the information.

The QR code is automatically populated on a wallet pass that I am using alongside the app I am building. I can add payloads to the QR code link for when it is scanned.

Are you saying I can’t use any QR code as long as there is a reference id that points to the customer? Instead, I have to use one of the four you listed in your previous response?

Yes, that is correct. I believe you need to use our documented ways of generating a QR code. :slightly_smiling_face:

Thanks again for the information!

I’m trying to find a way for the Square POS system to identify a customer before a purchase is made in a brick-and-mortar business.

Would using an add-on barcode scanner help with this? Or is there another device add-on that can be purchased where a customer can enter their phone number and through doing this, their customer profile is added to the transaction?

So the process for the customer could look like this:

  1. Enter their phone number on the device
  2. Order items
  3. Checkout

The process for the POS system could look like this:

  1. Receive the customer’s phone number and create a transaction with the customer added to it
  2. Ring up the customer’s order
  3. Prompt the customer for payment
  4. Payment is received

Is something like this possible, or is there something similar that you can think of to help me identify a customer before a transaction is finalized?

Thanks again for all of your help!

Using a scanner is the fastest way to add a customer to a sale. Otherwise the person checking the customer out would need to add the customer to the sale by manually inputing the information. :slightly_smiling_face:

Great, thank you!

I know the scanner needs to be compatible with the POS terminal. Other than that, is there one you recommend?

Also, is there a webpage that lists all the things a scanner can scan and the information it can pass through to the terminal? For example, can it scan the QR code on the wallet pass that I shared above and receive the reference id, as well as other forms of metadata?

Here’s the link to our Hardware site. Also you can only scan items and customers with the scanners. Scanning a QR code to make a payment from a digital wallet isn’t supported. :slightly_smiling_face:

Thank you for the link!

My last message wasn’t too clear. Sorry about that!

I am trying to figure out the easiest, quickest, and most reliable way to attach a customer to a transaction at a brick-and-mortar POS terminal. I do not want to make a payment from a digital wallet.

My app creates a digital wallet pass that is stored in the native Wallet app on an Apple iPhone. The created wallet pass has a QR code on it that stores the user’s unique user id as a payload. This unique user id is sent to the Customer profile using the Square API and stored in the reference id field.

I would like to scan customers.

Does a scanner have more capabilites than the Square app when scanning a QR code?

If possible, I would like to use the scanner to scan the QR code on the wallet pass that my app creates to attach a customer to the transaction.

What does the process look like for scanning a customer using a scanner?

Do I still have to use one of the QR code generators mentioned in your previous message from a couple of days ago or can I use my own?

Ah, thanks for the clarification. I’ve see multiple apps on a device including the Square app use one scanner. However that would require app switching and you’ll need to work directly with the hardware company to see if they offer developer tools to integrate with. :slightly_smiling_face: