CustomerClient#listCustomerAddresses(customerId, options);
Customers may wish to store addresses within the system. The following operations allow you to read, update, and delete customer addresses.
Note
|
To operate on the customer’s saved addresses, the customer must be authenticated and their access token must be provide to the function call. |
Parameter | Type | Required? | Description |
---|---|---|---|
|
|
✅ |
Provide a customer id who’s addresses you want to fetch. |
|
❌ |
Options passed to the HTTP request call to customize the request configuration. Including paging related options. |
This function returns a list of CustomerAddresses.
Parameter | Type | Required? | Description |
---|---|---|---|
|
|
✅ |
Provide the customer id which owns the address. |
|
|
✅ |
Provide the customer address id to retrieve. |
|
❌ |
Options passed to the HTTP request call to customize the request configuration. |
This function returns a CustomerAddress.
Parameter | Type | Required? | Description |
---|---|---|---|
|
|
✅ |
Provide the customer id which owns the address. |
|
✅ |
Provide the customer address data to add. |
|
|
❌ |
Options passed to the HTTP request call to customize the request configuration. |
This function returns a CustomerAddress.
const address: CustomerAddress = {
name: 'Home Address',
fullName: 'Customer Full Name',
addressLine1: '123 Street Drive',
city: 'City',
stateProvinceRegion: 'TX'
postalCode: '12345',
defaultBillingAddress: false,
defaultShippingAddress: false,
}
const customerAddress = await customerClient.addCustomerAddress(
'CUSTOMER_ID',
address,
{ accessToken }
);
console.log(customerAddress);
CustomerClient#updateCustomerAddress(customerId, customerAddressId, updatedAddress, options);
Parameter | Type | Required? | Description |
---|---|---|---|
|
|
✅ |
Provide the customer id which owns the address. |
|
|
✅ |
Provide the customer address id to update. |
|
✅ |
Provide the customer address data to update. |
|
|
❌ |
Options passed to the HTTP request call to customize the request configuration. |
This function returns a CustomerAddress.
const updatedAddress: CustomerAddress = {
name: 'Work Address',
fullName: 'Customer Full Name',
addressLine1: '456 Street Drive',
city: 'City',
stateProvinceRegion: 'TX'
postalCode: '54321',
defaultBillingAddress: true,
defaultShippingAddress: false,
}
const customerAddress = await customerClient.updateCustomerAddress(
'CUSTOMER_ID',
'CUSTOMER_ADDRESS_ID',
updatedAddress,
{ accessToken }
);
console.log(customerAddress);