String Validation

The Monetate JavaScript API allows you to pass data from your site to the Monetate platform.

All data that you pass to Monetate through the methods included in this API must be in the form of a string. Passing an integer instead of a string or omitting quotation marks around a string ("string") results in an error.

All strings passed to Monetate need to be in a valid format. These strings are listed below. The API references the following types:

  • string is a JavaScript typeof string that cannot be empty.
  • idString is a string with no spaces.
  • pidString is an idString with no more than 50 characters.
  • quantityString is an idString composed only of numerals. The number must be greater than zero and less than one billion.
  • priceString is an idString made up of any number of numerals followed by an optional period and by one or two optional numerals.
  • currencyString is an idString that must adhere to the ISO 4217 format of three capital letters and no spaces.