Monetization

Monetization

Provides features related to monetization

Constructor

new Monetization(options)

Source:
Parameters:
Name Type Description
options object
Properties
Name Type Attributes Default Description
clientId string

Mandatory client id

redirectUri string <optional>

Redirect uri

sessionDomain string

Example: "https://id.site.com"

env string <optional>
PRE

Schibsted account environment: PRE, PRO or PRO_NO

window object <optional>
Throws:
  • If any of options are invalid
Type
SDKError

Classes

Monetization

Methods

(async) hasAccess(productIds, userId) → {Object|null}

Source:

Checks if the user has access to a set of products or features.

Parameters:
Name Type Description
productIds array

which products/features to check

userId number

id of currently logged in user

Throws:
  • If the input is incorrect, or a network call fails in any way (this will happen if, say, the user is not logged in)
Type
SDKError
Returns:

The data object returned from Schibsted account (or null if the user doesn't have access to any of the given products/features)

Type
Object | null

clearCachedAccessResult(productIds, userId) → {void}

Source:

Removes the cached access result.

Parameters:
Name Type Description
productIds array

which products/features to check

userId number

id of currently logged in user

Returns:
Type
void

subscriptionsUrl(redirectUriopt) → {string}

Source:

Get the url for the end user to review the subscriptions

Parameters:
Name Type Attributes Default Description
redirectUri string <optional>
this.redirectUri
Returns:
  • The url to the subscriptions review page
Type
string

productsUrl(redirectUriopt) → {string}

Source:

Get the url for the end user to review the products

Parameters:
Name Type Attributes Default Description
redirectUri string <optional>
this.redirectUri
Returns:
  • The url to the products review page
Type
string