Applies to: Customers API | Cards API | Terminal API | Web Payments SDK | In-App Payments SDK | Payments API
Learn more about how the Customers API processes information.
The Customers API is a RESTful web service hosted on Square servers. You can use the Customers API to create and manage customer profiles for Square sellers, including membership in customer groups.
Creating a customer profile typically includes the following steps:
The frontend collects customer information with the customer's consent using a form created by the developer. Square doesn't provide a prebuilt form for this purpose. For more information, see Best Practices for Collecting Information.
The backend packages the customer's phone number or email address as a
SearchCustomers
request object and sends it to the SearchCustomers endpoint. This step is recommended to avoid creating duplicate customer profiles.Square processes the request:
- If the request succeeds, Square returns a list of matching
Customer
objects or an empty object ({}
) if none are found. - If the request fails, Square returns any errors that occurred as an
Error[]
.
- If the request succeeds, Square returns a list of matching
If no matching customer profiles are found, the backend packages the customer information as a
CreateCustomer
request object and sends it to the CreateCustomer endpoint.Square processes the request:
- If the request succeeds, Square returns a
Customer
object and invokes acustomer.created
webhook event. - If the request fails, Square returns any errors that occurred as an
Error[]
.
- If the request succeeds, Square returns a
The frontend displays results for the customer.
For more information about creating and managing customer profiles, including example requests and responses, see Manage Customer Profiles. Or, check out the getCustomerID function in the Bookings API Sample App (Node.js) to see a sample implementation of this workflow.