CustomersApi
April 10, 2019 ยท View on GitHub
squareconnect.apis.customers_api
All endpoints are relative to Square Connect V2 Documentation
| Method | HTTP request |
|---|---|
| create_customer | POST /v2/customers |
| create_customer_card | POST /v2/customers/{customer_id}/cards |
| delete_customer | DELETE /v2/customers/{customer_id} |
| delete_customer_card | DELETE /v2/customers/{customer_id}/cards/{card_id} |
| list_customers | GET /v2/customers |
| retrieve_customer | GET /v2/customers/{customer_id} |
| search_customers | POST /v2/customers/search |
| update_customer | PUT /v2/customers/{customer_id} |
create_customer
CreateCustomerResponse create_customer(body)
Description
Creates a new customer for a business, which can have associated cards on file. You must provide at least one of the following values in your request to this endpoint: - given_name - family_name - company_name - email_address - phone_number
Parameters
| Name | Type | Notes | Default Value |
|---|---|---|---|
| body | CreateCustomerRequest |
Return type
Authorization
Assign your Access Token from developer portal to the authorization parameter.
[Back to top] [Back to API list] [Back to Model list] [Back to README]
create_customer_card
CreateCustomerCardResponse create_customer_card(customer_id, body)
Description
Adds a card on file to an existing customer. As with charges, calls to CreateCustomerCard are idempotent. Multiple calls with the same card nonce return the same card record that was created with the provided nonce during the first call. Cards on file are automatically updated on a monthly basis to confirm they are still valid and can be charged.
Parameters
| Name | Type | Notes | Default Value |
|---|---|---|---|
| customer_id | str | ||
| body | CreateCustomerCardRequest |
Return type
Authorization
Assign your Access Token from developer portal to the authorization parameter.
[Back to top] [Back to API list] [Back to Model list] [Back to README]
delete_customer
DeleteCustomerResponse delete_customer(customer_id)
Description
Deletes a customer from a business, along with any linked cards on file. When two profiles are merged into a single profile, that profile is assigned a new customer_id. You must use the new customer_id to delete merged profiles.
Parameters
| Name | Type | Notes | Default Value |
|---|---|---|---|
| customer_id | str |
Return type
Authorization
Assign your Access Token from developer portal to the authorization parameter.
[Back to top] [Back to API list] [Back to Model list] [Back to README]
delete_customer_card
DeleteCustomerCardResponse delete_customer_card(customer_id, card_id)
Description
Removes a card on file from a customer.
Parameters
| Name | Type | Notes | Default Value |
|---|---|---|---|
| customer_id | str | ||
| card_id | str |
Return type
Authorization
Assign your Access Token from developer portal to the authorization parameter.
[Back to top] [Back to API list] [Back to Model list] [Back to README]
list_customers
ListCustomersResponse list_customers(cursor=cursor, sort_field=sort_field, sort_order=sort_order)
Description
Lists a business's customers.
Parameters
| Name | Type | Notes | Default Value |
|---|---|---|---|
| cursor | str | [optional] | |
| sort_field | str | [optional] | |
| sort_order | str | [optional] |
Return type
Authorization
Assign your Access Token from developer portal to the authorization parameter.
[Back to top] [Back to API list] [Back to Model list] [Back to README]
retrieve_customer
RetrieveCustomerResponse retrieve_customer(customer_id)
Description
Returns details for a single customer.
Parameters
| Name | Type | Notes | Default Value |
|---|---|---|---|
| customer_id | str |
Return type
Authorization
Assign your Access Token from developer portal to the authorization parameter.
[Back to top] [Back to API list] [Back to Model list] [Back to README]
search_customers
SearchCustomersResponse search_customers(body)
Description
Searches the customer profiles associated with a Square account. Calling SearchCustomers without an explicit query parameter returns all customer profiles ordered alphabetically based on given_name and family_name.
Parameters
| Name | Type | Notes | Default Value |
|---|---|---|---|
| body | SearchCustomersRequest |
Return type
Authorization
Assign your Access Token from developer portal to the authorization parameter.
[Back to top] [Back to API list] [Back to Model list] [Back to README]
update_customer
UpdateCustomerResponse update_customer(customer_id, body)
Description
Updates the details of an existing customer. When two profiles are merged into a single profile, that profile is assigned a new customer_id. You must use the new customer_id to update merged profiles. You cannot edit a customer's cards on file with this endpoint. To make changes to a card on file, you must delete the existing card on file with the DeleteCustomerCard endpoint, then create a new one with the CreateCustomerCard endpoint.
Parameters
| Name | Type | Notes | Default Value |
|---|---|---|---|
| customer_id | str | ||
| body | UpdateCustomerRequest |
Return type
Authorization
Assign your Access Token from developer portal to the authorization parameter.
[Back to top] [Back to API list] [Back to Model list] [Back to README]