Revenue.Builder class

com.yandex.metrica

public class Revenue.Builder

Builder class for Revenue.

Methods

Revenuebuild()

Creates the instance of the Revenue class.

Revenue.BuilderwithPayload(@Nullable String payload)

Sets additional information about the purchase.

Revenue.BuilderwithProductID(@Nullable String productID)

Sets the custom ID of the product purchased.

Revenue.BuilderwithQuantity(@Nullable Integer quantity)

Sets the custom ID of the product purchased.

Revenue.BuilderwithReceipt(@Nullable Revenue.Receipt receipt)

Sets the receipt information about the purchase.

Method descriptions

build

public Revenue build()

Creates the instance of the Revenue class.

Returns:

The instance of the Revenue class.

withPayload

public Revenue.Builder withPayload(@Nullable String payload)

Sets additional information about the purchase.

Parameters:
payload

Additional information to be passed about the purchase. For instance, it can be used for categorizing your products.

It should contain the valid JSON string. The maximum size of the value is 30 KB.

Returns:

The instance of the Revenue.Builder class.

withProductID

public Revenue.Builder withProductID(@Nullable String productID)

Sets the custom ID of the product purchased.

Parameters:
productID

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

Returns:

The instance of the Revenue.Builder class.

withQuantity

public Revenue.Builder withQuantity(@Nullable Integer quantity)

Sets the quantity of products purchased.

Parameters:
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.

Returns:

The instance of the Revenue.Builder class.

withReceipt

public Revenue.Builder withReceipt(@Nullable Revenue.Receipt receipt)

Sets the receipt information about the purchase.

Parameters:

receipt

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

Returns:

The instance of the Revenue.Builder class.