This repository was archived by the owner on Oct 2, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
update-jssdk-methods #136
Open
liljanadimovska
wants to merge
7
commits into
master
Choose a base branch
from
update-jssdk-methods
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
update-jssdk-methods #136
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a480b8c
update-jssdk-methods
liljanadimovska 1d743a6
Update jssdk.md
liljanadimovska d0cc7af
Update jssdk.md
liljanadimovska 660d637
Update jssdk.md
liljanadimovska 1ff62d6
Update jssdk.md
liljanadimovska f90a6a2
Update jssdk.md
liljanadimovska 96506d7
Update jssdk.md
liljanadimovska File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,14 +51,14 @@ InPlayer.Account.signUp({ | |
| type: 'consumer', | ||
| referrer: 'http://localhost:3000/', | ||
| metadata: { | ||
| city: 'Skopje' | ||
| country: 'Macedonia' | ||
| } | ||
| }).then(data => console.log(data)); | ||
| ``` | ||
|
|
||
| Among the parameters, `fullName`, `email`, `password`, `passwordConfirmation`, `type`, and `clientId` are always **required**. | ||
|
|
||
| Before you start using the Inplayer SDK, we suggest that you create a new **OAUTH application** from our Dashboard and obtain your `clinetId`. In case you haven’t got an OAUTH application yet, you can use your account **UUID** as `clientId`. To find your UUID navigate to InPlayer Dashboard's 'Account' section, in the top right-hand corner menu. | ||
| Before you start using the Inplayer SDK, we suggest that you create a new [**OAUTH application** from our Dashboard](https://client.support.inplayer.com/settings/oauth-sso/#oauth-4) and obtain your `clientId`. In case you haven’t got an OAUTH application yet, you can use your account **UUID** as `clientId`. To [find your UUID](https://client.support.inplayer.com/the-dashboard/account/#basic-details-4) navigate to InPlayer Dashboard's 'Account' section, in the top right-hand corner menu. | ||
|
|
||
| The `type` parameter can be either `consumer` or `merchant`. In case you want to create merchant accounts via the API, you will have to use InPlayer's public UUID for the `clientId` parameter. | ||
|
|
||
|
|
@@ -71,16 +71,18 @@ Lastly, the `referrer` parameter can be passed in manually for every register re | |
| Authentication can be achieved using the `InPlayer.Account.authenticate()` method. | ||
|
|
||
| ```javascript | ||
| InPlayer.Account.authenticate({ | ||
| InPlayer.Account.signIn({ | ||
| email: 'test32@test.com', | ||
| password: '12345678', | ||
| clientId: 'd20252cb-d057-4ce0-83e0-63da6dbabab1', | ||
| referrer: 'http://localhost:3000/', | ||
| refreshToken: '528b1b80-ddd1hj-4abc-gha3j-111111', | ||
| }).then(data => console.log(data)); | ||
| ``` | ||
|
|
||
Jasminna marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Having the account logged in, you should be able to see an object containing the **InPlayer auth token** in `localStogare`. | ||
| Having the account logged in, you should be able to see an object containing the **InPlayer auth token** in `localStorage`. | ||
|
|
||
| If you need to make additional calls, in the name of the authenticated account, you can fetch the token with the `InPlayer.Account.token()` call. Additionally, you may call `InPlayer.Account.isSignedIn()` to check if someone is logged in or not. | ||
| If you need to make additional calls, in the name of the authenticated account, you can fetch the token with the `InPlayer.Account.getToken()` call. Additionally, you may call `InPlayer.Account.isAuthenticated()` to check if someone is logged in or not. | ||
|
|
||
| For the account sign out operation use the following call: | ||
|
|
||
|
|
@@ -127,14 +129,14 @@ InPlayer.subscribe(InPlayer.Account.token(), { | |
| The InPlayer platform enables you to create digital assets to which afterwards you can attach a **price** with **currency** and **access period**, in order to create **access fees**. The `AccessFee` resource holds data of the asset’s price, and the time-frame of the **access duration period**. The access period resource refers to the **access type** which might be of the **pay-per-view** or **subscription** model. This will be elaborated further on in this tutorial. Once you have created the desired asset with price options (conducted in the Dashboard or via the API), you can fetch and present the fees by invoking the function below. | ||
|
|
||
| ```js | ||
| InPlayer.Asset.getAccessFees({ASSET_ID}).then(data => { //do something with data } | ||
| InPlayer.Asset.getAssetAccessFees({ASSET_ID}).then(data => { //do something with data } | ||
| ``` | ||
|
|
||
| After the end-user has chosen both the price option and the preferred payment method, depending on the access type, you can either invoke the function for creating one-time purchases (pay-per-view) or the one for subscription (recurring card payment). | ||
|
|
||
| ### Creating Payments | ||
|
|
||
| The InPlayer Platform supports two methods of carrying out payments – by **card** and by **PayPal**. In order to create payment, first you must find and fetch the preferred method. | ||
| The InPlayer Platform supports the following methods of carrying out payments – by **card**, by **PayPal**, by **DirectDebit**, by **iDEAL**, by **Google**, by **Apple pay**,. In order to create payment, first you must find and fetch the preferred method. | ||
|
|
||
| ```javascript | ||
| InPlayer.Payment.getPaymentMethods(MERCHANT_UUID).then(data => console.log(data)); | ||
|
|
@@ -144,7 +146,7 @@ InPlayer.Payment.getPaymentMethods(MERCHANT_UUID).then(data => console.log(data) | |
|
|
||
| ```javascript | ||
| InPlayer.Payment | ||
| .create(MERCHANT_UUID, { | ||
| .createPayment(MERCHANT_UUID, { | ||
| number: 4111111111111111, | ||
| cardName: 'Example Name', | ||
| expMonth: 10, | ||
|
|
@@ -153,16 +155,18 @@ InPlayer.Payment | |
| accessFee: 2341, | ||
Jasminna marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| paymentMethod: 1, | ||
| referrer: 'http://example-website.com', | ||
| voucherCode: 'fgh1982gff-0f2grfds' | ||
| returnUrl: 'https://event.inplayer.com/staging' | ||
| }) | ||
| .then(data => console.log(data)); | ||
| ``` | ||
|
|
||
| The parameters `voucherCode`, `brandingId`, `isGift` and `receiverEmail` are optional parameters that can be added to the method. | ||
|
|
||
| ### Creating Recurring Card Subscriptions | ||
|
|
||
| ```javascript | ||
| InPlayer.Subscription | ||
| .create(MERCHANT_UUID, { | ||
| .createSubscription(MERCHANT_UUID, { | ||
| number: 4111111111111111, | ||
| cardName: 'Example Name', | ||
| expMonth: 10, | ||
|
|
@@ -171,11 +175,13 @@ InPlayer.Subscription | |
| accessFee: 2341, | ||
Jasminna marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| paymentMethod: 1, | ||
| referrer: 'http://example-website.com', | ||
| voucherCode: 'fgh1982gff-0f2grfds' | ||
| returnUrl: 'https://event.inplayer.com/staging' | ||
| }) | ||
| .then(data => console.log(data)); | ||
| ``` | ||
|
|
||
| The parameters `voucherCode`, `brandingId`, `isGift` and `receiverEmail` are optional parameters that can be added to the method. | ||
|
|
||
| ### Creating PayPal Payments | ||
|
|
||
| To make PayPal payments you will need an additional call to fetch the payment details: | ||
|
|
@@ -185,7 +191,8 @@ InPlayer.Payment.getPayPalParams(InPlayer.Account.token(), { | |
| origin: window.location.href, | ||
| accessFee: ACCESS_FEE_ID, | ||
| paymentMethod: 2, | ||
| voucherCode: 'some voucher code here' (not mandatory) | ||
| voucherCode: 'SomeVoucherCodeHere', /* not mandatory */ | ||
| brandingId: 1234 | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are the |
||
| }).then(data => { /* handle paypal data here */ } | ||
| ``` | ||
|
|
||
|
|
@@ -197,7 +204,7 @@ In order to check whether a given account can access a certain asset, you should | |
|
|
||
| ```javascript | ||
| InPlayer.Asset | ||
| .checkAccessForAsset(InPlayer.Account.token(),ASSET_ID) | ||
| .checkAccessForAsset(ASSET_ID) | ||
| .then(data => console.log(data)) | ||
| .catch(error => error.response.json().then(data => console.log("Error", data))); | ||
| ``` | ||
|
|
@@ -210,11 +217,11 @@ To create the 'My Account' menu for a logged in customer, you need the following | |
|
|
||
Jasminna marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ### Fetching Account Details | ||
|
|
||
| By passing in the authorisation token, you can fetch all the account details using the `getAccountInfo` method. | ||
Jasminna marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| You can fetch all the account details by using the `getAccountInfo` method. | ||
|
|
||
| ```js | ||
| InPlayer.Account | ||
| .getAccountInfo(InPlayer.Account.token()) | ||
| .getAccountInfo() | ||
| .then(data => console.log(data)) | ||
| .catch(error => error.response.json().then(data => console.log("Error", data))); | ||
| ``` | ||
|
|
@@ -223,12 +230,24 @@ InPlayer.Account | |
|
|
||
| ```js | ||
| InPlayer.Account | ||
| .updateAccount({fullName: 'John Doe', metadata: {country: 'Example Country'}},InPlayer.Account.token()) | ||
| .updateAccount({fullName: 'John Doe', metadata: {country: 'Example Country'}, dateOfBirth: '1999-03-05'}},InPlayer.Account.token()) | ||
| .then(data => console.log(data)) | ||
| .catch(error => error.response.json().then(data => console.log("Error", data))); | ||
| ``` | ||
|
|
||
|
|
||
| ## Integration checklist | ||
|
|
||
| Use the following checklist to make sure you have set up the SDK for JavaScript correctly. | ||
|
|
||
| - [Installing the SDK](https://developers.inplayer.com/docs/jssdk#installing-the-sdk) | ||
| - [Setting up the SDK](https://developers.inplayer.com/docs/jssdk#setting-up-the-sdk) | ||
| - [Setting up the registration process](https://developers.inplayer.com/docs/jssdk#how-to-register-an-account) | ||
| - [Handling account authentication](https://developers.inplayer.com/docs/jssdk#how-to-authenticate-an-account) | ||
| - [Activating notifications](https://developers.inplayer.com/docs/jssdk#real-time-notifications) | ||
| - [Creating payments for assets](https://developers.inplayer.com/docs/jssdk#how-to-create-payments) | ||
| - [Validating content access](https://developers.inplayer.com/docs/jssdk#how-to-validate-content-access) | ||
| - [Enabling 'My Account' menu for customer](https://developers.inplayer.com/docs/jssdk#how-to-create-the-my-account-menu) | ||
|
|
||
|
|
||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.