-
- All Implemented Interfaces:
-
android.os.Parcelable
public final class StoreProduct implements Parcelable
Represents an in-app product's or subscription's listing details.
-
-
Field Summary
Fields Modifier and Type Field Description private final Stringskuprivate final ProductTypetypeprivate final Stringpriceprivate final LongpriceAmountMicrosprivate final StringpriceCurrencyCodeprivate final StringoriginalPriceprivate final LongoriginalPriceAmountMicrosprivate final Stringtitleprivate final Stringdescriptionprivate final StringsubscriptionPeriodprivate final StringfreeTrialPeriodprivate final StringintroductoryPriceprivate final LongintroductoryPriceAmountMicrosprivate final StringintroductoryPricePeriodprivate final IntegerintroductoryPriceCyclesprivate final StringiconUrlprivate final JSONObjectoriginalJson
-
Constructor Summary
Constructors Constructor Description StoreProduct(String sku, ProductType type, String price, Long priceAmountMicros, String priceCurrencyCode, String originalPrice, Long originalPriceAmountMicros, String title, String description, String subscriptionPeriod, String freeTrialPeriod, String introductoryPrice, Long introductoryPriceAmountMicros, String introductoryPricePeriod, Integer introductoryPriceCycles, String iconUrl, JSONObject originalJson)
-
Method Summary
Modifier and Type Method Description final StringgetSku()The product ID. final ProductTypegetType()Type of product. final StringgetPrice()Formatted price of the item, including its currency sign. final LonggetPriceAmountMicros()Price in micro-units, where 1,000,000 micro-units equal one unit of the currency. final StringgetPriceCurrencyCode()Returns ISO 4217 currency code for price and original price. final StringgetOriginalPrice()Formatted original price of the item, including its currency sign. final LonggetOriginalPriceAmountMicros()Returns the original price in micro-units, where 1,000,000 micro-units equal one unit of the currency. final StringgetTitle()Title of the product. final StringgetDescription()The description of the product. final StringgetSubscriptionPeriod()Subscription period, specified in ISO 8601 format. final StringgetFreeTrialPeriod()Subscription period, specified in ISO 8601 format. final StringgetIntroductoryPrice()The billing period of the introductory price, specified in ISO 8601 format. final LonggetIntroductoryPriceAmountMicros()Introductory price in micro-units. final StringgetIntroductoryPricePeriod()The billing period of the introductory price, specified in ISO 8601 format. final IntegergetIntroductoryPriceCycles()The number of subscription billing periods for which the user will be given the introductory price, such as 3. final StringgetIconUrl()The icon of the product if present. final JSONObjectgetOriginalJson()JSONObject representing the original product class from Google or Amazon. Booleanequals(Object other)IntegerhashCode()-
-
Constructor Detail
-
StoreProduct
StoreProduct(String sku, ProductType type, String price, Long priceAmountMicros, String priceCurrencyCode, String originalPrice, Long originalPriceAmountMicros, String title, String description, String subscriptionPeriod, String freeTrialPeriod, String introductoryPrice, Long introductoryPriceAmountMicros, String introductoryPricePeriod, Integer introductoryPriceCycles, String iconUrl, JSONObject originalJson)
-
-
Method Detail
-
getType
final ProductType getType()
Type of product. One of ProductType.
-
getPrice
final String getPrice()
Formatted price of the item, including its currency sign. For example $3.00.
-
getPriceAmountMicros
final Long getPriceAmountMicros()
Price in micro-units, where 1,000,000 micro-units equal one unit of the currency.
For example, if price is "€7.99", price_amount_micros is 7,990,000. This value represents the localized, rounded price for a particular currency.
-
getPriceCurrencyCode
final String getPriceCurrencyCode()
Returns ISO 4217 currency code for price and original price.
For example, if price is specified in British pounds sterling, price_currency_code is "GBP".
If currency code cannot be determined, currency symbol is returned.
-
getOriginalPrice
final String getOriginalPrice()
Formatted original price of the item, including its currency sign.
Note: returned only for Google products. Not available for Amazon.
-
getOriginalPriceAmountMicros
final Long getOriginalPriceAmountMicros()
Returns the original price in micro-units, where 1,000,000 micro-units equal one unit of the currency.
Note: returned only for Google products. Always 0 for Amazon subscriptions.
-
getDescription
final String getDescription()
The description of the product.
-
getSubscriptionPeriod
final String getSubscriptionPeriod()
Subscription period, specified in ISO 8601 format. For example, P1W equates to one week, P1M equates to one month, P3M equates to three months, P6M equates to six months, and P1Y equates to one year.
Note: Returned only for Google subscriptions. Not available for Amazon.
-
getFreeTrialPeriod
final String getFreeTrialPeriod()
Subscription period, specified in ISO 8601 format. For example, P1W equates to one week, P1M equates to one month, P3M equates to three months, P6M equates to six months, and P1Y equates to one year.
Note: Returned only for Google subscriptions. Not available for Amazon.
-
getIntroductoryPrice
final String getIntroductoryPrice()
The billing period of the introductory price, specified in ISO 8601 format.
Note: Returned only for Google subscriptions which have an introductory period configured. Not available for Amazon.
-
getIntroductoryPriceAmountMicros
final Long getIntroductoryPriceAmountMicros()
Introductory price in micro-units. The currency is the same as price_currency_code.
Note: Returns 0 if the product is not Google a subscription or doesn't have an introductory period. Always 0 for Amazon subscriptions.
-
getIntroductoryPricePeriod
final String getIntroductoryPricePeriod()
The billing period of the introductory price, specified in ISO 8601 format.
Note: Returned only for Google subscriptions which have an introductory period configured. Not available for Amazon.
-
getIntroductoryPriceCycles
final Integer getIntroductoryPriceCycles()
The number of subscription billing periods for which the user will be given the introductory price, such as 3.
Note: Returns 0 if the SKU is not a Google subscription or doesn't have an introductory period. Always 0 for Amazon subscriptions.
-
getIconUrl
final String getIconUrl()
The icon of the product if present.
-
getOriginalJson
final JSONObject getOriginalJson()
JSONObject representing the original product class from Google or Amazon.
Note: there's a convenience extension property that can be used to get the original SkuDetails class:
StoreProduct.skuDetails. Alternatively, the original SkuDetails can be built doing the following:SkuDetails(this.originalJson.toString())For Amazon, the original Product can be obtained using
StoreProduct.amazonProduct
-
-
-
-