YMMRevenueInfo class

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

Use the YMMMutableRevenueInfo class to change information about revenue.

The instance of the YMMRevenueInfo class should be sent to the AppMetrica server using the reportRevenue method of the YMMYandexMetrica class.

Instance methods

-initWithPrice:currency:

Initializes the instance of the YMMRevenueInfo class for sending information about purchases.

Attention. Outdated method. Use the -initWithPriceDecimal:currency: method instead.
-initWithPriceDecimal:currency:

Initializes the instance of the YMMRevenueInfo class for sending information about purchases.

-initWithPrice:currency:quantity:productID:transactionID:receiptData:payload:

Initializes the instance of the YMMRevenueInfo class for sending information about purchases.

-initWithPriceDecimal:currency:quantity:productID:transactionID:receiptData:payload:

Initializes the instance of the YMMRevenueInfo class for sending information about purchases.

Properties

currency

Currency code of the purchase in the ISO 4217 format.

payload

Additional information to be passed about the purchase.

price

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

Attention. The property is deprecated. Use the priceDecimal property instead.
priceDecimal

The price that is set using the NSDecimalNumber object. It can be negative, e.g. for refunds.

productID

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

quantity

Quantity of products purchased.

receiptData

Details about the in-app purchase order from App Store.

transactionID

Details about the in-app purchase order from App Store.

Method descriptions

-initWithPrice:currency:

- (instancetype)initWithPrice:(double)price currency:(NSString *)currency
Attention. Outdated method. Use the -initWithPriceDecimal:currency: method instead.

Initializes the instance of the YMMRevenueInfo class for sending information about purchases.

Parameters:
price

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

currency

Currency code of the purchase in the ISO 4217 format.

The value should contain 3 Latin letters in uppercase.

Example: RUB.
Note. If the value is not in the ISO 4217 format, the purchase is ignored.

Returns:

The instance of the YMMRevenueInfo class.

-initWithPriceDecimal:currency:

- (instancetype)initWithPriceDecimal:(NSDecimalNumber *)priceDecimal currency:(NSString *)currency

Initializes the instance of the YMMRevenueInfo class for sending information about purchases.

Parameters:
priceDecimal

The price that is set using the NSDecimalNumber object. It can be negative, e.g. for refunds.

currency

Currency code of the purchase in the ISO 4217 format.

The value should contain 3 Latin letters in uppercase.

Example: RUB.
Note. If the value is not in the ISO 4217 format, the purchase is ignored.

Returns:

The instance of the YMMRevenueInfo class.

-initWithPrice:currency:quantity:productID:transactionID:receiptData:payload:

- (instancetype)initWithPrice:(double)price
                     currency:(NSString *)currency
                     quantity:(NSUInteger)quantity
                    productID:(NSString *)productID
                transactionID:(NSString *)transactionID
                  receiptData:(NSData *)receiptData
                      payload:(NSDictionary *)payload

Initializes the instance of the YMMRevenueInfo class for sending information about purchases.

Parameters:
price

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

currency

Currency code of the purchase in the ISO 4217 format.

The value should contain 3 Latin letters in uppercase.

Example: RUB.
Note. If the value is not in the ISO 4217 format, the purchase is ignored.
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.
productID

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

transactionID

Details about the in-app purchase order from App Store.

receiptData

Details about the in-app purchase order from App Store.

payload

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

It should contain the NSDictionary object that can be converted to valid JSON. The maximum size of the value is 30 KB.

Returns:

The instance of the YMMRevenueInfo class.

‑initWithPriceDecimal:currency:quantity:productID:transactionID:receiptData:payload:

- (instancetype)initWithPriceDecimal:(NSDecimalNumber *)priceDecimal
                            currency:(NSString *)currency
                            quantity:(NSUInteger)quantity
                           productID:(NSString *)productID
                       transactionID:(NSString *)transactionID
                         receiptData:(NSData *)receiptData
                             payload:(NSDictionary *)payload

Initializes the instance of the YMMRevenueInfo class for sending information about purchases.

Parameters:
priceDecimal

The price that is set using the NSDecimalNumber object. It can be negative, e.g. for refunds.

currency

Currency code of the purchase in the ISO 4217 format.

The value should contain 3 Latin letters in uppercase.

Example: RUB.
Note. If the value is not in the ISO 4217 format, the purchase is ignored.
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.
productID

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

transactionID

Details about the in-app purchase order from App Store.

receiptData

Details about the in-app purchase order from App Store.

payload

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

It should contain the NSDictionary object that can be converted to valid JSON. The maximum size of the value is 30 KB.

Returns:

The instance of the YMMRevenueInfo class.

Property descriptions

currency

(nonatomic, copy, readonly) NSString *currency

Currency code of the purchase in the ISO 4217 format.

payload

(nonatomic, copy, readonly) NSDictionary *payload

Additional information to be passed about the purchase.

price

(nonatomic, strong, nullable, readonly) double price

Attention. The property is deprecated. Use the priceDecimal property instead.

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

priceDecimal

(nonatomic, assign, readonly) NSDecimalNumber *priceDecimal

The price that is set using the NSDecimalNumber object. It can be negative, e.g. for refunds.

productID

(nonatomic, copy, readonly) NSString *productID

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

quantity

(nonatomic, assign, readonly) NSUInteger quantity

Quantity of products purchased.

receiptData

(nonatomic, copy, readonly) NSData *receiptData

Details about the in-app purchase order from App Store.

transactionID

(nonatomic, copy, reaоdonly) NSString *transactionID

Details about the in-app purchase order from App Store.