When I download Transactions from UI, it gives the customer details but when I try to Batch Retrieve Order, for some orders it gives me customer id, for others it doesn’t.
That’s correct, the Transactions CSV is made up API calls from the Orders API and Payments API. You’ll need to take either the payment_id
or tender_id
from the order and call GetPayment to get all the payments for the order. The payment object will have the customer_id
on it.
Interesting! So will Payment API always have a customer Id? All this while I was getting from Orders API.
Thank you for your response, Bryan. Appreciate it
It will if were able to associate the payment to a profile. 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.