Appearance
Customers
Manage customer accounts, profiles, and relationships. Handle customer registration, authentication, address management, order history, group memberships, and GDPR consent tracking.
Basic CRUD Actions
Get Customers listing
View on PostmanGet a list of all customers.
JS
let customers = await Client.API.Core.Customers.all();TS
import { Response, Customers } from "@tscommerce/sdk-typescript"
Client.API.Core.Customers.all().then((response:Response<Customers>) => {
response.resource.forEach((customer) => {
console.log(customer.id, customer.email, customer.name);
});
});PHP
$customers = $client->API->Core->Customers->all();Create new Customer
View on PostmanCreate a new customer account.
JS
const payload = {
email: 'customer@example.com',
first_name: 'Mario',
last_name: 'Rossi',
password: 'securepass123'
};
let customer = await Client.API.Core.Customers.create(payload);TS
import { Response, Customer, CreateCustomerPayload } from "@tscommerce/sdk-typescript"
const payload:CreateCustomerPayload = {
email: 'customer@example.com',
first_name: 'Mario',
last_name: 'Rossi',
password: 'securepass123'
};
Client.API.Core.Customers.create(payload).then((response:Response<Customer>) => {
console.log('Created customer:', response.resource);
});PHP
$payload = [
'email' => 'customer@example.com',
'first_name' => 'Mario',
'last_name' => 'Rossi',
'password' => 'securepass123'
];
$customer = $client->API->Core->Customers->create($payload);Get Customer
View on PostmanGet an existing customer by ID.
JS
const customerId = 123;
let customer = await Client.API.Core.Customers.read(customerId);TS
import { Response, Customer } from "@tscommerce/sdk-typescript"
const customerId:Customer['id'] = 123;
Client.API.Core.Customers.read(customerId).then((response:Response<Customer>) => {
console.log('Customer:', response.resource);
});PHP
$customerId = 123;
$customer = $client->API->Core->Customers->read($customerId);Update Customer
View on PostmanUpdate an existing customer account.
JS
const customerId = 123;
const payload = {
phone: '+39 02 1234567'
};
let customer = await Client.API.Core.Customers.update(customerId, payload);TS
import { Response, Customer, UpdateCustomerPayload } from "@tscommerce/sdk-typescript"
const customerId:Customer['id'] = 123;
const payload:UpdateCustomerPayload = {
phone: '+39 02 1234567'
};
Client.API.Core.Customers.update(customerId, payload).then((response:Response<Customer>) => {
console.log('Updated customer:', response.resource);
});PHP
$customerId = 123;
$payload = ['phone' => '+39 02 1234567'];
$customer = $client->API->Core->Customers->update($customerId, $payload);Delete Customer
View on PostmanDelete a customer account.
JS
const customerId = 123;
Client.API.Core.Customers.delete(customerId);TS
import { Response, Customer } from "@tscommerce/sdk-typescript"
const customerId:Customer['id'] = 123;
Client.API.Core.Customers.delete(customerId).then((response:Response) => {
console.log('Customer deleted successfully');
});PHP
$customerId = 123;
$client->API->Core->Customers->delete($customerId);Bulk Actions
Bulk delete Customers
View on PostmanDelete multiple customer accounts at once.
JS
const customerIds = [123, 456, 789];
Client.API.Core.Customers.bulkDelete({ ids: customerIds });TS
import { Response, BulkDeleteCustomerPayload } from "@tscommerce/sdk-typescript"
const payload:BulkDeleteCustomerPayload = {
ids: [123, 456, 789]
};
Client.API.Core.Customers.bulkDelete(payload).then((response:Response) => {
console.log('Customers deleted successfully');
});PHP
$payload = ['ids' => [123, 456, 789]];
$client->API->Core->Customers->bulkDelete($payload);Search
Search Customers
View on PostmanSearch customers by email, name, or other attributes.
JS
const query = 'mario@example.com';
let results = await Client.API.Core.Customers.search({ query });TS
import { Response, Customers, SearchCustomersPayload } from "@tscommerce/sdk-typescript"
const payload:SearchCustomersPayload = {
query: 'mario@example.com'
};
Client.API.Core.Customers.search(payload).then((response:Response<Customers>) => {
response.resource.forEach((customer) => {
console.log(customer.email);
});
});PHP
$payload = ['query' => 'mario@example.com'];
$results = $client->API->Core->Customers->search($payload);Customer Addresses
Get Customer Addresses
View on PostmanGet all addresses associated with a customer.
JS
const customerId = 123;
let addresses = await Client.API.Core.Customers.getAddresses(customerId);TS
import { Response, Addresses, Customer } from "@tscommerce/sdk-typescript"
const customerId:Customer['id'] = 123;
Client.API.Core.Customers.getAddresses(customerId).then((response:Response<Addresses>) => {
response.resource.forEach((address) => {
console.log(address.street, address.city);
});
});PHP
$customerId = 123;
$addresses = $client->API->Core->Customers->getAddresses($customerId);Create Customer Address
View on PostmanCreate a new address for a customer.
JS
const customerId = 123;
const payload = {
street: 'Via Roma 123',
city: 'Milan',
postal_code: '20100',
country: 'IT',
type: 'shipping'
};
let address = await Client.API.Core.Customers.createAddress(customerId, payload);TS
import { Response, Address, Customer, CreateAddressPayload } from "@tscommerce/sdk-typescript"
const customerId:Customer['id'] = 123;
const payload:CreateAddressPayload = {
street: 'Via Roma 123',
city: 'Milan',
postal_code: '20100',
country: 'IT',
type: 'shipping'
};
Client.API.Core.Customers.createAddress(customerId, payload).then((response:Response<Address>) => {
console.log('Created address:', response.resource);
});PHP
$customerId = 123;
$payload = [
'street' => 'Via Roma 123',
'city' => 'Milan',
'postal_code' => '20100',
'country' => 'IT',
'type' => 'shipping'
];
$address = $client->API->Core->Customers->createAddress($customerId, $payload);Update Customer Address
View on PostmanUpdate an existing customer address.
JS
const customerId = 123;
const addressId = 456;
const payload = {
postal_code: '20121'
};
let address = await Client.API.Core.Customers.updateAddress(customerId, addressId, payload);TS
import { Response, Address, Customer, UpdateAddressPayload } from "@tscommerce/sdk-typescript"
const customerId:Customer['id'] = 123;
const addressId:Address['id'] = 456;
const payload:UpdateAddressPayload = {
postal_code: '20121'
};
Client.API.Core.Customers.updateAddress(customerId, addressId, payload).then((response:Response<Address>) => {
console.log('Updated address:', response.resource);
});PHP
$customerId = 123;
$addressId = 456;
$payload = ['postal_code' => '20121'];
$address = $client->API->Core->Customers->updateAddress($customerId, $addressId, $payload);Delete Customer Address
View on PostmanDelete a customer address.
JS
const customerId = 123;
const addressId = 456;
Client.API.Core.Customers.deleteAddress(customerId, addressId);TS
import { Response, Customer, Address } from "@tscommerce/sdk-typescript"
const customerId:Customer['id'] = 123;
const addressId:Address['id'] = 456;
Client.API.Core.Customers.deleteAddress(customerId, addressId).then((response:Response) => {
console.log('Address deleted successfully');
});PHP
$customerId = 123;
$addressId = 456;
$client->API->Core->Customers->deleteAddress($customerId, $addressId);Customer Orders
Get Customer Orders
View on PostmanGet all orders placed by a customer.
JS
const customerId = 123;
let orders = await Client.API.Core.Customers.getOrders(customerId);TS
import { Response, Orders, Customer } from "@tscommerce/sdk-typescript"
const customerId:Customer['id'] = 123;
Client.API.Core.Customers.getOrders(customerId).then((response:Response<Orders>) => {
response.resource.forEach((order) => {
console.log(order.id, order.total);
});
});PHP
$customerId = 123;
$orders = $client->API->Core->Customers->getOrders($customerId);Customer Groups
Get Customer Groups
View on PostmanGet all groups a customer belongs to.
JS
const customerId = 123;
let groups = await Client.API.Core.Customers.getGroups(customerId);TS
import { Response, Groups, Customer } from "@tscommerce/sdk-typescript"
const customerId:Customer['id'] = 123;
Client.API.Core.Customers.getGroups(customerId).then((response:Response<Groups>) => {
response.resource.forEach((group) => {
console.log(group.name);
});
});PHP
$customerId = 123;
$groups = $client->API->Core->Customers->getGroups($customerId);Assign Groups to Customer
View on PostmanAdd a customer to one or more groups.
JS
const customerId = 123;
const groupIds = [456, 789];
Client.API.Core.Customers.assignGroups(customerId, { group_ids: groupIds });TS
import { Response, Customer, AssignGroupsToCustomerPayload } from "@tscommerce/sdk-typescript"
const customerId:Customer['id'] = 123;
const payload:AssignGroupsToCustomerPayload = {
group_ids: [456, 789]
};
Client.API.Core.Customers.assignGroups(customerId, payload).then((response:Response) => {
console.log('Groups assigned successfully');
});PHP
$customerId = 123;
$payload = ['group_ids' => [456, 789]];
$client->API->Core->Customers->assignGroups($customerId, $payload);Remove Groups from Customer
View on PostmanRemove a customer from specific groups.
JS
const customerId = 123;
const groupIds = [456];
Client.API.Core.Customers.removeGroups(customerId, { group_ids: groupIds });TS
import { Response, Customer, RemoveGroupsFromCustomerPayload } from "@tscommerce/sdk-typescript"
const customerId:Customer['id'] = 123;
const payload:RemoveGroupsFromCustomerPayload = {
group_ids: [456]
};
Client.API.Core.Customers.removeGroups(customerId, payload).then((response:Response) => {
console.log('Groups removed successfully');
});PHP
$customerId = 123;
$payload = ['group_ids' => [456]];
$client->API->Core->Customers->removeGroups($customerId, $payload);Customer Consents
Get Customer Consents
View on PostmanGet all consents accepted or rejected by a customer.
JS
const customerId = 123;
let consents = await Client.API.Core.Customers.getConsents(customerId);TS
import { Response, Consents, Customer } from "@tscommerce/sdk-typescript"
const customerId:Customer['id'] = 123;
Client.API.Core.Customers.getConsents(customerId).then((response:Response<Consents>) => {
response.resource.forEach((consent) => {
console.log(consent.name, consent.accepted);
});
});PHP
$customerId = 123;
$consents = $client->API->Core->Customers->getConsents($customerId);Assign Consents to Customer
View on PostmanRecord consent acceptance for a customer.
JS
const customerId = 123;
const consentIds = [456, 789];
Client.API.Core.Customers.assignConsents(customerId, { consent_ids: consentIds });TS
import { Response, Customer, AssignConsentsToCustomerPayload } from "@tscommerce/sdk-typescript"
const customerId:Customer['id'] = 123;
const payload:AssignConsentsToCustomerPayload = {
consent_ids: [456, 789]
};
Client.API.Core.Customers.assignConsents(customerId, payload).then((response:Response) => {
console.log('Consents assigned successfully');
});PHP
$customerId = 123;
$payload = ['consent_ids' => [456, 789]];
$client->API->Core->Customers->assignConsents($customerId, $payload);