-
public final class DiscountOfferStandardized one-time product discount offer. Provides a unified interface for one-time purchase discounts across platforms.
Currently supported on Android (Google Play Billing 7.0+). iOS does not support one-time purchase discounts in the same way.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classDiscountOffer.Companion
-
Field Summary
Fields Modifier and Type Field Description private final Stringcurrencyprivate final StringdiscountAmountMicrosAndroidprivate final StringdisplayPriceprivate final StringformattedDiscountAmountAndroidprivate final StringfullPriceMicrosAndroidprivate final Stringidprivate final LimitedQuantityInfoAndroidlimitedQuantityInfoAndroidprivate final List<String>offerTagsAndroidprivate final StringofferTokenAndroidprivate final IntegerpercentageDiscountAndroidprivate final PreorderDetailsAndroidpreorderDetailsAndroidprivate final Doublepriceprivate final StringpurchaseOptionIdAndroidprivate final RentalDetailsAndroidrentalDetailsAndroidprivate final DiscountOfferTypetypeprivate final ValidTimeWindowAndroidvalidTimeWindowAndroid
-
Constructor Summary
Constructors Constructor Description DiscountOffer(String currency, String discountAmountMicrosAndroid, String displayPrice, String formattedDiscountAmountAndroid, String fullPriceMicrosAndroid, String id, LimitedQuantityInfoAndroid limitedQuantityInfoAndroid, List<String> offerTagsAndroid, String offerTokenAndroid, Integer percentageDiscountAndroid, PreorderDetailsAndroid preorderDetailsAndroid, Double price, String purchaseOptionIdAndroid, RentalDetailsAndroid rentalDetailsAndroid, DiscountOfferType type, ValidTimeWindowAndroid validTimeWindowAndroid)
-
Method Summary
Modifier and Type Method Description final StringgetCurrency()Currency code (ISO 4217, e.g. final StringgetDiscountAmountMicrosAndroid()Android Fixed discount amount in micro-units. final StringgetDisplayPrice()Formatted display price string (e.g., "$4. final StringgetFormattedDiscountAmountAndroid()Android Formatted discount amount string (e.g., "$5.00 OFF"). final StringgetFullPriceMicrosAndroid()Android Original full price in micro-units before discount. final StringgetId()Unique identifier for the offer. final LimitedQuantityInfoAndroidgetLimitedQuantityInfoAndroid()Android Limited quantity information. final List<String>getOfferTagsAndroid()Android List of tags associated with this offer. final StringgetOfferTokenAndroid()Android Offer token required for purchase. final IntegergetPercentageDiscountAndroid()Android Percentage discount (e.g., 33 for 33% off). final PreorderDetailsAndroidgetPreorderDetailsAndroid()Android Pre-order details if this is a pre-order offer. final DoublegetPrice()Numeric price value final StringgetPurchaseOptionIdAndroid()Android Purchase option ID for this offer. final RentalDetailsAndroidgetRentalDetailsAndroid()Android Rental details if this is a rental offer. final DiscountOfferTypegetType()Type of discount offer final ValidTimeWindowAndroidgetValidTimeWindowAndroid()Android Valid time window for the offer. final Map<String, Object>toJson()-
-
Constructor Detail
-
DiscountOffer
DiscountOffer(String currency, String discountAmountMicrosAndroid, String displayPrice, String formattedDiscountAmountAndroid, String fullPriceMicrosAndroid, String id, LimitedQuantityInfoAndroid limitedQuantityInfoAndroid, List<String> offerTagsAndroid, String offerTokenAndroid, Integer percentageDiscountAndroid, PreorderDetailsAndroid preorderDetailsAndroid, Double price, String purchaseOptionIdAndroid, RentalDetailsAndroid rentalDetailsAndroid, DiscountOfferType type, ValidTimeWindowAndroid validTimeWindowAndroid)
-
-
Method Detail
-
getCurrency
final String getCurrency()
Currency code (ISO 4217, e.g., "USD")
-
getDiscountAmountMicrosAndroid
final String getDiscountAmountMicrosAndroid()
Android Fixed discount amount in micro-units. Only present for fixed amount discounts.
-
getDisplayPrice
final String getDisplayPrice()
Formatted display price string (e.g., "$4.99")
-
getFormattedDiscountAmountAndroid
final String getFormattedDiscountAmountAndroid()
Android Formatted discount amount string (e.g., "$5.00 OFF").
-
getFullPriceMicrosAndroid
final String getFullPriceMicrosAndroid()
Android Original full price in micro-units before discount. Divide by 1,000,000 to get the actual price. Use for displaying strikethrough original price.
-
getId
final String getId()
Unique identifier for the offer.
iOS: Not applicable (one-time discounts not supported)
Android: offerId from ProductAndroidOneTimePurchaseOfferDetail
-
getLimitedQuantityInfoAndroid
final LimitedQuantityInfoAndroid getLimitedQuantityInfoAndroid()
Android Limited quantity information. Contains maximumQuantity and remainingQuantity.
-
getOfferTagsAndroid
final List<String> getOfferTagsAndroid()
Android List of tags associated with this offer.
-
getOfferTokenAndroid
final String getOfferTokenAndroid()
Android Offer token required for purchase. Must be passed to requestPurchase() when purchasing with this offer.
-
getPercentageDiscountAndroid
final Integer getPercentageDiscountAndroid()
Android Percentage discount (e.g., 33 for 33% off). Only present for percentage-based discounts.
-
getPreorderDetailsAndroid
final PreorderDetailsAndroid getPreorderDetailsAndroid()
Android Pre-order details if this is a pre-order offer. Available in Google Play Billing Library 8.1.0+
-
getPurchaseOptionIdAndroid
final String getPurchaseOptionIdAndroid()
Android Purchase option ID for this offer. Used to identify which purchase option the user selected. Available in Google Play Billing Library 7.0+
-
getRentalDetailsAndroid
final RentalDetailsAndroid getRentalDetailsAndroid()
Android Rental details if this is a rental offer.
-
getType
final DiscountOfferType getType()
Type of discount offer
-
getValidTimeWindowAndroid
final ValidTimeWindowAndroid getValidTimeWindowAndroid()
Android Valid time window for the offer. Contains startTimeMillis and endTimeMillis.
-
-
-
-