Customer Methods

This topic applies to

Applies to

SuiteCommerce Web Stores

A customer object holds data for the logged in customer. This object is different from a NetSuite customer record, because it holds information for the given shopping session only.

The following Customer methods are available:

addAddress(address)

Adds an address for current customer.

Parameters
  • address [required] {Object with values for fields}

    • addressee [required]

    • addr1 [required]

    • addr2 [optional]

    • addr3 [optional]

    • city [required]

    • state [required]

    • country [required]

    • zip [required]

    • phone [optional]

    • isresidential [optional]

    • defaultshipping [optional]

    • defaultbilling [optional]

Returns

String - key of added address.

Supported Domains

Checkout

Login Required?

Yes

Back toCustomer Methods | Back toShopping Objects

addCreditCard(creditcard)

Adds a credit card for current customer.

Parameters
  • creditcard [required] {Object with values for fields}

    • ccnumber [required]

    • ccname [required]

    • authcode [optional]

    • customercode [optional]

    • paymentmethod [required] (numerical ID for credit card type in NetSuite)

    • expmonth [required]

    • expyear [required]

    • validfrommon [required for UK]

    • validfromyear [required for UK]

    • debtcardissueno [required for UK]

    • ccdefault [optional]

Returns

String - key of added credit card.

Supported Domains

Checkout

Login Required?

Yes

Back toCustomer Methods | Back toShopping Objects

emailCustomer(subject, body)

Sends email to current customer with given subject and body.

Parameters
  • subject [required] {String}

  • body [required] {String}

Returns

No value returned.

Supported Domains

Checkout

Login Required?

Yes

Back toCustomer Methods | Back toShopping Objects

getAddress(addressid, fields)

Gets address with given ID for current customer.

Parameters
  • addressid [required] {string}

  • fields [optional] Array of field names to be included in returned JSON object; if omitted, all supported fields are returned}

Returns

Object of type address.

Supported Domains

Checkout

Login Required?

Yes

Back toCustomer Methods | Back toShopping Objects

getAddressBook(fields)

Gets all addresses for current customer

Parameters
  • fields [optional] Array of field names to be included in returned JSON object; if omitted, all supported fields are returned}

Returns

Array of objects of type address.

Supported Domains

Checkout

Login Required?

Yes

Back toCustomer Methods | Back toShopping Objects

getCampaignSubscriptions(fields)

Gets subscription information for the current customer

Parameters
  • fields [optional] Array of field names to be included in returned JSON object; if omitted, all supported fields are returned}

Returns

Array of objects of type subscriptions.

Supported Domains

Checkout, Shopping

Login Required?

Yes

Back toCustomer Methods | Back toShopping Objects

getCampaignSubscriptions(subscriptionId,fields)

Gets data for a single campaign subscription with passed id.

Parameters
  • subscriptionId [required] {String}

  • fields [optional] Array of field names to be included in returned JSON object; if omitted, all supported fields are returned

Returns

Array of objects of type subscriptions

Supported Domains

Checkout, Shopping

Login Required?

Yes

Back toCustomer Methods | Back toShopping Objects

getCreditCard(creditcardid, fields)

Gets credit card with given ID for current customer.

Parameters
  • creditcard [required] {Object with values for fields}

    • internalid [required]

    • ccnumber [required]

    • ccname [required]

    • authcode [optional]

    • customercode [optional]

    • paymentmethod [required]

    • expmonth [required]

    • expyear [required]

    • validfrommon [required for UK]

    • validfromyear [required for UK]

    • debtcardissueno [required for UK]

    • ccdefault [optional]

Returns

Object of type creditcard.

Supported Domains

Checkout

Login Required?

Yes

Back toCustomer Methods | Back toShopping Objects

getCreditCards(fields)

Gets all credit cards for current customer.

Parameters
  • customer [required] {Object with values for fields}

    • internalid [required]

    • email [optional]

    • emailsubscribe [optional]

    • firstname [optional]

    • lastname [optional]

    • middlename [optional]

    • phoneinfo [optional]

    • customfields [optional] {Object with {customfield id : customfield value} }

Returns

Array of objects of type creditcard.

Supported Domains

Checkout

Login Required?

Yes

Back toCustomer Methods | Back toShopping Objects

