Class Purchase

  • All Implemented Interfaces:

    
    public final class Purchase
    
                        

    A purchase to log to the platform.

    • Constructor Detail

      • Purchase

        Purchase(ArrayList<?> purchaseItems)
    • Method Detail

      • getVars

         final JSONObject getVars()

        Any number of custom variables to attach to the order. These are commonly used with the Audience Builder “Purchase Order Var Is” query. For example, you could specify the shipping address, estimated delivery date given, credit card type used, whether a deal was used, the promo code used, etc. Note that a vars object may also exist at the item level. See the example code, and the items definition in this table.You may use any custom order variable name(s). Note that the following variable name is reserved at the order level, for a particular purpose: st_cost – The client’s cost for the items in the purchase, in cents. The value should be an integer, and is recommended if you are using Retention Analytics in order to report net revenue.

      • setVars

         final Unit setVars(JSONObject vars)

        Any number of custom variables to attach to the order. These are commonly used with the Audience Builder “Purchase Order Var Is” query. For example, you could specify the shipping address, estimated delivery date given, credit card type used, whether a deal was used, the promo code used, etc. Note that a vars object may also exist at the item level. See the example code, and the items definition in this table.You may use any custom order variable name(s). Note that the following variable name is reserved at the order level, for a particular purpose: st_cost – The client’s cost for the items in the purchase, in cents. The value should be an integer, and is recommended if you are using Retention Analytics in order to report net revenue.

      • getMessageId

         final String getMessageId()

        Set the message ID associated with the purchase. This is required to have revenue data matched to email sends in Marigold. Pass the identifying message_id of the email the user is coming from; this will be the value stored in the marigold_bid cookie for your domain.Note: In some client libraries message_id should be passed as a string. The message attribution will be displayed in your Campaign Summary, Transactional Report, Purchase Log, and in Lifecycle Optimizer Metrics.

      • setMessageId

         final Unit setMessageId(String messageId)

        Set the message ID associated with the purchase. This is required to have revenue data matched to email sends in Marigold. Pass the identifying message_id of the email the user is coming from; this will be the value stored in the marigold_bid cookie for your domain.Note: In some client libraries message_id should be passed as a string. The message attribution will be displayed in your Campaign Summary, Transactional Report, Purchase Log, and in Lifecycle Optimizer Metrics.

      • 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
      • toJSON

         final JSONObject toJSON()

        Converts Purchase to JSON.

        Returns:

        JSON representation of a Purchase