CustomersApi

April 10, 2019 ยท View on GitHub

squareconnect.apis.customers_api

All endpoints are relative to Square Connect V2 Documentation

MethodHTTP request
create_customerPOST /v2/customers
create_customer_cardPOST /v2/customers/{customer_id}/cards
delete_customerDELETE /v2/customers/{customer_id}
delete_customer_cardDELETE /v2/customers/{customer_id}/cards/{card_id}
list_customersGET /v2/customers
retrieve_customerGET /v2/customers/{customer_id}
search_customersPOST /v2/customers/search
update_customerPUT /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

NameTypeNotesDefault Value
bodyCreateCustomerRequest

Return type

CreateCustomerResponse

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

NameTypeNotesDefault Value
customer_idstr
bodyCreateCustomerCardRequest

Return type

CreateCustomerCardResponse

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

NameTypeNotesDefault Value
customer_idstr

Return type

DeleteCustomerResponse

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

NameTypeNotesDefault Value
customer_idstr
card_idstr

Return type

DeleteCustomerCardResponse

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

NameTypeNotesDefault Value
cursorstr[optional]
sort_fieldstr[optional]
sort_orderstr[optional]

Return type

ListCustomersResponse

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

NameTypeNotesDefault Value
customer_idstr

Return type

RetrieveCustomerResponse

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

NameTypeNotesDefault Value
bodySearchCustomersRequest

Return type

SearchCustomersResponse

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

NameTypeNotesDefault Value
customer_idstr
bodyUpdateCustomerRequest

Return type

UpdateCustomerResponse

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]