Customer Methods
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 to Customer Methods | Back to Shopping Objects
addCreditCard(creditcard)
Adds a credit card for current customer.
This method is not compatible with SuiteCommerce 2019.1 if the Payments Instruments feature is enabled. SuiteScript methods should be used instead.
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 to Customer Methods | Back to Shopping 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 to Customer Methods | Back to Shopping 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 to Customer Methods | Back to Shopping 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 to Customer Methods | Back to Shopping 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 to Customer Methods | Back to Shopping 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 to Customer Methods | Back to Shopping Objects
getCreditCard(creditcardid, fields)
Gets credit card with given ID for current customer.
This method is not compatible with SuiteCommerce 2019.1 if the Payments Instruments feature is enabled. SuiteScript methods should be used instead.
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 to Customer Methods | Back to Shopping Objects
getCreditCards(fields)
Gets all credit cards for current customer.
This method is not compatible with SuiteCommerce 2019.1 if the Payments Instruments feature is enabled. SuiteScript methods should be used instead.
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 to Customer Methods | Back to Shopping Objects
getCustomerSegments()
Gets all customer segments to which the current customer belongs.
Parameters
No parameters to set.
Returns
Array of objects with the field:
-
id
{number}
Supported Domains
Shopping, Checkout
Login Required?
No
Back to Customer Methods | Back to Shopping 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 to Customer Methods | Back to Shopping 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 to Customer Methods | Back to Shopping 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 to Customer Methods | Back to Shopping 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 to Customer Methods | Back to Shopping 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 to Customer Methods | Back to Shopping Objects
removeCreditCard(creditcardid)
Removes given credit card from current customer.
This method is not compatible with SuiteCommerce 2019.1 if the Payments Instruments feature is enabled. SuiteScript methods should be used instead.
Parameters
-
creditcardid
[required] {string}
Websites on SuiteCommerce versions earlier than 2019.1 must have a patch applied to be compatible with the Payments Instruments feature. See <link to patch documentation>. If the correct patch has been applied, the Payment Instruments feature is enabled, and the credit card has been tokenized, the creditcardid
parameter should contain the numerical ID of the payment token.
Returns
No value returned.
Supported Domains
Checkout
Login Required?
Yes
Back to Customer Methods | Back to Shopping 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 to Customer Methods | Back to Shopping 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 to Customer Methods | Back to Shopping 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 to Customer Methods | Back to Shopping Objects
updateCreditCard(creditcard)
Updates given credit card for current customer.
This method is not compatible with SuiteCommerce 2019.1 if the Payments Instruments feature is enabled.
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]
-
If given ccnumber
does not match an existing record, internalid
is ignored and a new credit card record is added for customer.
Returns
String -key of added or updated credit card.
Supported Domains
Checkout
Login Required?
Yes
Back to Customer Methods | Back to Shopping 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} } -
cookieoptions
[optional]{Object with {cookie approval type : boolean value} }
-
Returns
No value returned.
Supported Domains
Checkout
Login Required?
Yes