LinkFive - Successful Subscriptions

Show your Subscription Offer

Show your Subscription Offer

Please read How to initialize the plugin before you start with this part.

If the user has no active subscriptions, you would want to fetch all available subscriptions you configured in the “Playout section“ of LinkFive - if you did not configured it yet, no worries, all connected subscriptions will be fetched.

Fetch your Subscriptions Offer

To fetch all available subscriptions, call fetchSubscriptions(). It's usually enough to call it once when the user enters the paywall or even once after every app start if the user has no active subscriptions yet.


This will connect to LinkFive and fetch all available subscriptions you configured with the “Subscription Playout“. If you created a subscription playout filter, then it will automatically fetch the filtered subscriptions to the user.

The subscriptions will then be passed to the “SubscriptionData“ stream.

Get Subscriptions Stream

You will get the stream by listening on the SubscriptionData

void _subscriptionDataUpdate(LinkFiveSubscriptionData? linkFiveSubscriptionData) {
// access linkFiveSubscriptionData
// linkFiveSubscriptionData?.linkFiveSkuData
// linkFiveSubscriptionData?.attributes

LinkFiveSubscriptionData includes a list of ProductDetails and attributes. You can use the ProductDetails to show the price, the duration and everything related to it.

// available variables of LinkFiveSubscriptionData
List<LinkFiveProductDetails> linkFiveSkuData;
String? attributes;
  • linkFiveSkuData: id, title, price, description, duration, rawPrice & currencyCode

  • attributes: Data defined in “Subscription Playout“. You can pass any data you like to the app with the attributes. Attributes are Base64 encoded. Please decode first.

As an example, you can use the map method to build a button for each of your subscriptions

(data) => SubscriptionButton(linkFiveProductDetails: data)

And you can access the price by accessing the productDetails


Provider Example

A simple provider example on how to listen on active subscriptions and on subscriptionData:

class SubscriptionsProvider extends ChangeNotifier {
List<LinkFiveVerifiedReceipt> verifiedReceipt = [];
LinkFiveSubscriptionData? availableSubscriptions = null;
SubscriptionsProvider() {
LinkFivePurchases.init("API KEY");
// Stream of subscriptions to offer to the user
// Stream of active subscriptions
_listenToSubscriptionData(LinkFiveSubscriptionData? linkFiveSubscriptionData) {
availableSubscriptions = linkFiveSubscriptionData;
_listenToPurchaseUpdated(LinkFiveActiveSubscriptionData? linkFiveActiveSubscriptionData) {
verifiedReceipt = linkFiveActiveSubscriptionData?.subscriptionList ?? [];
fetchSubscriptions() async {
restoreSubscriptions() async {
purchase(ProductDetails productDetail) async {

StreamBuilder Example

If you want to use a simple StreamBuilder, you can just pass the stream and wait for the snapshot to arrive.

child: StreamBuilder<LinkFiveSubscriptionData?>(
stream: LinkFivePurchases.products,
builder: (context, snapshot) {
if (snapshot.hasData) {
var subscriptionData =;
if (subscriptionData != null) {
return Column(
children: [
children: buildSubscriptionButtons(subscriptionData),
return Center(child: Text('Loading...'));

Next: Make a purchase