Missing customer id from order response.

Hello Team,

 

I’m using the Order API to retrieve order details, and I’ve noticed that the Customer ID field is not consistently populated across all orders.

 

As a reference, here's an example of an order where the customer ID is returned correctly:

However, for many other orders, the Customer ID is missing in the API response. Could you please look into this inconsistency?

 
Order ID: 30vqVahlPZuluSidnCKKz3meV
Customer ID: J83AGHGF6YJVNYDW3YFB7TRJR4

The following orders do not include a customer ID in the response

1VjpNuEjoWn0hJmNlTTi7tRqivYZY
3ijiBfeVhpEDPNV2z1Ue92lepuWZY
F5l7Zi71BGww5iuOUIwhJoWqZgZZY

63 Views
Message 1 of 2
Report
1 Solution
Square Community Moderator

Solution

Hi, @Faaque ! Welcome the Square Community! 

 

Order ID is optional and is only populated when a customer profile was explicitly linked to the order at creation or via an update. Common cases where it’s not set:

  • Guest/anonymous checkout (no profile selected or created).
  • POS orders where the team didn’t attach a customer at checkout.
  • Online orders where the buyer didn’t sign in and no post-purchase linking occurred.
  • 3P/legacy flows (e.g., older integrations, terminals) that don’t send customer_id with the order.
  • Merged/deleted customer profiles—the order remains, but its customer_id link can be lost.

Square may still know who paid (on the Payment), but the Order object itself won’t show customer_id unless it was linked.

 

How to recover the customer for “missing” orders

You can usually backfill from Payments or fulfillment data:Look up the Payment(s) for the order
Use Payments API to find the payment tied to the order; payments often have customer_id even when the order doesn’t.POST /v2/payments/search
{
"query": { "filter": { "order_filter": { "order_ids": ["<ORDER_ID>"] } } }
}
 
If payments[i].customer_id is present, that’s your customer.If there’s no customer_id on the payment, try:
  • buyer_email_address on the Order
  • fulfillments[].shipment_details.recipient.* (name, email, phone)
  • Any invoice/checkout link metadata you passed

I hope this helps.  

View Solution >

45 Views
Message 2 of 2
Report
1 REPLY 1
Square Community Moderator

Solution

Hi, @Faaque ! Welcome the Square Community! 

 

Order ID is optional and is only populated when a customer profile was explicitly linked to the order at creation or via an update. Common cases where it’s not set:

  • Guest/anonymous checkout (no profile selected or created).
  • POS orders where the team didn’t attach a customer at checkout.
  • Online orders where the buyer didn’t sign in and no post-purchase linking occurred.
  • 3P/legacy flows (e.g., older integrations, terminals) that don’t send customer_id with the order.
  • Merged/deleted customer profiles—the order remains, but its customer_id link can be lost.

Square may still know who paid (on the Payment), but the Order object itself won’t show customer_id unless it was linked.

 

How to recover the customer for “missing” orders

You can usually backfill from Payments or fulfillment data:Look up the Payment(s) for the order
Use Payments API to find the payment tied to the order; payments often have customer_id even when the order doesn’t.POST /v2/payments/search
{
"query": { "filter": { "order_filter": { "order_ids": ["<ORDER_ID>"] } } }
}
 
If payments[i].customer_id is present, that’s your customer.If there’s no customer_id on the payment, try:
  • buyer_email_address on the Order
  • fulfillments[].shipment_details.recipient.* (name, email, phone)
  • Any invoice/checkout link metadata you passed

I hope this helps.  

46 Views
Message 2 of 2
Report