getCustomFields()

Gets custom fields on customer record for current customer.

Parameters

No parameters to set.

Returns

Object with custom field names.

Supported Domains

Checkout, Shopping

Login Required?

No

Back toCustomer Methods | Back toShopping Objects

getCustomFieldValues()

Gets custom field values on customer record for current customer.

Parameters

No parameters to set.

Returns

Object with custom field values. Multiple field values are separated by the Unicode character 'ENQUIRY' ("\u0005").

Supported Domains

Checkout, Shopping

Login Required?

Yes

Back toCustomer Methods | Back toShopping Objects

getFieldValues(fields)

Gets standard field values on customer record for current customer.

Parameters
  • fields [optional] Array of field names to be included in returned JSON object; if omitted, all supported fields are returned}

Returns

Object of type customer.

Supported Domains

Checkout

Login Required?

Yes

Back toCustomer Methods | Back toShopping Objects

isGuest()

Checks whether the shopper is logged in as a guest. Returns False when the shopper is not logged in or is logged in as a customer.

Parameters

No parameters to set.

Returns

Boolean

Supported Domains

Checkout, Shopping

Login Required?

No

Back toCustomer Methods | Back toShopping Objects

removeAddress(addressid)

Removes address with given ID from current customer's list of addresses.

Parameters
  • addressid [required] {string}

Returns

No value returned.

Supported Domains

Checkout

Login Required?

Yes

Back toCustomer Methods | Back toShopping Objects

removeCreditCard(creditcardid)

Removes given credit card from current customer.

Parameters
  • creditcardid [required] {string}

Returns

No value returned.

Supported Domains

Checkout

Login Required?

Yes

Back toCustomer Methods | Back toShopping Objects

setLoginCredentials(customer)

Sets login credentials for current guest customer.

Parameters
  • customer [required] {Object with values for fields}

    • internalid [required]

    • email [required]

    • password [required]

    • customfields [Optional] {Object with {customfield id : customfield value} }

Returns

No value returned.

Supported Domains

Checkout

Login Required?

Yes

Back toCustomer Methods | Back toShopping Objects

updateAddress(address)

Updates a specified address.

Parameters
  • address [required] {Object with values for fields}

    • internalid [required]

    • addressee [required]

    • addr1 [required]

    • addr2 [optional]

    • addr3 [optional]

    • city [required]

    • state [required]

    • country [required]

    • zip [required]

    • phone [optional]

    • isresidential [optional]

    • defaultshipping [optional]

    • defaultbilling [optional]

Returns

No value returned.

Supported Domains

Checkout

Login Required?

Yes

Back toCustomer Methods | Back toShopping Objects

updateCampaignSubscriptions(subscriptions)

Updates a specified campaign subscription.

Parameters
  • subscriptions [required] {Object with values for fields}

    • internalid [required]

    • subscribed [required]

      Customer can only opt-in or opt-out of an email campaign category by setting subscribed to ‘T' or ‘F'.

Returns

No value returned.

Supported Domains

Checkout, Shopping

Login Required?

Yes

Back toCustomer Methods | Back toShopping Objects

updateCreditCard(creditcard)

Updates given credit card for current customer.

Note

If given ccnumber does not match an existing record, internalid is ignored and a new credit card record is added for customer.


Parameters
  • creditcard [required] {Object with values for fields}

    • internalid [required]

    • ccnumber [required]

    • ccname [required]

    • authcode [optional]

    • customercode [optional]

    • paymentmethod [required]

    • expmonth [required]

    • expyear [required]

    • validfrommon [required for UK]

    • validfromyear [required for UK]

    • debtcardissueno [required for UK]

    • ccdefault [optional]

Returns

String - key of added or updated credit card.

Supported Domains

Checkout

Login Required?

Yes

Back toCustomer Methods | Back toShopping Objects

updateProfile(customer)

Updates profile of current customer.

Parameters
  • customer [required] {Object with values for fields}

    • internalid [required]

    • email [optional]

    • emailsubscribe [optional]

    • firstname [optional]

    • lastname [optional]

    • middlename [optional]

    • phoneinfo [optional]

    • customfields [optional]{Object with {customfield id : customfield value} }

Returns

No value returned.

Supported Domains

Checkout

Login Required?

Yes