public class Revenue
extends java.lang.Object
AmplitudeClient.logRevenueV2() to record in-app transactions.
Each set method returns the same Revenue object, allowing
you to chain multiple set calls together, for example:
Revenue revenue = new Revenue().setProductId("com.product.id").setPrice(3.99);
price is a required field. If quantity is not
specified, it will default to 1. productId, receipt and receiptSignature
re required if you want to verify the revenue event.
Amplitude.getInstance().logRevenueV2(revenue); and pass in
the object.| Modifier and Type | Field and Description |
|---|---|
protected java.lang.Double |
price
The Price field (required).
|
protected java.lang.String |
productId
The Product ID field.
|
protected org.json.JSONObject |
properties
The Revenue Event Properties field (optional).
|
protected int |
quantity
The Quantity field (defaults to 1).
|
protected java.lang.String |
receipt
The Receipt field (required if you want to verify the revenue event).
|
protected java.lang.String |
receiptSig
The Receipt Signature field (required if you want to verify the revenue event).
|
protected java.lang.String |
revenueType
The Revenue Type field (optional).
|
static java.lang.String |
TAG
The class identifier tag used in logging.
|
| Constructor and Description |
|---|
Revenue() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object o)
Custom equals function to compare 2 revenue objects.
|
int |
hashCode()
Custom hashcode generator function for Revenue object.
|
protected boolean |
isValidRevenue()
Verifies that revenue object is valid and contains the required fields
|
Revenue |
setEventProperties(org.json.JSONObject eventProperties)
Set event properties for the revenue event, like you would for an event during logEvent.
|
Revenue |
setPrice(double price)
Set a value for the price.
|
Revenue |
setProductId(java.lang.String productId)
Set a value for the product identifier.
|
Revenue |
setQuantity(int quantity)
Set a value for the quantity.
|
Revenue |
setReceipt(java.lang.String receipt,
java.lang.String receiptSignature)
Set the receipt and receipt signature.
|
Revenue |
setRevenueProperties(org.json.JSONObject revenueProperties)
Deprecated.
- use
Revenue.setEventProperties() instead |
Revenue |
setRevenueType(java.lang.String revenueType)
Set a value for the revenue type.
|
protected org.json.JSONObject |
toJSONObject()
Converts Revenue object into a JSONObject to send to Amplitude servers
|
public static final java.lang.String TAG
"com.amplitude.api.Revenue"protected java.lang.String productId
protected int quantity
protected java.lang.Double price
protected java.lang.String revenueType
protected java.lang.String receipt
protected java.lang.String receiptSig
protected org.json.JSONObject properties
protected boolean isValidRevenue()
public Revenue setProductId(java.lang.String productId)
productId - the product idpublic Revenue setQuantity(int quantity)
quantity - the quantitypublic Revenue setPrice(double price)
price - the pricepublic Revenue setRevenueType(java.lang.String revenueType)
revenueType - the revenue typepublic Revenue setReceipt(java.lang.String receipt, java.lang.String receiptSignature)
receipt - the receiptreceiptSignature - the receipt signaturepublic Revenue setRevenueProperties(org.json.JSONObject revenueProperties)
Revenue.setEventProperties() insteadrevenueProperties - the revenue propertiespublic Revenue setEventProperties(org.json.JSONObject eventProperties)
eventProperties - the event propertiesprotected org.json.JSONObject toJSONObject()
public boolean equals(java.lang.Object o)
equals in class java.lang.Objecto - the other object to compare topublic int hashCode()
hashCode in class java.lang.Object