Revenue class

com.yandex.metrica

public class Revenue

The class contains information about the revenue from in-app purchases.

The Revenue instance should be sent to the AppMetrica server using the YandexMetrica.reportRevenue(Revenue revenue) method.

Nested classes

Methods

Revenue.Builder newBuilder (double price, @NonNull Currency currency)

Creates the new instance of Revenue.Builder class to pass the data about revenue.

Attention. Outdated method. Use the newBuilderWithMicros(double priceMicros, @NonNull Currency currency) method instead.
Revenue.Builder newBuilderWithMicros (long priceMicros, @NonNull Currency currency)

Creates the new instance of Revenue.Builder class to pass the data about revenue.

Fields

Currency currency

Currency of the purchase.

string payload

Additional information to be passed about the purchase. It should contain the valid JSON string. The maximum size of the value is 30 KB.

double price
Attention. The field is deprecated. Use the priceMicros field instead.

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

Long priceMicros

The price that is calculated using the following formula: priceMicros = price × 106. It can be negative, e.g. for refunds.

string productID

ID of the product purchased. The value can contain up to 200 characters.

Integer quantity

Quantity of products purchased.

Revenue.Receipt receipt

Information about the in-app purchase order from Google Play.

Method descriptions

newBuilder

public static Revenue.Builder newBuilder(double price, @NonNull Currency currency)

Attention. Outdated method. Use the newBuilderWithMicros(double priceMicros, @NonNull Currency currency) method instead.

Creates the new instance of Revenue.Builder class to pass the data about revenue.

Parameters:
price

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

currency

Currency of the purchase.

Returns:

The instance of the Revenue.Builder class.

newBuilderWithMicros

public static Revenue.Builder newBuilderWithMicros(long priceMicros, @NonNull Currency currency)

Creates the new instance of Revenue.Builder class to pass the data about revenue.

Parameters:
priceMicros

The price that is calculated using the following formula: priceMicros = price × 106. It can be negative, e.g. for refunds.

currency

Currency of the purchase.

Returns:

The instance of the Revenue.Builder class.

Field descriptions

currency

public final Currency currency

Currency of the purchase.

payload

public final String payload

Additional information to be passed about the purchase. It should contain the valid JSON string. The maximum size of the value is 30 KB.

To group purchases, pass the OrderID parameter to the field. For example:
"{\"OrderID\":\"Purchase ID\", \"source\":\"Google Play\"}"
Copied to clipboard

price

public final Double price

Attention. The field is deprecated. Use the priceMicros field instead.

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

Example: 0.99

priceMicros

public final Long priceMicros

The price that is calculated using the following formula: priceMicros = price × 106. It can be negative, e.g. for refunds.

Example: 990000. The value is equivalent to 0.99 in real currency (price = priceMicros × 10-6).

productID

public final String productID

ID of the product purchased. The value can contain up to 200 characters.

quantity

public final Integer quantity

Quantity of products purchased.

It is used in the following formula:
Revenue = quantity * price.
Note. The value cannot be negative. If the value is equal to 0, the purchase is ignored.

receipt

public final Revenue.Receipt receipt

Information about the in-app purchase order from Google Play.