public class Revenue
extends java.lang.Object
The class to store revenue data.

It enables revenue tracking from in-app purchases and other purchases in your application.

The Revenue object should be passed to the AppMetrica server by using the YandexMetrica.reportRevenue(Revenue) method.

Revenue events are displayed in the AppMetrica Revenue report.

Nested Class Summary

Nested Classes
Modifier and TypeClass and Description
static class Revenue.Builder
Builder class for Revenue objects.
static class Revenue.Receipt
The class to store in-app purchases data.

Field Summary

Fields
Modifier and TypeField and Description
java.util.Currencycurrency
Currency of the purchase.
java.lang.Stringpayload
Additional information to be passed about the purchase.
java.lang.Doubleprice
Deprecated.
Use priceMicros instead.
java.lang.LongpriceMicros
Price of the products purchased in micros (price * 10^6).
java.lang.StringproductID
ID of the product purchased.
java.lang.Integerquantity
Quantity of products purchased.
Revenue.Receiptreceipt
Information about the in-app purchase order from Google Play.

Method Summary

All Methods
Static Methods
Concrete Methods
Deprecated Methods
Modifier and TypeMethod and Description
static Revenue.BuildernewBuilder(double price, java.util.Currency currency)
Deprecated.
static Revenue.BuildernewBuilderWithMicros(long priceMicros, java.util.Currency currency)
Creates the new instance of Revenue.Builder.

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

price

@Deprecated
 @Nullable
public final java.lang.Double price
Deprecated. Use priceMicros instead.
Price of the products purchased.

It can be negative, e.g. for refunds.

EXAMPLE: 0.99

priceMicros

@Nullable
public final java.lang.Long priceMicros
Price of the products purchased in micros (price * 10^6).

It can be negative, e.g. for refunds.

EXAMPLE: 990000 (equivalent to 0.99 in real currency)

currency

@NonNull
public final java.util.Currency currency
Currency of the purchase.

quantity

@Nullable
public final java.lang.Integer quantity
Quantity of products purchased.

The value cannot be negative. If the value is less than 0, the purchase is ignored.

NOTE: Revenue = quantity * price.
See Also:
Revenue.Builder.withQuantity(Integer)

productID

@Nullable
public final java.lang.String productID
ID of the product purchased.

EXAMPLE: com.yandex.service.299

NOTE: The string value can contain up to 200 characters.
See Also:
Revenue.Builder.withProductID(String)

payload

@Nullable
public final java.lang.String payload
Additional information to be passed about the purchase.

It should contain the valid JSON string.

For instance, it can be used for categorizing your products.

NOTE: The maximum size of the value is 30 KB.
See Also:
Revenue.Builder.withPayload(String)

receipt

@Nullable
public final Revenue.Receipt receipt
Information about the in-app purchase order from Google Play.
See Also:
Revenue.Receipt, Revenue.Builder.withReceipt(com.yandex.metrica.Revenue.Receipt)

Method Detail

newBuilder

@Deprecated
 @NonNull
public static Revenue.Builder newBuilder(double price,
                                                               @NonNull
                                                               java.util.Currency currency)
Deprecated. Use newBuilderWithMicros(long, Currency) instead.
Creates the new instance of Revenue.Builder.
Parameters:
price - Price of the products purchased
currency - Currency of the purchase
Returns:
The Revenue.Builder object
See Also:
price, currency

newBuilderWithMicros

@NonNull
public static Revenue.Builder newBuilderWithMicros(long priceMicros,
                                                            @NonNull
                                                            java.util.Currency currency)
Creates the new instance of Revenue.Builder.
Parameters:
priceMicros - Price of the products purchased in micros (price * 10^6)
currency - Currency of the purchase
Returns:
The Revenue.Builder object
See Also:
priceMicros, currency