All URIs are relative to https://connect.squareup.com
Method | HTTP request | Description |
---|---|---|
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 |
RetrieveCustomer | GET /v2/customers/{customer_id} | RetrieveCustomer |
SearchCustomers | POST /v2/customers/search | SearchCustomers |
UpdateCustomer | PUT /v2/customers/{customer_id} | UpdateCustomer |
CreateCustomerResponse CreateCustomer (CreateCustomerRequest 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
using System;
using System.Diagnostics;
using Square.Connect.Api;
using Square.Connect.Client;
using Square.Connect.Model;
namespace Example
{
public class CreateCustomerExample
{
public void main()
{
// Configure OAuth2 access token for authorization: oauth2
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new CustomersApi();
var body = new CreateCustomerRequest(); // CreateCustomerRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details.
try
{
// CreateCustomer
CreateCustomerResponse result = apiInstance.CreateCustomer(body);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling CustomersApi.CreateCustomer: " + e.Message );
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
body | CreateCustomerRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
CreateCustomerCardResponse CreateCustomerCard (string customerId, CreateCustomerCardRequest body)
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.
using System;
using System.Diagnostics;
using Square.Connect.Api;
using Square.Connect.Client;
using Square.Connect.Model;
namespace Example
{
public class CreateCustomerCardExample
{
public void main()
{
// Configure OAuth2 access token for authorization: oauth2
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new CustomersApi();
var customerId = customerId_example; // string | The Square ID of the customer profile the card is linked to.
var body = new CreateCustomerCardRequest(); // CreateCustomerCardRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details.
try
{
// CreateCustomerCard
CreateCustomerCardResponse result = apiInstance.CreateCustomerCard(customerId, body);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling CustomersApi.CreateCustomerCard: " + e.Message );
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
customerId | string | The Square ID of the customer profile the card is linked to. | |
body | CreateCustomerCardRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
DeleteCustomerResponse DeleteCustomer (string 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.
using System;
using System.Diagnostics;
using Square.Connect.Api;
using Square.Connect.Client;
using Square.Connect.Model;
namespace Example
{
public class DeleteCustomerExample
{
public void main()
{
// Configure OAuth2 access token for authorization: oauth2
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new CustomersApi();
var customerId = customerId_example; // string | The ID of the customer to delete.
try
{
// DeleteCustomer
DeleteCustomerResponse result = apiInstance.DeleteCustomer(customerId);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling CustomersApi.DeleteCustomer: " + e.Message );
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
customerId | string | The ID of the customer to delete. |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
DeleteCustomerCardResponse DeleteCustomerCard (string customerId, string cardId)
DeleteCustomerCard
Removes a card on file from a customer.
using System;
using System.Diagnostics;
using Square.Connect.Api;
using Square.Connect.Client;
using Square.Connect.Model;
namespace Example
{
public class DeleteCustomerCardExample
{
public void main()
{
// Configure OAuth2 access token for authorization: oauth2
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new CustomersApi();
var customerId = customerId_example; // string | The ID of the customer that the card on file belongs to.
var cardId = cardId_example; // string | The ID of the card on file to delete.
try
{
// DeleteCustomerCard
DeleteCustomerCardResponse result = apiInstance.DeleteCustomerCard(customerId, cardId);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling CustomersApi.DeleteCustomerCard: " + e.Message );
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
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. |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ListCustomersResponse ListCustomers (string cursor = null, string sortField = null, string sortOrder = null)
ListCustomers
Lists a business's customers.
using System;
using System.Diagnostics;
using Square.Connect.Api;
using Square.Connect.Client;
using Square.Connect.Model;
namespace Example
{
public class ListCustomersExample
{
public void main()
{
// Configure OAuth2 access token for authorization: oauth2
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new CustomersApi();
var cursor = cursor_example; // 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](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. (optional)
var sortField = sortField_example; // string | Indicates how Customers should be sorted. Default: `DEFAULT`. (optional)
var sortOrder = sortOrder_example; // string | Indicates whether Customers should be sorted in ascending (`ASC`) or descending (`DESC`) order. Default: `ASC`. (optional)
try
{
// ListCustomers
ListCustomersResponse result = apiInstance.ListCustomers(cursor, sortField, sortOrder);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling CustomersApi.ListCustomers: " + e.Message );
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
cursor | 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. | [optional] |
sortField | string | Indicates how Customers should be sorted. Default: `DEFAULT`. | [optional] |
sortOrder | string | Indicates whether Customers should be sorted in ascending (`ASC`) or descending (`DESC`) order. Default: `ASC`. | [optional] |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
RetrieveCustomerResponse RetrieveCustomer (string customerId)
RetrieveCustomer
Returns details for a single customer.
using System;
using System.Diagnostics;
using Square.Connect.Api;
using Square.Connect.Client;
using Square.Connect.Model;
namespace Example
{
public class RetrieveCustomerExample
{
public void main()
{
// Configure OAuth2 access token for authorization: oauth2
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new CustomersApi();
var customerId = customerId_example; // string | The ID of the customer to retrieve.
try
{
// RetrieveCustomer
RetrieveCustomerResponse result = apiInstance.RetrieveCustomer(customerId);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling CustomersApi.RetrieveCustomer: " + e.Message );
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
customerId | string | The ID of the customer to retrieve. |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
SearchCustomersResponse SearchCustomers (SearchCustomersRequest body)
SearchCustomers
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
.
using System;
using System.Diagnostics;
using Square.Connect.Api;
using Square.Connect.Client;
using Square.Connect.Model;
namespace Example
{
public class SearchCustomersExample
{
public void main()
{
// Configure OAuth2 access token for authorization: oauth2
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new CustomersApi();
var body = new SearchCustomersRequest(); // SearchCustomersRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details.
try
{
// SearchCustomers
SearchCustomersResponse result = apiInstance.SearchCustomers(body);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling CustomersApi.SearchCustomers: " + e.Message );
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
body | SearchCustomersRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
UpdateCustomerResponse UpdateCustomer (string customerId, UpdateCustomerRequest body)
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.
using System;
using System.Diagnostics;
using Square.Connect.Api;
using Square.Connect.Client;
using Square.Connect.Model;
namespace Example
{
public class UpdateCustomerExample
{
public void main()
{
// Configure OAuth2 access token for authorization: oauth2
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new CustomersApi();
var customerId = customerId_example; // string | The ID of the customer to update.
var body = new UpdateCustomerRequest(); // UpdateCustomerRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details.
try
{
// UpdateCustomer
UpdateCustomerResponse result = apiInstance.UpdateCustomer(customerId, body);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling CustomersApi.UpdateCustomer: " + e.Message );
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
customerId | string | The ID of the customer to update. | |
body | UpdateCustomerRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]