flutter_conscent_plugin 0.0.7 copy "flutter_conscent_plugin: ^0.0.7" to clipboard
flutter_conscent_plugin: ^0.0.7 copied to clipboard

Conscent Plugin SDK.

Flutter SDK Conscentplugin' SDK for Flutter enables you to build a seamless and efficient customer experience for your subscription business.

Post-installation, initialization, and authentication with the Conscentplugin site, this SDK will support the following process.

  1. Default Paywall:

Default paywall can contain up to 3 CTAs with the flexibilty to display any of the CTAa at a time over the paywall. Is has three options to offer:
(a) Pass: - (b) Micropayment: - (c) Subscription:- All the enabling and disabling of the CTAs can be done through the Client Dashboard.

  1. Embedded Paywall:

this is a direct access to subscription over the given pawall and the reduces the steps to purchase a subscription as compared to the default paywall. In this paywall all the subscription appear up front with there respective tiers making the subscription selection a process to be a easier.

Getting started of Paywall

Step- In your sample project class, pass client_id and Environment Mode to be used in your app as below sample project (a) contentID:- This will be your article or content id for which detail needs to be checked. (b) Client ID:- Pass your client_id received from Conscent.

Requirements The following requirements must be set up before installing Conscentplugin Flutter SDK.

Flutter version 2.10.0 and above Dart SDK version 2.16.2 and above Android Gradle Plugin 4.0.0 Gradle 6.1.1+ AndroidX Java 8+ and Kotlin iOS 12+ Swift 5+

Installation To use Conscentplugin SDK in your Flutter app, follow these steps:

Add Conscentplugin as a dependency in your pubspec.yamlfile.

dependencies: flutter_conscent_plugin: ^0.0.1 Install dependency.

flutter pub get

Configuring SDK Prerequisites Before configuring the Conscentplugin Flutter SDK for syncing In-App Purchases, follow these steps.

iOS: Integrate the Apple App Store account with your Conscentplugin site. Android: Integrate Google Play Store account with your Conscentplugin site. iOS: On theSync Overview pageof theweb app, click View Keys and use the value of generated App ID as the SDK Key. Android: On the Sync Overview page of the web app, click Set up notifications and use the generated App ID value as the SDK Key. On the Conscentplugin site, navigate to Configure Conscentplugin > API Keys to create a new Publishable API Key or use an existing Publishable API Key. Note: During the publishable API key creation you must allow read-only access to plans/items otherwise this key will not work in the following snippet. Read more.

Initialize the Conscentplugin Flutter SDK with your Conscentplugin site, Publishable API Key, and SDK Keys by including the following snippets in your app delegate during app startup.

import 'package:flutter_conscent_plugin/flutter_conscent_plugin.dart'; try { await Conscentplugin.configure("SITE_NAME", "API-KEY", "iOS SDK Key", "Android SDK Key"); } on PlatformException catch (error) { log('PlatformException : ${error.message}'); }

Integrating In-App Purchases This section describes how to use the SDK to integrate In-App Purchase information. For details on In-App Purchase, read more.

Get IAP Products Retrieve the IAP Product objects with Product IDs using the following function.

try { List

Usage of Paywall:-

Particular Content to show a paywall in a particular paid Content.Conscent CallBack Reference: You can pass a callbackReference which will get called after success or failure in processing. If you pass a callbackReference, after successfull processing, the success reference will be called and for failed event, failure event will be called. You can implement ConscentCallBack in your activity and then pass it as a reference.

Dependencies of paywall :-

  1. webView:- A Flutter plugin that provides a WebView widget. On iOS the WebView widget is backed by a WKWebView. On Android the WebView widget is backed by a WebView.

Android iOS Support SDK 19+ or 20+ 9.0+

Add webview_flutter as a dependency in your pubspec.yaml file.

You can now display a WebView by: Instantiating a WebViewController.

to /example folder.

Widget build(BuildContext context) {

return Scaffold(
  appBar: AppBar(
    title: const Text('Conscent'),
  ),
 WebView(
          initialUrl:
              'https://conscent.netlify.app/overlay?clientId=${ConscentInitializer.mClientId}&clientContentId=${ConscentInitializer.mContentId}&loginChallenge=$loginId',
          javascriptMode: JavascriptMode.unrestricted,
          onProgress: (int progress) async {
            javascriptChannels:
            <JavascriptChannel>{_javascriptChannel()};
            print('WebView is loading (progress : $progress%)');
          }
          onWebViewCreated: (controller) {
            print('---onWebViewCreated----${controller.currentUrl()}');
         )}
  1. shared_preferences: - To use this plugin, add shared_preferences as a dependency in your pubspec.yaml file.

Examples Here are small examples that show you how to use the API.

to /example folder.

Future<String?>? getClientId() async { final prefs = await SharedPreferences.getInstance(); return prefs.getString(CLIENT_ID); }

Future<Future

  1. uuid:- If all you want is a unique ID, you should probably call uuid1() or uuid4(). Note that uuid1() may compromise privacy since it creates a UUID containing the computer’s network address. uuid4() creates a random UUID.

to /example folder.

var uuid = '${DateTime.now().millisecondsSinceEpoch.toString()}${Uuid()}';

  1. http :- A composable, Future-based library for making HTTP requests.This package contains a set of high-level functions and classes that make it easy to consume HTTP resources. It's multi-platform, and supports mobile, desktop, and the browser.

Future

to /example folder.


FutureBuilder<ContentAccessModel?>(
                future: getLoginChallengeId(),
                builder: (context, snapshot) {
                  var responseDttta = snapshot.data;
                  print(responseDttta?.signature);
                  if (snapshot.hasData) {
                    return Center(
                      child: Column(
                        children: [
                          responseDttta?.signature == null
                              ? Padding(
                                  padding: EdgeInsets.all(20.0),
                                  child: Text(
                                    'Early use Scientists are still debating when people started wearing clothes. ',
                                    maxLines: showContent ? null : 4,
                                  ),
                                )
                              : SizedBox.shrink(),
                          showContent
                              ? Container()
                              : Expanded(
                                  flex: 2,
                                  // child: MyApppp((response)
                                  child: responseDttta?.signature != null
                                      ? Center(
                                          child: Text(
                                              'Early use Scientists are still debating when people started wearing clothes'.
                                        )
                                      : MyApppp((response) {
                                         
                                          if (responseDttta != null &&
                                              responseDttta.signature != null) {
                                            showContent = true;
                                          } else {
                                            showContent = false;
                                          }
                                          print(showContent);
                                          setState(() {});

                                          (context as Element).reassemble();
                                        })),
                        ],
                      ),
                    );
                  } else if (snapshot.hasError) {
                    return Text('error');
                  } else {
                    return SizedBox.shrink();
                  }
                }),


Additional information :-

In webview to Login the Conscent Paywall and put the otp in field and purchase the content after payment and the lock content will opened in the page. There is a particular content to be a paid you need to purchase that content. You can able to see partially content free after that you need to purchase the complete content to read.