Customers
Create, update, delete, and query the available customers in Square.
Table Specific Information
Select
The 本製品 uses the Square API to process search criteria that refer to the Id column, while other filters are processed client side within the 本製品.
Retrieve all customers:
SELECT * FROM Customers
Retrieve only one customer:
SELECT * FROM Customers WHERE Id = '0SY145EEWD0YXCW489VV386KH8'
Insert
To create a customer, you will need to specify at least one of the following values: GivenName, FamilyName, CompanyName, EmailAddress, and PhoneNumber.
INSERT INTO Customers (GivenName, FamilyName, Email, PhoneNumber, AddressLine1, AddressLine2, AddressLocality, AddressAdministrativeDistrictLevel1, AddressPostalCode, AddressCountry) VALUES ('John', 'Doe', '[email protected]', '1-212-555-4240', '500 Electric Ave', 'Suite 600', 'New York', 'NY', '10003', 'US')
Update
Modify the details of an existing customer by providing the Id of the customer:
UPDATE Customers SET GivenName = 'Amelia', FamilyName = 'Earhart' WHERE Id = '32123'
Delete
Delete a customer from a business, along with any linked cards on file, by providing the Id of the customer:
DELETE FROM Customers WHERE Id = '32123'
Columns
Name | Type | ReadOnly | Description |
Id [KEY] | String | True |
The Id of the customer. |
GivenName | String | False |
The customer's given (i.e., first) name. |
FamilyName | String | False |
The customer's family (i.e., last) name. |
Nickname | String | False |
The customer's nickname. |
String | False |
The customer's email address. | |
CompanyName | String | False |
The name of the customer's company. |
PhoneNumber | String | False |
The customer's phone number. |
AddressLine1 | String | False |
The first line of the address. |
AddressLine2 | String | False |
The second line of the address. |
AddressLine3 | String | False |
The third line of the address. |
AddressLocality | String | False |
The city or town of the address. |
AddressSubLocality | String | False |
A civil region within the address's locality. |
AddressSubLocality2 | String | False |
A civil region within the address's sublocality. |
AddressSubLocality3 | String | False |
A civil region within the address's sublocality_2. |
AddressAdministrativeDistrictLevel1 | String | False |
A civil entity within the address's country. In the US, this is the state. |
AddressAdministrativeDistrictLevel2 | String | False |
A civil entity within the address's administrative_district_level_1. In the US, this is the county. |
AddressAdministrativeDistrictLevel3 | String | False |
A civil entity within the address's administrative_district_level_2. |
AddressPostalCode | String | False |
The address's postal code. |
AddressCountry | String | False |
The address's country, in ISO 3166-1-alpha-2 format. |
AddressFirstName | String | False |
Optional first name when it's representing recipient. |
AddressLastName | String | False |
Optional last name when it's representing recipient. |
AddressOrganization | String | False |
Optional organization name when it's representing recipient. |
Birthday | String | False |
The birthday associated with the customer profile, in RFC 3339 format. Year is optional, timezone and times are not allowed |
CreatedAt | Datetime | True |
The time when the customer was created. |
UpdatedAt | Datetime | True |
The time when the customer was last updated. |
ReferenceId | String | False |
A second ID you can set to associate the customer with an entity in another system. |
Note | String | False |
A note to associate with the customer. |
CardsAggregate | String | True |
The non-confidential details of the customer's cards on file. |
Preferences | String | True |
The customer's preferences. |
Segments | String | True |
The IDs of segments the customer belongs to. |