.save   RC.Server.Checkout.save

Save supplied checkout details.

METHOD PARAMETERS
Parameter Options Type Default Description
key required string (none) Checkout key, identifying the checkout to save the data to.
parameters required hashmap (none) The checkout details. See the parameters section below for details.
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) Contact person first name
contact_last_name optional string (none) Contact person last name
contact_email optional string (none) Contact person email address
contact_phone_mobile optional numeric (none) Contact person mobile phone number
contact_phone_home optional numeric (none) Contact person home phone number
contact_phone_office optional numeric (none) Contact person office phone number
contact_phone optional numeric (none) Contact person phone number
save_to_account optional string (none) List of fields to save to customer's account. The following field names are allowed:
  • contact_first_name
  • contact_last_name
  • contact_email
  • contact_phone_mobile
  • contact_phone_office
  • contact_phone_home
  • contact_phone
billing_address_use_id optional numeric (none) Billing address ID, as returned by {{ address.id }} where address is one of the billing addresses saved into the customer's account. Providing a valid address ID will result in that address being used (unchanged), and all the remaining billing_address_* fields being ignored.
billing_address_id optional numeric (none) Billing address ID, as returned by {{ address.id }} where address is one of the billing addresses saved into the customer's account. Providing a valid address ID has effect only if billing_address_update is set to update and will result in that address being updated with the supplied billing_address_* fields.
billing_address_name optional string (none) Billing address name to be used when saving the address into the customer's account. This field is only used if billing_address_update is set to add.
billing_address_update optional enum none The update mode for the billing address. This could be one of the following options:
  • none - billing address is not updated
  • add - billing address is added as new address under the customer account. The billing_address_name field must be set.
  • update - billing address is updated in the customer account. The billing_address_id field must be set.
billing_address_line1 optional string (none) Billing address first line.
billing_address_line2 optional string (none) Billing address second line.
billing_address_line3 optional string (none) Billing address third line.
billing_address_city optional string (none) Billing address city.
billing_address_region optional string (none) Billing address region.
billing_address_code optional string (none) Billing address postal code.
billing_address_country_code optional string (none) Billing address country code. This is an 2-character ISO 3166-1 alpha-2 code.
shipping_address_use_id optional numeric (none) Shipping address ID, as returned by {{ address.id }} where address is one of the shipping addresses saved into the customer's account. Providing a valid address ID will result in that address being used (unchanged), and all the remaining shipping_address_* fields being ignored.
shipping_address_id optional numeric (none) Shipping address ID, as returned by {{ address.id }} where address is one of the shipping addresses saved into the customer's account. Providing a valid address ID has effect only if shipping_address_update is set to update and will result in that address being updated with the supplied shipping_address_* fields.
shipping_address_name optional string (none) Shipping address name to be used when saving the address into the customer's account. This field is only used if shipping_address_update is set to add.
shipping_address_update optional enum none The update mode for the shipping address. This could be one of the following options:
  • none - shipping address is not updated
  • add - shipping address is added as new address under the customer account. The shipping_address_name field must be set.
  • update - shipping address is updated in the customer account. The shipping_address_id field must be set.
shipping_address_line1 optional string (none) Shipping address first line.
shipping_address_line2 optional string (none) Shipping address second line.
shipping_address_line3 optional string (none) Shipping address third line.
shipping_address_city optional string (none) Shipping address city.
shipping_address_region optional string (none) Shipping address region.
shipping_address_code optional string (none) Shipping address postal code.
shipping_address_country_code optional string (none) Shipping address country code. This is an 2-character ISO 3166-1 alpha-2 code.
shipping_address_from_billing optional string (none) Shipping address is taken from the billing address. All other shipping address related fields are ignored.
notes optional string (none) Multi-line free text order notes.
shipping_notes optional string (none) Multi-line free text shipping notes.
payment_type optional string (none) Payment type ID for the selected payment type option.
shipping_provider_code optional string (none) Shipping service provider code for the selected shipping option.
shipping_service_code optional string (none) Provider-specific shipping service code for the selected shipping option.
shipping_offer_id optional numeric (none) Shipping offer ID referring to the shipping cost calculations.
payment_account_(currency) optional numeric (none) Payment from an internal cash account. The (currency) placeholder must be replaced by the currency code for one of customer's cash accounts.
service_fees optional string (none) List of service fees whose inclusion indicator has to be checked.
service_fee_(reference) optional string (none) Service fee inclusion indicator. This shall be set to '1' if inclusion of the specific fee is required, and '0' or blank otherwise.
metafields optional string (none) Comma-separated list of metafield names, identifying additional fields to be saved as part of the checkout and consequenty as part of the sales order. The actual name of each metafield listed must be prefixed with metafield_, e.g. if a field named room_no need to be saved, the metafields must be set to room_no and the name of the actial field must be metafield_room_no.
options
Parameter Options Type Default Description
success optional function (none) Default success handler.
failure optional function (none) Default failure handler.
www
EXAMPLE
www
RC.Server.Checkout.save( '{{ checkout.key }}', $('#checkout-details-form').serialize(), { 
	success: function(context,html,xml) { /* ... */ }, 
	failure: function(context,errorMsg,xml,XHR) { alert(errorMsg); } 
} ); 

.saveShippingAddress   RC.Server.Checkout.saveShippingAddress

Save supplied checkout shipping address details. This method is used to update the shipping address before requesting a list of available shipping options. The method is identical to the save method, but it only considers the shipping_address_* fields, and the billing_address_* fields, if the shipping_address_from_billing is set to '1'.

.complete   RC.Server.Checkout.complete

Complete the checkout by placing new sales order. Returns the new sales order reference.

METHOD PARAMETERS
Parameter Options Type Default Description
key required string (none) Checkout key, identifying the checkout to be completed.
parameters optional hashmap (none) Not used, could be set null or empty hashmap.
options optional hashmap (none) Request options. See the options section below for details
options
Parameter Options Type Default Description
success optional function (none) Callback handler for successfully placed order. The callback takes 1 parameter, the order id.
failure optional function (none) Default failure handler.
EXAMPLE
RC.Server.Checkout.complete( '{{ checkout.key }}', {}, { 
	success: function(orderId) { location.href='/account-order/view/'+orderId; }, 
	failure: function(context,errorMsg,xml,XHR) { alert(errorMsg); } 
} );