Customer
Profile & Addresses
Customer profile management and address book
Profile
Get Profile
const profile = await client.customer.getProfile();
// { id, email, firstName, lastName, phone }Update Profile
const updated = await client.customer.updateProfile({
firstName: 'Jan',
lastName: 'Novak',
phone: '+420123456789',
});Change Password
await client.customer.changePassword('oldPassword', 'newPassword');Addresses
List
const { items } = await client.customer.getAddresses();Create
const address = await client.customer.createAddress({
firstName: 'Jan',
lastName: 'Novak',
street: 'Vodickova 12',
city: 'Praha',
zip: '11000',
country: 'CZ',
isDefault: true,
});Update
const updated = await client.customer.updateAddress('address-id', {
street: 'Na Prikope 5',
});Company details and VAT ID
An address can carry companyId, vatId and state. EU VAT IDs are verified
in VIES when the address is saved; the server returns vatIdValid (true,
false, or null when there is no EU VAT ID) and vatIdCheckedAt. Both are
read-only. A changed vatId or country re-runs the check.
const { data } = await client.customer.createAddress({
type: 'BILLING',
isDefault: true,
firstName: 'Jana',
lastName: 'Nováková',
company: 'Nováková s.r.o.',
companyId: '12345678',
vatId: 'SK2020000000',
street: 'Hlavná 1',
city: 'Bratislava',
zip: '811 01',
country: 'SK',
});
data.vatIdValid; // true when VIES confirmed itPrefill checkout from the default address and hand the VAT ID to the cart so the summary shows reverse charge before the customer types anything:
await client.cart.setDestination({ country: address.country, vatId: address.vatId ?? null });updateAddress is partial: { isDefault: true } alone is a valid body. A key
set to null clears the value ({ companyId: null } removes the company ID),
a missing key leaves it unchanged. The address you read from the API can be
sent back as it is, nulls included (SDK 2.14.0).
Delete
await client.customer.deleteAddress('address-id');