flutter_conscent_plugin 0.3.1 icon indicating copy to clipboard operation
flutter_conscent_plugin: ^0.3.1 copied to clipboard

This is a step by step guide for managing Conscent Plugin and its related subclasses.

Conscent Plugin for developers #

This is a step by step guide to include Conscent Plugin in your app. This plugin is developed in Flutter and supports both Android and IOS Device.

Step-1 #

Use our plugin package as a library

Step-2 #

In your application pass client_id, Environment Mode to be used in your app as below sample:

ConscentInitializer("your_client_id", MODE.SANDBOX);
  1. ClientId will be received when you would create a ConsCent account, login to client.conscent. In to get access to your clientid
  2. Mode can be set as MODE.SANDBOX MODE.PRODUCTION. It is used for configuration testing of different environments available.

Mode is used for configuration testing of different environments available.

Step-3 #

To check if an content is free/paid or a payment needs to be done, in your class, use as below sample: Parameters detail can be checked below for more information.

Payment Formats for User #

Login to ConsCent from the Paywall, verify your credentials and then purchase access to premium content. There are three types of payments:

  1. CONTENT: Pay-per-use is a system in which users are charged only for the specific premium content they want access to.
  2. PASS: Gives access to user for all the premium content from 1hr to 14 days, which can be changed from ConsCent’s dashboard.
  3. SUBSCRIPTION: Gives user access to all the premium content starting from 1 month.
- FutureBuilder<ContentAccessModel?>(
                future: ConscentMethods().getContentAccess(),
                builder: (context, snapshot)
                child: DefaultPaywall((response)

Subscription #


                future: ConscentMethods().getSubscriptionAccess(),
                builder: (context, snapshot)
                child: SubscriptionPaywall((response)
  • It is async method use to check if a content is purchased or a payment needs to be done.
  • You would have to check if snapshot.data.signature exists to give access to users for any Prenium Content, otherwise conscent will intialize a paywall.

Parameters detail #

  • Content id: This will be your content id for which detail needs to be checked.

Premium Content Registration #

Whenever you're utilising the ConsCent APIs - you to update the API_URL variables based on the environment you're operating in.

This endpoint allows the Client to Register their Content on ConsCent - with the Content Title, ContentId, Content URL, Tags, Analytics Pixels (Facebook and Google), Price as well as any specific Price Overrides for a country - In order to set a different price for the content in the relevant country. Moreover, the ContentType field is optional - and if no 'contentType' is provided then the default 'contentType' of the client will be treated as the 'contentType' of the content being registered. While category based pricing can be used for any content, by passing the priceCategory field on registering the content - as long as the price category has been registered by the client on the ConsCent dashboard along with its respective price, duration and priceOverrides; however, category based pricing only comes into effect if the content does not have a pre-determined price field (price must be null).

HTTP Request #

POST {API_URL}/api/v1/content

Authorization #

Client API Key and Secret must be passed in Authorization Headers using Basic Auth. With API Key as the Username and API Secret as the password.

Request Body #

contentIdrequiredContent Id by which the Content has been registered on the Client CMS. Please ensure that the content ID is at most 32 characters and can only contain letters, numbers, underscores and dashes.
titlerequiredTitle of the Content
priceoptionalContent Price for pay-per-use pricing
currencyoptionalCurrency in which price is determined. Must be an ISO 4217 supported - 3 Digit currency Code. INR is used as the default if no value is provided.
urlrequiredURL where the content is available on your website
durationoptionalFree content access time for user once the user has purchased the content. (Standard Practice - 1 Day);
authorIdoptionalId of the Author of the content - Mandatory if authorName is present
authorNameoptionalName of the Author of the content
contentTypeoptionalMust be an ENUM from one of the following - STORY, VIDEO, SONG, PODCAST, PREMIUM CONTENT
priceOverridesoptionalPrice Overrides for any particular country with the relevant country code as the name and the ENUM value in the price. The country code list is located the end of this document
downloadoptionalObject containing the "url", "fileName" and "fileType". All download parameters must be provided if the content is downloadable on purchase. Also, the "fileType" is an ENUM and only accepts "PDF" currently.
priceCategoryoptionalThe priceCategory of the content, which has been registered by the client on the ConsCent Client Dashboard - in order to invoke category based pricing (only valid if story doesn't have a price). Each registered priceCategory will have an associated price, currency, duration and priceOverrides.
pixelsoptionalA nested object with the optional keys being "facebook" and "google". With the "google" object only requiring the trackingId - to include the gtag throughout the platform. However, for the "facebook" object the "pixelId" must be passed along with an "events" array - containing the event name (as configured on the facebook events manager), the eventType (which is an ENUM to be chosen from ["VIEW", "CONVERSION"]) as well as any data/values associated with the particular event.
tagsoptionalArray of tags associated with the content