AccessType

Available as a global variable on loading accesstype.js

new AccessType()
Instance Members
version()
init(config)
setUser(user)
unsetUser()
getAllPaymentOptions()
getPaymentOptions(transactionAmountCents, subscriptionPlan, contextType)
getAssetPlans(asset)
getSubscriptionPlans()
isAssetAccessible(asset, disableMeter)
pingbackAssetAccess(asset, accessGrant)
previewSubscription(subscriptionParams)
createSubscription(subscriptionParams)
validateCoupon(params)
validateVoucher(params)
getSubscriptions()
getSubscriptionWithSwitchablePlans(subscriptionId, switchType)
updateSubscription(subscriptionId, updateParams)
getSubscriptionGifts()
cancelSubscription(subscriptionId)
getAssets()
getRewards()
resetWallets()
downloadInvoice(subscriptionId, invoiceId)
isPrivateMode()
getReferralVoucher()
getCampaignSubscriptionPlans()
getSubscriberMetadata()
setSubscriberMetadata(subscriberMetadata)

DurationUnit

Represents duration unit

DurationUnit

Type: ("months" | "weeks" | "years")

SubscriptionType

Represents valid subscription types

SubscriptionType

Type: ("standard" | "dynamic_asset")

AssetType

Represents supported asset type

AssetType

Type: "story"

Environment

Represents environment

Environment

Type: ("production" | "sandbox")

User

Represents a user

User

Type: {accesstypeJwt: string?, isLoggedIn: boolean?, readerId: string?, accesstypeJwtUrl: string?, readerIdUrl: string?, name: string?, emailAddress: string?, mobileNumber: string?}

Properties
accesstypeJwt (string?)
isLoggedIn (boolean?)
readerId (string?)
accesstypeJwtUrl (string?)
readerIdUrl (string?)
name (string?)
emailAddress (string?)
mobileNumber (string?)

SubscriptionPlan

Represents a subscription plan

SubscriptionPlan

Type: {id: string, title: string?, description: string?, price_cents: number, price_currency: string, duration_length: number, duration_unit: DurationUnit, supported_payment_providers: Array<string>?}

Properties
id (string)
title (string?)
description (string?)
price_cents (number)
price_currency (string)
duration_length (number)
duration_unit (DurationUnit)
supported_payment_providers (Array<string>?)

SubscriptionAsset

Represents an Asset

SubscriptionAsset

Type: {id: string, title: string, slug: string}

Properties
id (string)
title (string)
slug (string)

PaymentParams

Represents payment request params payment_type is one of the supported payment types like 'razorpay', 'stripe', 'paypal', 'juspay', etc

PaymentParams

Type: {payment_type: string, amount_cents: string, amount_currency: string}

Properties
payment_type (string)
amount_cents (string)
amount_currency (string)

SubscriptionParams

Represents SubscriptionParams which encapsulates the parameters required to make a subscription

SubscriptionParams

Type: {type: SubscriptionType, plan: SubscriptionPlan, payment: PaymentParams, assets: Array<SubscriptionAsset>?, additional_data: Object?, coupon_code: string?, options: Object?, recipient_subscriber: Object?}

Properties
payment (PaymentParams)
additional_data (Object?)
coupon_code (string?)
options (Object?)
recipient_subscriber (Object?)

SubscriptionMetadata

Represents metadata fields required to be updated

SubscriptionMetadata

Type: {metadata: Object}

Properties
metadata (Object)

SubscriberMetadata

Represents subscriber metadata fields

SubscriberMetadata

Type: {address: Object, phone_number: string?, other: Object?}

Properties
address (Object)
phone_number (string?)
other (Object?)

InitConfig

Represents InitConfig which encapsulates initialization params. Used internally only.

InitConfig

Type: {accesstype_host: string, account_key: string, account_name: string, payment_providers: {}, env: Environment}

Properties
accesstype_host (string)
account_key (string)
account_name (string)
payment_providers ({})
env (Environment)

PurchaseableAsset

Represent a purchaseable asset

PurchaseableAsset

Type: {id: string, type: AssetType}

Properties
id (string)
type (AssetType)

PaymentOption

Represents a payment option

For simpl, possible values for action = 'link' | 'pay'

For razorpay, possible values for action = 'pay'

When action is 'pay', proceed(params: SubscriptionParams)

When action is 'link', proceed()

PaymentOption

Type: {action: string, proceed: function (): Promise<any>}

Properties
action (string)
proceed (function (): Promise<any>)

PaymentOptions

Represents payment options for current user with this publisher

PaymentOptions

Type: {}

Error

Represents error response

Error

Type: {code: string, message: string}

Properties
code (string)
message (string)

CouponValidationRequest

Represents a coupon validation request

CouponValidationRequest

Type: {subscriptionPlanId: string, couponCode: string}

Properties
subscriptionPlanId (string)
couponCode (string)

VoucherValidationRequest

Represents a voucher validation request

VoucherValidationRequest

Type: {subscriptionPlanId: string, voucher: string}

Properties
subscriptionPlanId (string)
voucher (string)

DiscountDetails

Represents coupon discount

DiscountDetails

Type: {code: string, discount_type: string, title: string, value: number, discounted_price_cents: number, price_cents: number, price_currency: string}

Properties
code (string)
discount_type (string)
title (string)
value (number)
discounted_price_cents (number)
price_cents (number)
price_currency (string)

CouponValidationResponse

Represents coupon validation response

new CouponValidationResponse()

Asset

Represents an Asset

Asset

Type: {id: string, type: AssetType, attributes: AssetAttributes}

Properties
id (string)
type (AssetType)
attributes (AssetAttributes)

GrantReason

Reason for access grant

GrantReason

Type: ("SUBSCRIBER" | "METERING")

AccessGrant

Represents an AccessGrant

AccessGrant

Type: {granted: Boolean, grantReason: GrantReason, data: Object}

Properties
granted (Boolean)
grantReason (GrantReason)
data (Object)