PurchaseProduct.subscription constructor
- required String productId,
- required double price,
- required Duration expiredPeriod,
- String title = "",
- String description = "",
- Widget? icon,
- String? priceText,
- PurchaseSubscriptionPeriod? subscriptionPeriod = PurchaseSubscriptionPeriod.month,
- bool debugForcePurchased = false,
- Widget priceBuilder(
- BuildContext context,
- PurchaseProduct product
- List<
String> offerIds = const [],
Define chargeable items.
PurchaseProduct.wallet] to create a wallet type billing item, PurchaseProduct.unlock to create a feature unlock type billing item, PurchaseProduct.subscription to Create a subscription with PurchaseProduct.subscription.
Be sure to match productId with the store's ID.
price is overwritten when a charged item is loaded from the store. title and description can be retrieved from titleOnStore and descriptionOnStore loaded from the store.
expiredPeriod allows you to specify the duration of the subscription for testing.
課金アイテムの定義を行います。
PurchaseProduct.walletでウォレットタイプの課金アイテムを作成し、PurchaseProduct.unlockで機能アンロックタイプの課金アイテムを作成、PurchaseProduct.subscriptionでサブスクリプションを作成します。
productIdをストア側のIDと必ず合わせるようにしてください。
priceは課金アイテムをストアからロードした際に上書きされます。titleやdescriptionはtitleOnStoreやdescriptionOnStoreでストアからロードしたものを取得できます。
expiredPeriodを指定するとテスト用のサブスクリプションの期間を指定することができます。
Implementation
const PurchaseProduct.subscription({
required this.productId,
required this.price,
required Duration expiredPeriod,
String title = "",
String description = "",
this.icon,
String? priceText,
this.subscriptionPeriod = PurchaseSubscriptionPeriod.month,
this.debugForcePurchased = false,
this.priceBuilder,
this.offerIds = const [],
}) : type = PurchaseProductType.subscription,
amount = null,
expiredPeriod = expiredPeriod,
_priceText = priceText,
_title = title,
_description = description,
_debugConsumeWhenPurchaseCompleted = false;