Some popular use cases are describerd below.
- To set user context
 - To get all subscriptions of a user
 - To Get Subscription Plans
 - To Check Access for an Asset
 - To Update Meter
 - To get all payment options for a user and make purchase
 
To set user context
Call set user
For logged in user
AccessType.setUser({ 
  'accesstypeJwt': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImhpbWFuaXFxcXFAcS5jb20iLCJpZCI6MTIzLCJpYXQiOjE1OTQyNzMyMDR9.0SUtG3GERSh_uHBOHx0IdO2R4ehiCbEixSp5TeXSAwo'
  }).then(() => ... )
AccessType.setUser({ 
  'accesstypeJwt': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImhpbWFuaXFxcXFAcS5jb20iLCJpZCI6MTIzLCJpYXQiOjE1OTQyNzMyMDR9.0SUtG3GERSh_uHBOHx0IdO2R4ehiCbEixSp5TeXSAwo',
  'emailAddress': 'abc@qt.com',
  'mobileNumber':  '993XXXXXX4'
  }).then(() => ... )
AccessType.setUser({ 
  'accesstypeJwtUrl': '/api/v1/get-at-jwt',
  'readerId': 'O2R4ehiCbEixSp5TeXS'
  }).then(() => ... )
For non logged in user
AccessType.setUser({
  'accesstypeJwtUrl': null,
  'readerId': 'O2R4ehiCbEixSp5TeXS'
  }).then(() => ... )
AccessType.setUser({
  'accesstypeJwtUrl': null,
  'isLoggedIn': false,
  }).then(() => ... )
AccessType.setUser({
  'isLoggedIn': false,
  'emailAddress': 'abc@qt.com',
  'readerIdUrl': '/api/v1/set-at-reader-id'
  }).then(() => ... )
To get all subscriptions of a user
Call getSubscriptions
AccessType.getSubscriptions()
To Get Subscription Plans
To get ‘standard’ subscription plans, call getSubscriptionPlans
AccessType.getSubscriptionPlans()
To Check Access for an Asset
Call isAssetAccessible method.
AccessType.isAssetAccessible({
  id: '8bfd26de-cc7a-4226-bdc3-973669fdd808',
  type: 'story'})
To Update Meter
Call pingbackAssetAccess.
let asset = { 
  'id': '8bfd26de-cc7a-4226-bdc3-973669fdd808',
  'type': 'story'
  };
let accessGrant = { //this is the response from isAssetAccessible call
  "granted":false,
  "grantReason":"METERING",
  "data": {
    "isLoggedIn":true,
    "numberRemaining": 2,
    "isLast": false
    }
  }
AccessType.pingbackAssetAccess(asset, accessGrant)
To get all payment options for a user and make purchase
You can call getPaymentOptions
AccessType.getPaymentOptions().then((paymentOptions) => {
  for (let [paymentProvider, context] of Object.entries(paymentOptions)) {
    // Display payment options
  }
})
where paymentOptions is an object like below:
 {
  'paytm_auto_debit': {
    'action': 'link', //anyOf link, pay etc.
    'proceed': fn(args)
  },
  'razorpay': {
    'action': 'pay', //only pay
    'proceed': fn(args)
  },...
}
The keys are the names of the payment providers that can be used by the user to make payment.
The values are context objects related to that payment provider. For e.g. in the case of paytm_auto_debit, there is a linking step that a new user will have to complete before they can use it.
The proceed is a callback function that takes user to next step. The action specifies at what step a payment provider is for a user. The various values for action are as follows:
- send_otp : It is the first step for 
paytm_auto_debit. It means an otp has to be sent to the user for him to connect his paytm account. At this step, callproceedfunction to send otp to user’s mobile number and then update paymentOption for the provider.paymentOptions['paytm_auto_debit'].proceed() .then(function (updatedPaymentOption) { //save updatedPaymentOption in which action will be updated to the next step. }); - link : It is the second step for 
paytm_auto_debitand first forsimpl. It means the wallet needs to be linked for a user. At this step, you need to callproceedfunction, passing in the otp value when provider ispaytm_auto_debitor without any params in case ofsimpl.paymentOptions['paytm_auto_debit'].proceed(some_otp) .then(function (updatedPaymentOption) { //save updatedPaymentOption in which action will be updated to the next step. }); OR paymentOptions['simpl'].proceed() .then(function (updatedPaymentOption) { //save updatedPaymentOption in which action will be updated to the next step. }); - pay : It is the last step for all the payment providers. Actual payment is made and subscription is created at this step. In this final stage, you need to call 
proceedfunction, passing in appropriate subscriptionParams and handle success/failure. Example:paymentOptions['razorpay'].proceed(subscriptionParams) .then((response) => { //handle success response }) .catch((error) => { //handle error response }); - preview : This is the first step for 
juspayandpaypaland needs to be handled in a different way. In this case, the nextpayaction is handled as part of the success response. Call proceed function with subscriptionParams like in the example below:paymentOptions['juspay'].proceed(subscriptionParams) .then((response) => { response.proceed(subscriptionParams).then(response => { //handle success response }); }).catch((error) => { //handle error response }); 
Please note that you need to pass some additional values in subscriptionParams for some payment providers which are available here.