Set billing address for customer in storefront

You can use it to specify some address from your custom form on your website. If you specify some fields only (name, for example), then Ecwid will apply the changed fields only, leaving preset ones as they were before.

When function is called, Ecwid will set the 'My shipping address is the same as the billing address' flag to false automatically. Full function call example:

  "name": "John Carmichael",
  "companyName": "Cool Slippers",
  "street": "5th Ave",
  "city": "New York",
  "countryName": "United States",
  "postalCode": "10002",
  "stateOrProvinceCode": "NY",
  "phone": "+1 234 523 11 42"
   console.log('Address successfully set')
   console.log('Error setting the address');

Subscribe to the Ecwid.OnAPILoaded JS API event to ensure availability of this function.


address<Person>Customer's billing address details
successCallbackfunctionSuccess callback function
errorCallbackfunctionError callback function

Person fields:

namestringCustomer's name
companyNamestringCustomer's company name
streetstringCustomer's street address. Use \n to place text in Address Line 2
citystringCustomer's city
countryNamestringCustomer's country name. countryCode can be used instead
countryCodestringCustomer's country code. countryName can be used instead
postalCodestringCustomer's zip code
stateOrProvinceCodestringCustomer's state or provice code
phonestringCustomer's phone number


Parameters in bold are mandatory

errorCallback structure is: errorCallback(errCode, errMsg)

errCodenumberError code
errMsgstringError message


Error codeError message
0Missing argument