SubscriptionOffer class

Standardized subscription discount/promotional offer. Provides a unified interface for subscription offers across iOS and Android.

Both platforms support subscription offers with different implementations:

  • iOS: Introductory offers, promotional offers with server-side signatures
  • Android: Offer tokens with pricing phases

@see https://openiap.dev/docs/types/ios#discount-offer @see https://openiap.dev/docs/types/android#subscription-offer

Constructors

SubscriptionOffer({String? basePlanIdAndroid, String? currency, required String displayPrice, required String id, String? keyIdentifierIOS, String? localizedPriceIOS, String? nonceIOS, int? numberOfPeriodsIOS, List<String>? offerTagsAndroid, String? offerTokenAndroid, PaymentMode? paymentMode, SubscriptionPeriod? period, int? periodCount, required double price, PricingPhasesAndroid? pricingPhasesAndroid, String? signatureIOS, double? timestampIOS, required DiscountOfferType type})
const
SubscriptionOffer.fromJson(Map<String, dynamic> json)
factory

Properties

basePlanIdAndroid String?
Android Base plan identifier. Identifies which base plan this offer belongs to.
final
currency String?
Currency code (ISO 4217, e.g., "USD")
final
displayPrice String
Formatted display price string (e.g., "$9.99/month")
final
hashCode int
The hash code for this object.
no setterinherited
id String
Unique identifier for the offer.
final
keyIdentifierIOS String?
iOS Key identifier for signature validation. Used with server-side signature generation for promotional offers.
final
localizedPriceIOS String?
iOS Localized price string.
final
nonceIOS String?
iOS Cryptographic nonce (UUID) for signature validation. Must be generated server-side for each purchase attempt.
final
numberOfPeriodsIOS int?
iOS Number of billing periods for this discount.
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
paymentMode PaymentMode?
Payment mode during the offer period
final
period SubscriptionPeriod?
Subscription period for this offer
final
periodCount int?
Number of periods the offer applies
final
price double
Numeric price value
final
pricingPhasesAndroid PricingPhasesAndroid?
Android Pricing phases for this subscription offer. Contains detailed pricing information for each phase (trial, intro, regular).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
signatureIOS String?
iOS Server-generated signature for promotional offer validation. Required when applying promotional offers on iOS.
final
timestampIOS double?
iOS Timestamp when the signature was generated. Used for signature validation.
final
type DiscountOfferType
Type of subscription offer (Introductory or Promotional)
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