Skip to content

Latest commit

 

History

History
318 lines (200 loc) · 13.5 KB

CustomersApi.md

File metadata and controls

318 lines (200 loc) · 13.5 KB

{{classname}}

All URIs are relative to https://connect.squareup.com/

Method HTTP request Description
AddGroupToCustomer Put /v2/customers/{customer_id}/groups/{group_id} AddGroupToCustomer
CreateCustomer Post /v2/customers CreateCustomer
CreateCustomerCard Post /v2/customers/{customer_id}/cards CreateCustomerCard
DeleteCustomer Delete /v2/customers/{customer_id} DeleteCustomer
DeleteCustomerCard Delete /v2/customers/{customer_id}/cards/{card_id} DeleteCustomerCard
ListCustomers Get /v2/customers ListCustomers
RemoveGroupFromCustomer Delete /v2/customers/{customer_id}/groups/{group_id} RemoveGroupFromCustomer
RetrieveCustomer Get /v2/customers/{customer_id} RetrieveCustomer
SearchCustomers Post /v2/customers/search SearchCustomers
UpdateCustomer Put /v2/customers/{customer_id} UpdateCustomer

AddGroupToCustomer

AddGroupToCustomerResponse AddGroupToCustomer(ctx, customerId, groupId) AddGroupToCustomer

Adds a group membership to a customer. The customer is identified by the customer_id value and the customer group is identified by the group_id value.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
customerId string The ID of the customer to add to a group.
groupId string The ID of the customer group to add the customer to.

Return type

AddGroupToCustomerResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

CreateCustomer

CreateCustomerResponse CreateCustomer(ctx, body) CreateCustomer

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

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
body CreateCustomerRequest An object containing the fields to POST for the request.

See the corresponding object definition for field details. |

Return type

CreateCustomerResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

CreateCustomerCard

CreateCustomerCardResponse CreateCustomerCard(ctx, body, customerId) CreateCustomerCard

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.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
body CreateCustomerCardRequest An object containing the fields to POST for the request.

See the corresponding object definition for field details. | customerId | string| The Square ID of the customer profile the card is linked to. |

Return type

CreateCustomerCardResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

DeleteCustomer

DeleteCustomerResponse DeleteCustomer(ctx, customerId) DeleteCustomer

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.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
customerId string The ID of the customer to delete.

Return type

DeleteCustomerResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

DeleteCustomerCard

DeleteCustomerCardResponse DeleteCustomerCard(ctx, customerId, cardId) DeleteCustomerCard

Removes a card on file from a customer.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
customerId string The ID of the customer that the card on file belongs to.
cardId string The ID of the card on file to delete.

Return type

DeleteCustomerCardResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListCustomers

ListCustomersResponse ListCustomers(ctx, optional) ListCustomers

Lists customer profiles associated with a Square account. Under normal operating conditions, newly created or updated customer profiles become available for the listing operation in well under 30 seconds. Occasionally, propagation of the new or updated profiles can take closer to one minute or longer, especially during network incidents and outages.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
optional *CustomersApiListCustomersOpts optional parameters nil if no parameters

Optional Parameters

Optional parameters are passed through a pointer to a CustomersApiListCustomersOpts struct

Name Type Description Notes
cursor optional.String A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for your original query. See the Pagination guide for more information.
sortField optional.String Indicates how Customers should be sorted. Default: `DEFAULT`.
sortOrder optional.String Indicates whether Customers should be sorted in ascending (`ASC`) or descending (`DESC`) order. Default: `ASC`.

Return type

ListCustomersResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

RemoveGroupFromCustomer

RemoveGroupFromCustomerResponse RemoveGroupFromCustomer(ctx, customerId, groupId) RemoveGroupFromCustomer

Removes a group membership from a customer. The customer is identified by the customer_id value and the customer group is identified by the group_id value.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
customerId string The ID of the customer to remove from the group.
groupId string The ID of the customer group to remove the customer from.

Return type

RemoveGroupFromCustomerResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

RetrieveCustomer

RetrieveCustomerResponse RetrieveCustomer(ctx, customerId) RetrieveCustomer

Returns details for a single customer.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
customerId string The ID of the customer to retrieve.

Return type

RetrieveCustomerResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

SearchCustomers

SearchCustomersResponse SearchCustomers(ctx, body) SearchCustomers

Searches the customer profiles associated with a Square account using a supported query filter. Calling SearchCustomers without any explicit query filter returns all customer profiles ordered alphabetically based on given_name and family_name. Under normal operating conditions, newly created or updated customer profiles become available for the search operation in well under 30 seconds. Occasionally, propagation of the new or updated profiles can take closer to one minute or longer, especially during network incidents and outages.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
body SearchCustomersRequest An object containing the fields to POST for the request.

See the corresponding object definition for field details. |

Return type

SearchCustomersResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

UpdateCustomer

UpdateCustomerResponse UpdateCustomer(ctx, body, customerId) UpdateCustomer

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.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
body UpdateCustomerRequest An object containing the fields to POST for the request.

See the corresponding object definition for field details. | customerId | string| The ID of the customer to update. |

Return type

UpdateCustomerResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]