linkfive_purchases 4.0.1 linkfive_purchases: ^4.0.1 copied to clipboard
Manage your in-app subscriptions with the LinkFive plugin - The Easiest Implementation of Subscriptions.
4.0.1 #
- We added a new http Client with retry functions and timeouts to properly handle mobile connectivity
- We fixed a bug where the product details can be null.
4.0.0 #
Release of new One Time Purchase API
New Purchase Methods. #
purchaseFuture
andrestoreFuture
returns a future and completes whenever the async update stream completes with the active Products.
One Time Purchase #
LinkFiveActiveProducts
now also have a list of active One Time Purchasesfinal List<LinkFiveOneTimePurchase> oneTimePurchaseList;
New methods for LinkFiveProductDetails
.
- You can use the
productType
to check for the product Type,Subscription
,OneTimePurchase
.
for (final offer in premiumOffer.productDetailList)
switch (offer.productType) {
LinkFiveProductType.OneTimePurchase => LayoutBuilder(builder: (_, _) {
// build your One Time Purchase Widget
// e.g:
// Text(offer.oneTimePurchasePrice.formattedPrice)
// and later when pressed:
// onPressed: () {
// ref.read(premiumOfferProvider.notifier).purchase(offer);
// }
}),
LinkFiveProductType.Subscription => LayoutBuilder(builder: (_, _) {
// build your Subscription Purchase Widget
// use the pricing Phases:
// for (var pricingPhase in offer.pricingPhases) {
// Text(pricingPhase.formattedPrice);
// Text(pricingPhase.billingPeriod.iso8601); // e.g.: P6M
// }
// and later when pressed:
// onPressed: () {
// ref.read(premiumOfferProvider.notifier).purchase(offer);
// }
}),
}
- New
oneTimePurchasePrice
which returns a new entityOneTimePurchasePrice
with new getter:
String get formattedPrice
int get priceAmountMicros
String get priceCurrencyCode
String get priceCurrencySymbol
New Purchase In Progress Stream #
You can now use the purchaseInProgressStream
to show a loadingIndicator on your paywall.
/// true -> show loading indicator / disable purchase button
/// false -> disable loading indicator / enable purchase Button
class PremiumPurchaseInProgressNotifier extends Notifier<bool> {
@override
bool build() {
final streamSub =
LinkFivePurchases.purchaseInProgressStream.listen((bool isPurchaseInProgress) {
state = isPurchaseInProgress;
});
ref.onDispose(() {
streamSub.cancel();
});
return false;
}
}
Others #
- paywallUIHelper is currently not supported in this version. Please build the connection yourself.
3.0.1 #
- improved purchase process to prevent a PlatformException with message:
There is a pending transaction ...
for ongoing purchases. - Updated dependencies to latest
3.0.0 #
Breaking Change Update.
- Flutter ^3.10 Update
- Dart ^3.0.0 Update
- We now support Google Play Base-Plans
- We updated the in_app_purchase flutter lib to latest
- There is a new
Period
class that holds aPeriodUnit
andamount
of units. - We added the
PricingPhase
to Google Play Store and Apple App Store - We added a new Recurrence class that holds the subscription recurrence type
ProductDetails, Pricing Phase & Google‘s new Base Plans approach #
Google changed how they handle subscriptions and added Base Plans & PricingPhases to it's new data model. Unfortunately, the in_app_purchase library exposes different models depending on the platform.
We decided to combine the ProductDetails class into a simple to use class called LinkFiveProductDetails
which holds pricingPhases
for both platforms, Android & iOS.
class LinkFiveProductDetails {
/// Platform dependent Product Details such as GooglePlayProductDetails or AppStoreProductDetails
final ProductDetails productDetails;
/// Base64 encoded attributes which you can define on LinkFive
final String? attributes;
/// Converts the new Google Play & AppStore Model to a known list of pricing phases
List<PricingPhase> get pricingPhases;
}
Pricing Phase
The PricingPhase class now holds all information about the product and it's phases. An example would be a FreeTrial phase and a yearly subscription as 2 elements in the PricingPhase list.
Here are all interesting parts of the class:
class PricingPhase {
/// Represents a pricing phase, describing how a user pays at a point in time.
int get billingCycleCount;
/// Billing period for which the given price applies, specified in ISO 8601 format.
Period get billingPeriod;
/// Returns formatted price for the payment cycle, including its currency sign.
String get formattedPrice;
/// Returns the price for the payment cycle in micro-units, where 1,000,000
/// micro-units equal one unit of the currency.
int get priceAmountMicros;
/// ISO 4217 e.g. EUR, USD
String get priceCurrencyCode;
/// Recurrence of the phase
Recurrence get recurrence;
}
Period & PeriodUnit class
The Period class now holds the length of a subscription.
class Period {
final int amount;
final PeriodUnit periodUnit;
}
enum PeriodUnit {
DAYS('D'),
WEEKS('W'),
MONTH('M'),
YEARS('Y');
}
A Period of 3 months would be Period(amount: 3, periodUnit: MONTH) and a year would be Period(amount: 1, periodUnit: YEAR),
From the Period class to a readable user-friendly text
We added a intl-localization-package which uses the intl
package that can help you translate the Period into a readable text.
Here is the package on pub.dev
You can use the isoCode from the billingPeriod to get a readable String:
final translationClass = pricingPhase.billingPeriod.iso8601.fromIso8601(PaywallL10NHelper.of(context));
The translation class will output:
7 days
fromP7D
1 month
fromP1M
3 months
fromP3M
(or alsoquarterly
)1 year
fromP1Y
(or alsoyearly
)
You can submit your own translation to it's github Repository.
2.1.3 #
- Update dependencies
- This will also fix the restore-bug on Android
2.1.2 #
- Make plugin compatible with pre Flutter 3.0
2.1.1 #
- Add Test API Key handling. Use "TmljZSAyIG1lZXQgeW91IE1yLkhhY2tlcg=" to quickly test this plugin but please do not use it more than just the initial testing.
- Added some more Unit tests.
2.1.0 #
- Update for Flutter ^3.0.0
- fetchProducts() now waits until the initialization is done. There is no need to await LinkFiveProducts.init(...) anymore.
- Update to in_app_purchase: 3.0.6
- We added more unit tests.
2.0.2 #
- We fixed a bug when setting the userID is not saved on the device.
- we also implemented all new dart analysis changes
- updated to flutter 2.10.4
2.0.1 #
- fixing PendingPurchase handler which tells the UI that the purchase is ongoing.
- We also now send the plugin version to LinkFive with each request
- update the Example project
2.0.0 #
Release of LinkFive 2.0
With this major release we are paving the way for flutter web subscriptions as well as other exciting features coming soon to LinkFive.
A subscription is now called a Plan to prepare for flutter web subscriptions and other recurring or time-framed plans like coupon plans, team plans, etc.
LinkFivePurchases.fetchSubscriptions();
is nowLinkFivePurchases.fetchProducts();
LinkFiveSubscriptionData
is nowLinkFiveProducts
and they own a List ofLinkFiveProductDetails
for better understanding.LinkFiveActiveSubscriptionData
is nowLinkFiveActiveProducts
and they own a List ofLinkFivePlan
.
A LinkFivePlan has a completely new body:
-
String productId;
-
String planId;
-
String rootId;
-
DateTime purchaseDate;
-
DateTime endDate;
-
String storeType;
-
String? customerUserId;
-
bool? isTrial;
-
String? familyName;
-
String? attributes;
-
String? duration;
-
Listen on purchase updates changes from
LinkFivePurchases.listenOnActiveSubscriptionData()
toLinkFivePurchases.activeProducts
which is much simpler.
Paywall UI Helper changes
-
products.getSubscriptionData(context: context)
is nowproducts.paywallUIHelperData(context: context)
-
LinkFivePurchases.init("API Key") now returns a Future<> which you should await before you fetch your products
1.5.0 #
Breaking change: fetchSubscriptions returns a Future<LinkFiveSubscriptionData?> instead of Future<List
LinkFiveSubscriptionData has
List<LinkFiveProductDetails> linkFiveSkuData
which contains the productDetail.
- listenOnResponseData is now deprecated and won't be replaced.
- LinkFiveVerifiedReceipt now has subscriptionDuration which containts the duration of the subscription. P1W, P1M, P3M, P6M, P1Y
- Added some more documentation
1.4.0 #
Add Switch Plan functionality. You can now call LinkFivePurchases.switchPlan(...) to switch from one plan to another. Add more documentation
1.3.0 #
update to interface 0.0.7 return a Future<List
1.2.0 #
update to interface 0.0.6
- It fetches the subscriptions on load call now update intl to 0.0.3 removed the unused android folder Prepared the package for the new LinkFive provider package
1.1.1 #
remove unused dependencies
1.1.0 #
add easy paywall ui integration. add provider example. add streambuilder example. add intl package. add interface package
1.0.1 #
- fixed a bug where a purchase was not immediately processed as a purchase.
1.0.0 #
- Initial and tested production release