.create RC.Server.Account.create
Create new customer account. This is usually used on the Register / Create Account page.
METHOD PARAMETERS
Parameter |
Options |
Type |
Default |
Description |
parameters |
required |
hashmap or POST data |
(none) |
Account registration information. See parameters section below for more information. |
options |
optional |
hashmap |
(none) |
Request options. See the options section below for details |
parameters
Parameter |
Options |
Type |
Default |
Description |
first_name |
required |
string |
(none) |
Customer's first name. |
last_name |
required |
string |
(none) |
Customer's last name. |
email |
required |
string |
(none) |
Customer's email address. |
password |
required |
string |
(none) |
Customer's password. |
password1 |
required |
string |
(none) |
Customer's password re-typed. Must match the password field. |
phone |
optional |
numeric |
(none) |
Customer's phone number. |
phone_mobile |
optional |
numeric |
(none) |
Customer's mobile phone number. |
phone_office |
optional |
numeric |
(none) |
Customer's office phone number. |
phone_home |
optional |
numeric |
(none) |
Customer's home phone number. |
* |
optional |
any |
(none) |
Any other field is saved under the account metadata. |
EXAMPLE
RC.Server.Account.create( $('#sign-in-form').serialize(), {
success: function(context,html,xml) { location.href='/'; },
failure: function(context,errorMsg,xml,XHR) { alert(errorMsg); }
} );
.login RC.Server.Account.login
Sing-in to an account. This is usually used on the Sign-in / Login page.
METHOD PARAMETERS
Parameter |
Options |
Type |
Default |
Description |
parameters |
required |
hashmap or POST data |
(none) |
Sign-in parameters. See parameters section below for more information. |
options |
optional |
hashmap |
(none) |
Request options. See the options section below for details |
parameters
Parameter |
Options |
Type |
Default |
Description |
username |
required |
string |
(none) |
Username to sign-in with. This is usually the Customer's email address as specified on registration. |
password |
required |
string |
(none) |
Customer's password. |
EXAMPLE
RC.Server.Account.login( $('#sign-in-form').serialize(), {
success: function(context,html,xml) { location.href='/'; },
failure: function(context,errorMsg,xml,XHR) { alert(errorMsg); }
} );
.logout RC.Server.Account.logout
Sing-out / Logout from the account. This is usually used behind the Logoff button.
METHOD PARAMETERS
Parameter |
Options |
Type |
Default |
Description |
parameters |
required |
hashmap or POST data |
(none) |
Not used, could be set null or empty hashmap. |
options |
optional |
hashmap |
(none) |
Request options. See the options section below for details |
EXAMPLE
RC.Server.Account.logout( {}, {
success: function(context,html,xml) { location.href='/'; },
failure: function(context,errorMsg,xml,XHR) { alert(errorMsg); }
} );
.passwordReset RC.Server.Account.passwordReset
Executes a password reset request. Subject to valid email address being provided, the user password will be reset and an email with the new password will be sent to the user's email inbox, containing the new auto-generated password. The email template used is account.password.reset
.
METHOD PARAMETERS
Parameter |
Options |
Type |
Default |
Description |
parameters |
required |
hashmap or POST data |
(none) |
Password reset parameters. See parameters section below for more information. |
options |
optional |
hashmap |
(none) |
Request options. See the options section below for details |
parameters
Parameter |
Options |
Type |
Default |
Description |
username |
required |
string |
(none) |
Username of the account to reset the password for. This is usually the Customer's email address as specified on registration. |
EXAMPLE
RC.Server.Account.passwordReset( $('#password-reset-form').serialize(), {
success: function(context,html,xml) { alert('Password reset successfully!'); },
failure: function(context,errorMsg,xml,XHR) { alert(errorMsg); }
} );
.passwordChange RC.Server.Account.passwordChange
Update user's password. Usually used on the Change Password screen, under My Account.
METHOD PARAMETERS
Parameter |
Options |
Type |
Default |
Description |
parameters |
required |
hashmap or POST data |
(none) |
Password change parameters. See parameters section below for more information. |
options |
optional |
hashmap |
(none) |
Request options. See the options section below for details |
parameters
Parameter |
Options |
Type |
Default |
Description |
current_password |
required |
string |
(none) |
Customer's current password. |
new_password |
required |
string |
(none) |
Customer's new password. |
new_password_confirm |
required |
string |
(none) |
Customer's password re-typed. Must match the new_password field. |
EXAMPLE
RC.Server.Account.passwordChange( $('#password-change-form').serialize(), {
success: function(context,html,xml) { alert('Password updated successfully!'); },
failure: function(context,errorMsg,xml,XHR) { alert(errorMsg); }
} );
.subscribe RC.Server.Account.subscribe
Add subscription of particular type, either agains the user account or against the user email address.
METHOD PARAMETERS
Parameter |
Options |
Type |
Default |
Description |
parameters |
required |
hashmap or POST data |
(none) |
Subscription parameters. See parameters section below for more information. |
options |
optional |
hashmap |
(none) |
Request options. See the options section below for details |
parameters
Parameter |
Options |
Type |
Default |
Description |
name |
optional |
string |
(none) |
Name of the subscriber. If no name is supplied, and the customer has signed in, the name from the customer profile is used. |
email |
required 1 |
string |
(none) |
Customer's email address for the subscription. |
type |
required |
string |
(none) |
Subscription type. This should normally be a hidden field (not a customer input). Examples are newsletter or new-arrivals. The type is used to indicating the specific type of subscription. Customer could have multiple subscriptions for different things, managed independently. |
- 1 The email address is only required if the customer is not signed in. If he or she is signed in, then the email address can be omitted and the one from the customer's account will be used instead.
EXAMPLE
RC.Server.Account.subscribe( $('#subscribe-form').serialize(), {
success: function(context,html,xml) { alert('Subscribed successfully!'); },
failure: function(context,errorMsg,xml,XHR) { alert(errorMsg); }
} );
.unsubscribe RC.Server.Account.unsubscribe
Removes previously added subscription.
METHOD PARAMETERS
Parameter |
Options |
Type |
Default |
Description |
parameters |
required |
hashmap or POST data |
(none) |
Unsubscription parameters. See parameters section below for more information. |
options |
optional |
hashmap |
(none) |
Request options. See the options section below for details |
parameters
Parameter |
Options |
Type |
Default |
Description |
id |
required |
numeric |
(none) |
Subscription id to remove. |
EXAMPLE
RC.Server.Account.unsubscribe( { id: 1234 }, {
success: function(context,html,xml) { alert('Unsubscribed successfully!'); },
failure: function(context,errorMsg,xml,XHR) { alert(errorMsg); }
} );
.update RC.Server.Account.update
Updates user's name nad contact details.
METHOD PARAMETERS
Parameter |
Options |
Type |
Default |
Description |
parameters |
required |
hashmap or POST data |
(none) |
Contact details to update. See parameters section below for more information. |
options |
optional |
hashmap |
(none) |
Request options. See the options section below for details |
parameters
Parameter |
Options |
Type |
Default |
Description |
contact_first_name |
optional |
string |
(none) |
Customer's first name. Only validated and updated if present in the request parameters, ignored otherwise. |
contact_last_name |
optional |
string |
(none) |
Customer's last name. Only validated and updated if present in the request parameters, ignored otherwise. |
contact_email |
optional |
string |
(none) |
Customer's email address. Only validated and updated if present in the request parameters, ignored otherwise. |
contact_phone |
optional |
numeric |
(none) |
Customer's phone number. Only validated and updated if present in the request parameters, ignored otherwise. |
contact_phone_mobile |
optional |
numeric |
(none) |
Customer's mobile phone number. Only validated and updated if present in the request parameters, ignored otherwise. |
contact_phone_office |
optional |
numeric |
(none) |
Customer's office phone number. Only validated and updated if present in the request parameters, ignored otherwise. |
contact_phone_home |
optional |
numeric |
(none) |
Customer's home phone number. Only validated and updated if present in the request parameters, ignored otherwise. |
metafields |
optional |
any |
(none) |
Comma-separated list of metafield names to update. Each metafield must be supplied as a separate request parameter, if add or update behaviour is desired, and must be ommitted from the parameters (note that setting to blank / empty string is not the same) in order to be removed, if exists. |
* |
optional |
any |
(none) |
Metafield to be added or updated. Only considered if the name of the metafield is mentioned in the metafields parameter (see above). |
EXAMPLE
RC.Server.Account.update( $('#account-update-form').serialize(), {
success: function(context,html,xml) { alert('Account contact details updated successfully!'); },
failure: function(context,errorMsg,xml,XHR) { alert(errorMsg); }
} );
.add RC.Server.Account.Address.add
Adds new address to the customer account.
METHOD PARAMETERS
Parameter |
Options |
Type |
Default |
Description |
parameters |
required |
hashmap or POST data |
(none) |
Not used, could be set null or empty hashmap. |
options |
required |
hashmap |
(none) |
Request options. See the options section below for details |
options
Parameter |
Options |
Type |
Default |
Description |
post |
required |
hashmap or POST data |
(none) |
Address details. See post section below for more information. |
success |
optional |
function |
(none) |
Default success handler. |
failure |
optional |
function |
(none) |
Default failure handler. |
post
Parameter |
Options |
Type |
Default |
Description |
name |
optional |
string |
(none) |
Address display name. |
use |
optional |
string |
(none) |
Address use, typically this will either be shipping or billing. |
line1 |
optional |
string |
(none) |
Address first line. |
line2 |
optional |
string |
(none) |
Address second line. |
line3 |
optional |
string |
(none) |
Address third line. |
city |
optional |
string |
(none) |
Address city. |
region |
optional |
string |
(none) |
Address region. |
code |
optional |
string |
(none) |
Address postal code. |
country_code |
optional |
string |
(none) |
Address country code. This is an 2-character ISO 3166-1 alpha-2 code. |
EXAMPLE
RC.Server.Account.Address.add( {}, {
post: $('#address-add-form').serialize(),
success: function(orderId) { alert('Address updated successfully!'); },
failure: function(context,errorMsg,xml,XHR) { alert(errorMsg); }
} );
.update RC.Server.Account.Address.update
Updates an existing address.
METHOD PARAMETERS
Parameter |
Options |
Type |
Default |
Description |
parameters |
required |
hashmap or POST data |
(none) |
Address update parameters. See parameters section below for more information. |
options |
optional |
hashmap |
(none) |
Request options. See the options section below for details |
parameters
Parameter |
Options |
Type |
Default |
Description |
addressId |
required |
numeric |
(none) |
Address id of the address to be updated. This is normally output by the {{ address.id }} template fragment, where address is an address object. |
options
Parameter |
Options |
Type |
Default |
Description |
post |
required |
hashmap or POST data |
(none) |
Address details. See post section below for more information. |
success |
optional |
function |
(none) |
Default success handler. |
failure |
optional |
function |
(none) |
Default failure handler. |
post
Parameter |
Options |
Type |
Default |
Description |
name |
optional |
string |
(none) |
Address display name. |
use |
optional |
string |
(none) |
Address use, typically this will either be shipping or billing. |
line1 |
optional |
string |
(none) |
Address first line. |
line2 |
optional |
string |
(none) |
Address second line. |
line3 |
optional |
string |
(none) |
Address third line. |
city |
optional |
string |
(none) |
Address city. |
region |
optional |
string |
(none) |
Address region. |
code |
optional |
string |
(none) |
Address postal code. |
country_code |
optional |
string |
(none) |
Address country code. This is an 2-character ISO 3166-1 alpha-2 code. |
EXAMPLE
RC.Server.Account.Address.update( { addressId: {{ address.id }} }, {
post: $('#address-update-form').serialize(),
success: function(orderId) { alert('Address updated successfully!'); },
failure: function(context,errorMsg,xml,XHR) { alert(errorMsg); }
} );
.remove RC.Server.Account.Address.remove
Remove an existing address.
METHOD PARAMETERS
Parameter |
Options |
Type |
Default |
Description |
parameters |
required |
hashmap or POST data |
(none) |
Address removal parameters. See parameters section below for more information. |
options |
optional |
hashmap |
(none) |
Request options. See the options section below for details |
parameters
Parameter |
Options |
Type |
Default |
Description |
addressId |
required |
numeric |
(none) |
Address id of the address to be removed. This is normally output by the {{ address.id }} template fragment, where address is an address object. |
EXAMPLE
RC.Server.Account.Address.remove( { addressId: {{ address.id }} }, {
success: function(orderId) { alert('Address removed successfully!'); },
failure: function(context,errorMsg,xml,XHR) { alert(errorMsg); }
} );