public class Revenue extends Object
RakamClient.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);
productId and price are required fields. If quantity is not
specified, it will default to 1. receipt and receiptSignature are required
if you want to verify the revenue event.
Rakam.getInstance().logRevenueV2(revenue); and pass in
the object.| Modifier and Type | Field and Description |
|---|---|
protected Double |
price
The Price field (required).
|
protected 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 String |
receipt
The Receipt field (required if you want to verify the revenue event).
|
protected String |
receiptSig
The Receipt Signature field (required if you want to verify the revenue event).
|
protected String |
revenueType
The Revenue Type field (optional).
|
static String |
TAG
The class identifier tag used in logging.
|
| Constructor and Description |
|---|
Revenue() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(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(String productId)
Set a value for the product identifier.
|
Revenue |
setQuantity(int quantity)
Set a value for the quantity.
|
Revenue |
setReceipt(String receipt,
String receiptSignature)
Set the receipt and receipt signature.
|
Revenue |
setRevenueType(String revenueType)
Set a value for the revenue type.
|
protected org.json.JSONObject |
toJSONObject()
Converts Revenue object into a JSONObject to send to Rakam servers
|
public static final String TAG
"io.rakam.api.Revenue"protected String productId
protected int quantity
protected Double price
protected String revenueType
protected String receipt
protected String receiptSig
protected org.json.JSONObject properties
protected boolean isValidRevenue()
public Revenue setProductId(String productId)
productId - the product idpublic Revenue setQuantity(int quantity)
quantity - the quantitypublic Revenue setPrice(double price)
price - the pricepublic Revenue setRevenueType(String revenueType)
revenueType - the revenue typepublic Revenue setReceipt(String receipt, String receiptSignature)
receipt - the receiptreceiptSignature - the receipt signaturepublic Revenue setEventProperties(org.json.JSONObject eventProperties)
eventProperties - the event propertiesprotected org.json.JSONObject toJSONObject()
public boolean equals(Object o)
Copyright © 2019. All rights reserved.