Class PurchaseItem

  • All Implemented Interfaces:

    
    public final class PurchaseItem
    
                        

    An item being purchased.

    • Method Detail

      • getPrice

         final Integer getPrice()

        Price of one item, in cents (e.g. $10.99 is 1099).

      • getID

         final String getID()

        Your unique identifier (for example, SKU) for the item.

      • getTitle

         final String getTitle()

        Short user-readable name/title of the item purchased.

      • getUrl

         final URI getUrl()

        The URL of the item. Note: The domain and scheme are case sensitive but paths are not. For example, if the stored URL is https://sailthru.com/Product, then Https://Sailthru.com/product would fail to match the product, but https://sailthru.com/product would.

      • getVars

         final JSONObject getVars()

        Vars can be any number of custom fields and values to attach to each item for later retrieval in templates or use in Audience Builder or Lifecycle Optimizer. For example, you may want to specify item attributes such as color, size, material, or an item-specific coupon code that was used.

      • setVars

         final Unit setVars(JSONObject vars)

        Vars can be any number of custom fields and values to attach to each item for later retrieval in templates or use in Audience Builder or Lifecycle Optimizer. For example, you may want to specify item attributes such as color, size, material, or an item-specific coupon code that was used.

      • getImages

         final JSONObject getImages()

        Set a map of image types full and/or thumb to objects specifying the URL for each image. Use the name “full” to denote the full-sized image, and “thumb” to denote the thumbnail-sized image. For example, the value of images might be: { “full” : { “url” : “http://example.com/f.jpg” }, “thumb” : { “url” : “http://example.com/t.jpg” } } This allows you to easily include product images when messaging users with order confirmations and abandoned-cart reminders.

      • setImages

         final Unit setImages(JSONObject images)

        Set a map of image types full and/or thumb to objects specifying the URL for each image. Use the name “full” to denote the full-sized image, and “thumb” to denote the thumbnail-sized image. For example, the value of images might be: { “full” : { “url” : “http://example.com/f.jpg” }, “thumb” : { “url” : “http://example.com/t.jpg” } } This allows you to easily include product images when messaging users with order confirmations and abandoned-cart reminders.

      • addTag

         final Unit addTag(String tag)

        Add a tag to the purchase item.

        Parameters:
        tag - the tag to add.
      • addVar

         final Unit addVar(String key, Object value)

        Add a custom key value pair to the purchase item.

        Parameters:
        key - the custom value key
        value - the custom value
      • setFullImageUrl

         final Unit setFullImageUrl(URI url)

        Sets the URL string to use for the full item image.

        Parameters:
        url - the URL containing the full image.
      • setThumbImageUrl

         final Unit setThumbImageUrl(URI url)

        Sets the URL string to use for the thumb item image.

        Parameters:
        url - the URL containing the thumb image.
      • toJSON

         final JSONObject toJSON()

        Converts PurchaseItem to JSON.

        Returns:

        JSON representation of a Purchase Item