Class Purchase
-
- All Implemented Interfaces:
public final class Purchase
A purchase to log to the platform.
-
-
Field Summary
Fields Modifier and Type Field Description private final ArrayList<PurchaseItem>
purchaseItems
private final ArrayList<PurchaseAdjustment>
purchaseAdjustments
private JSONObject
vars
private final Boolean
incomplete
private String
messageId
-
Method Summary
Modifier and Type Method Description final ArrayList<PurchaseItem>
getPurchaseItems()
Array of PurchaseItems being purchased. final ArrayList<PurchaseAdjustment>
getPurchaseAdjustments()
Array of PurchaseAdjustments being applied to the purchase. final JSONObject
getVars()
Any number of custom variables to attach to the order. final Unit
setVars(JSONObject vars)
Any number of custom variables to attach to the order. final Boolean
getIncomplete()
Whether the purchase is incomplete. final String
getMessageId()
Set the message ID associated with the purchase. final Unit
setMessageId(String messageId)
Set the message ID associated with the purchase. final Unit
addVar(String key, Object value)
Add a custom key value pair to the purchase item. Boolean
equals(Object other)
Integer
hashCode()
String
toString()
final JSONObject
toJSON()
Converts Purchase to JSON. -
-
Constructor Detail
-
Purchase
Purchase(ArrayList<?> purchaseItems)
-
-
Method Detail
-
getPurchaseItems
final ArrayList<PurchaseItem> getPurchaseItems()
Array of PurchaseItems being purchased.
-
getPurchaseAdjustments
final ArrayList<PurchaseAdjustment> getPurchaseAdjustments()
Array of PurchaseAdjustments being applied to the purchase.
-
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.
-
getIncomplete
final Boolean getIncomplete()
Whether the purchase is incomplete.
-
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 keyvalue
- the custom value
-
toJSON
final JSONObject toJSON()
Converts Purchase to JSON.
- Returns:
JSON representation of a Purchase
-
-
-
-