Methods

Methods

(async, inner) identifyClient(token) → {Promise<{userId, contentId, transactionId, subscriptionId, hasAccessRights, allowedMethods, phone, userIdToken}>}

Identifies, authenticates and authorizes user and returns userId and user phone

Parameters:
Name Type Description
token String

JWT token, signed with HS265 alorithm, containing purchase payload

Source:
Throws:

throws error containing error code and reason if function fails.

Type
error

(async, inner) purchase(purchase) → {Promise<{userId, jwtToken, contentId, transactionId, hasAccessRights, allowedMethods}>}

Initializes one time purchase. Returns success, failure or need for SMS authentication

Parameters:
Name Type Description
purchase Object

input object containing token and userId

Properties
Name Type Description
token String

JWT token, signed with HS265 alorithm, containing purchase payload

userId String

Zlick userID

Source:
Throws:

throws error containing error code and reason if function fails.

Type
error

(async, inner) refundPurchase(refundPurchase) → {Promise<{userId, jwtToken, contentId, transactionId, hasAccessRights, allowedMethods}>}

Refunds purchase and cancels permission to view content

Parameters:
Name Type Description
refundPurchase Object

input object containing token and userId

Properties
Name Type Description
token String

JWT token, signed with HS265 alorithm, containing purchase payload

userId String

Zlick userID

refundReason string

reason to refund purchase

Source:
Throws:

throws error containing error code and reason if function fails.

Type
error

(async, inner) sendPinCodeSMS(sendPinCodeSMS) → {Promise<{allowedMethods, challengeId}>}

Starts SMS authentication

Parameters:
Name Type Description
sendPinCodeSMS Object

input object containing token and userId

Properties
Name Type Description
token String

JWT token, signed with HS265 alorithm, containing purchase payload

mobilePhoneNumber String

customer mobile number that starts SMS authentication

Source:
Throws:

throws error containing error code and reason if function fails.

Type
error

(async, inner) subscribe(subscribe) → {Promise<{userId, jwtToken, contentId, subscriptionId, hasAccessRights, allowedMethods}>}

subsribes to monthly / weekly / daily subscription

Parameters:
Name Type Description
subscribe Object

input object containing token and userId

Properties
Name Type Description
token String

JWT token, signed with HS265 alorithm, containing purchase payload

userId String

Zlick userID

Source:
Throws:

throws error containing error code and reason if function fails.

Type
error

(async, inner) unsubscribe(unsubscribe) → {Promise<{userId, jwtToken, contentId, transactionId, hasAccessRights, allowedMethods}>}

Cancels subscription. Content will be available to user until expire date.

Parameters:
Name Type Description
unsubscribe Object

input object containing token and userId

Properties
Name Type Description
token String

JWT token, signed with HS265 alorithm, containing purchase payload

userId String

Zlick userID

Source:
Throws:

throws error containing error code and reason if function fails.

Type
error

(async, inner) verifyPinCode(verifyPinCode) → {Promise<{userId, jwtToken, contentId, transactionId, subscriptionId, hasAccessRights, allowedMethods}>}

completes SMS authentication

Parameters:
Name Type Description
verifyPinCode Object

input object containing token and userId

Properties
Name Type Description
token String

JWT token, signed with HS265 alorithm, containing purchase payload

confirmationCode String

4 digit confirmation code sent to customers mobile number via SMS

challengeId String

id created by zlick and sent via smsAuthStart method to verify mobile number and challenge ID

Source:
Throws:

throws error containing error code and reason if function fails.

Type
error