Methods to manage and update account addresses stored on a customer's account.

Use to get a list of addresses on file for the account. These are stored automatically when a non-guest user checks out and chooses to save their information for later.

Returns all addresses, with offset pagination using limit and page.

List addresses
await swell.account.listAddresses()

Use to add a new address to the account.

Returns the newly created address object.

Create an address
await swell.account.createAddress({
  name: 'Julia Sanchez',
  address1: 'Apartment 16B',
  address2: '2602 Pinewood Drive',
  city: 'Jacksonville',
  state: 'FL',
  zip: '32216',
  country: 'US', // Two letter ISO country code
  phone: '904-504-4760'
})

Use to update an existing address from the account by ID.

Returns the updated address object.

Update an address
await swell.account.updateAddress("5c15505200c7d14d851e510f", {
  address1: '06 Bennered Mare',
  city: 'Whiterun',
  state: 'NY',
  zip: '10005',
  country: 'US' // Two letter ISO country code
})

Use to remove an existing address from the account by ID.

Returns the deleted address object.

Delete an address
await swell.account.deleteAddress('5c15505200c7d14d851e510f')