diff --git a/src/Plugin.InAppBilling.Abstractions/InAppBillingProduct.cs b/src/Plugin.InAppBilling.Abstractions/InAppBillingProduct.cs index a62addc..7aa8a72 100644 --- a/src/Plugin.InAppBilling.Abstractions/InAppBillingProduct.cs +++ b/src/Plugin.InAppBilling.Abstractions/InAppBillingProduct.cs @@ -41,6 +41,25 @@ public class InAppBillingProduct /// public Int64 MicrosPrice { get; set; } + /// + /// Gets or sets the localized introductory price. + /// + /// The localized introductory price. + public string LocalizedIntroductoryPrice { get; set; } + + /// + /// Introductory price of the product in micor-units + /// + /// The introductory price. + public Int64 MicrosIntroductoryPrice { get; set; } + + /// + /// Gets a value indicating whether this + /// has introductory price. This is an optional value in the answer from the server, requires a boolean to check if this exists + /// + /// true if has introductory price; otherwise, false. + public bool HasIntroductoryPrice => !string.IsNullOrEmpty(LocalizedIntroductoryPrice); + } } \ No newline at end of file diff --git a/src/Plugin.InAppBilling.Android/InAppBillingImplementation.cs b/src/Plugin.InAppBilling.Android/InAppBillingImplementation.cs index 0cfc483..2226ec3 100644 --- a/src/Plugin.InAppBilling.Android/InAppBillingImplementation.cs +++ b/src/Plugin.InAppBilling.Android/InAppBillingImplementation.cs @@ -105,7 +105,9 @@ public async override Task> GetProductInfoAsync CurrencyCode = product.CurrencyCode, LocalizedPrice = product.Price, ProductId = product.ProductId, - MicrosPrice = product.MicrosPrice + MicrosPrice = product.MicrosPrice, + LocalizedIntroductoryPrice = product.IntroductoryPrice, + MicrosIntroductoryPrice = product.IntroductoryPriceAmountMicros }); } @@ -711,9 +713,21 @@ public Product() [JsonProperty(PropertyName = "price_amount_micros")] public Int64 MicrosPrice { get; set; } - public override string ToString() - { - return string.Format("[Product: Title={0}, Price={1}, Type={2}, Description={3}, ProductId={4}]", Title, Price, Type, Description, ProductId); + [JsonProperty(PropertyName = "introductoryPrice")] + public string IntroductoryPrice { get; set; } + + // 0 is default if this property is not set + [JsonProperty(PropertyName = "introductoryPriceAmountMicros")] + public Int64 IntroductoryPriceAmountMicros { get; set; } + + [JsonProperty(PropertyName = "introductoryPricePeriod")] + public string IntroductoryPricePeriod { get; set; } + + [JsonProperty(PropertyName = "introductoryPriceCycles")] + public int IntroductoryPriceCycles { get; set; } + + public override string ToString() { + return string.Format("[Product: Title={0}, Price={1}, Type={2}, Description={3}, ProductId={4}, CurrencyCode={5}, MicrosPrice={6}, IntroductoryPrice={7}, IntroductoryPriceAmountMicros={8}, IntroductoryPricePeriod={9}, IntroductoryPriceCycles={10}]", Title, Price, Type, Description, ProductId, CurrencyCode, MicrosPrice, IntroductoryPrice, IntroductoryPriceAmountMicros, IntroductoryPricePeriod, IntroductoryPriceCycles); } }