DiscountOffer class

Standardized 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.

@see https://openiap.dev/docs/features/discount

Constructors

DiscountOffer({required String currency, String? discountAmountMicrosAndroid, required String displayPrice, String? formattedDiscountAmountAndroid, String? fullPriceMicrosAndroid, String? id, LimitedQuantityInfoAndroid? limitedQuantityInfoAndroid, List<String>? offerTagsAndroid, String? offerTokenAndroid, int? percentageDiscountAndroid, PreorderDetailsAndroid? preorderDetailsAndroid, required double price, RentalDetailsAndroid? rentalDetailsAndroid, required DiscountOfferType type, ValidTimeWindowAndroid? validTimeWindowAndroid})
const
DiscountOffer.fromJson(Map<String, dynamic> json)
factory

Properties

currency String
Currency code (ISO 4217, e.g., "USD")
final
discountAmountMicrosAndroid String?
Android Fixed discount amount in micro-units. Only present for fixed amount discounts.
final
displayPrice String
Formatted display price string (e.g., "$4.99")
final
formattedDiscountAmountAndroid String?
Android Formatted discount amount string (e.g., "$5.00 OFF").
final
fullPriceMicrosAndroid String?
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.
final
hashCode int
The hash code for this object.
no setterinherited
id String?
Unique identifier for the offer.
final
limitedQuantityInfoAndroid LimitedQuantityInfoAndroid?
Android Limited quantity information. Contains maximumQuantity and remainingQuantity.
final
offerTagsAndroid List<String>?
Android List of tags associated with this offer.
final
offerTokenAndroid String?
Android Offer token required for purchase. Must be passed to requestPurchase() when purchasing with this offer.
final
percentageDiscountAndroid int?
Android Percentage discount (e.g., 33 for 33% off). Only present for percentage-based discounts.
final
preorderDetailsAndroid PreorderDetailsAndroid?
Android Pre-order details if this is a pre-order offer. Available in Google Play Billing Library 8.1.0+
final
price double
Numeric price value
final
rentalDetailsAndroid RentalDetailsAndroid?
Android Rental details if this is a rental offer.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type DiscountOfferType
Type of discount offer
final
validTimeWindowAndroid ValidTimeWindowAndroid?
Android Valid time window for the offer. Contains startTimeMillis and endTimeMillis.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited