Available as a global variable on loading accesstype.js
Returns version of the javascript
Initializes AccessTypeJS with publisher specific configuration. This is an internal method and will be invoked as part of script initialization in Access Type JS script itself
(InitConfig)
Unset user context when user logs out
void
Returns all the payment options enabled for the account. It doesn't require the user to be set in AT.
Promise<PaymentOptions>
Returns payment options available for the given user for a given transaction amount Payable amount has to be sent as transactionAmountCents, it's generally the price_cents of plan discounted_price_cents from discount_details has to be sent as transactionAmountCents if a coupon code is applied. subscriptionPlan object can be sent as second parameter to return only the payment gateways the plan supports. Both parameters are optional.
Promise<PaymentOptions>
Returns subscription plans for given param
(PurchaseableAsset)
Promise<Array<SubscriptionPlan>>
Returns list of subscription plans across all subscription groups
Promise<Array<SubscriptionPlan>>
Returns if the user has access to an asset or not, along with its reason.
(PurchaseableAsset)
(boolean?)
Promise<AccessGrant>
To be used for updating the meter after asset is accessed.
(PurchaseableAsset)
(AccessGrant)
Promise<any>
Preview subscription independently without using the callbacks in getPaymentOptions. Useful for integrating with payment options that AccessTypeJS does not have first class support for
(SubscriptionParams)
Promise<any>
Create subscription independently without using the callbacks in getPaymentOptions. Useful for integrating with payment options that AccessTypeJS does not have first class support for
(SubscriptionParams)
Promise<any>
Validate coupon with plan
(CouponValidationRequest)
Promise<CouponValidationResponse>
Validate voucher with plan
(VoucherValidationRequest)
Promise<VoucherValidationRequest>
update metadata for a subscription
(number)
(SubscriptionMetadata)
Promise<any>
Check if browser is in private mode
Get campaign subscription plans
Promise<Array<SubscriptionPlan>>
set metadata for a subscriber
(SubscriberMetadata)
Promise<any>
Represents duration unit
Type:
("months"
| "weeks"
| "years"
)
Represents valid subscription types
Type:
("standard"
| "dynamic_asset"
)
Represents supported asset type
Type:
"story"
Represents environment
Type:
("production"
| "sandbox"
)
Represents a user
Type: {accesstypeJwt: string?, isLoggedIn: boolean?, readerId: string?, accesstypeJwtUrl: string?, readerIdUrl: string?, name: string?, emailAddress: string?, mobileNumber: string?}
Represents a subscription plan
Type: {id: string, title: string?, description: string?, price_cents: number, price_currency: string, duration_length: number, duration_unit: DurationUnit, supported_payment_providers: Array<string>?}
Represents an Asset
Type: {id: string, title: string, slug: string}
Represents payment request params payment_type is one of the supported payment types like 'razorpay', 'stripe', 'paypal', 'juspay', etc
Type: {payment_type: string, amount_cents: string, amount_currency: string}
Represents SubscriptionParams which encapsulates the parameters required to make a subscription
Type: {type: SubscriptionType, plan: SubscriptionPlan, payment: PaymentParams, assets: Array<SubscriptionAsset>?, additional_data: Object?, coupon_code: string?, options: Object?, recipient_subscriber: Object?}
(SubscriptionType)
(SubscriptionPlan)
(PaymentParams)
(Array<SubscriptionAsset>?)
(Object?)
(string?)
(Object?)
(Object?)
Represents metadata fields required to be updated
Type: {metadata: Object}
(Object)
Represents subscriber metadata fields
Type: {address: Object, phone_number: string?, other: Object?}
Represents InitConfig which encapsulates initialization params. Used internally only.
Type: {accesstype_host: string, account_key: string, account_name: string, payment_providers: {}, env: Environment}
(string)
(string)
(string)
({})
(Environment)
Represent a purchaseable asset
Type: {id: string, type: AssetType}
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()
Type: {action: string, proceed: function (): Promise<any>}
Represents payment options for current user with this publisher
Type: {}
Represents error response
Type: {code: string, message: string}
Represents a coupon validation request
Type: {subscriptionPlanId: string, couponCode: string}
Represents a voucher validation request
Type: {subscriptionPlanId: string, voucher: string}
Represents coupon discount
Type: {code: string, discount_type: string, title: string, value: number, discounted_price_cents: number, price_cents: number, price_currency: string}
Represents coupon validation response
Represents an Asset
Type: {id: string, type: AssetType, attributes: AssetAttributes}
Reason for access grant
Type:
("SUBSCRIBER"
| "METERING"
)
Represents an AccessGrant
Type: {granted: Boolean, grantReason: GrantReason, data: Object}