From a480b8c42871eb11b5ec87a40a0f735ea29a31e0 Mon Sep 17 00:00:00 2001 From: liljanadimovska <82022673+liljanadimovska@users.noreply.github.com> Date: Mon, 21 Jun 2021 13:03:47 +0200 Subject: [PATCH 1/7] update-jssdk-methods Updating JS SDK methods to comply with netlify --- docs/jssdk.md | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/docs/jssdk.md b/docs/jssdk.md index 3512a509..edc6de87 100644 --- a/docs/jssdk.md +++ b/docs/jssdk.md @@ -51,7 +51,7 @@ InPlayer.Account.signUp({ type: 'consumer', referrer: 'http://localhost:3000/', metadata: { - city: 'Skopje' + country: 'Macedonia' } }).then(data => console.log(data)); ``` @@ -75,6 +75,8 @@ InPlayer.Account.authenticate({ 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)); ``` @@ -127,7 +129,7 @@ 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). @@ -153,7 +155,9 @@ InPlayer.Payment accessFee: 2341, paymentMethod: 1, referrer: 'http://example-website.com', - voucherCode: 'fgh1982gff-0f2grfds' + voucherCode: 'fgh1982gff-0f2grfds', + brandingId: 1234, + returnUrl: 'https://event.inplayer.com/staging' }) .then(data => console.log(data)); ``` @@ -171,7 +175,9 @@ InPlayer.Subscription accessFee: 2341, paymentMethod: 1, referrer: 'http://example-website.com', - voucherCode: 'fgh1982gff-0f2grfds' + voucherCode: 'fgh1982gff-0f2grfds', + brandingId: 1234, + returnUrl: 'https://event.inplayer.com/staging' }) .then(data => console.log(data)); ``` @@ -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 }).then(data => { /* handle paypal data here */ } ``` @@ -210,11 +217,11 @@ To create the 'My Account' menu for a logged in customer, you need the following ### Fetching Account Details -By passing in the authorisation token, you can fetch all the account details using the `getAccountInfo` method. +By passing in the authorisation token, you can fetch all the account details using the `getAccount` method. ```js InPlayer.Account -.getAccountInfo(InPlayer.Account.token()) +.getAccount(InPlayer.Account.token()) .then(data => console.log(data)) .catch(error => error.response.json().then(data => console.log("Error", data))); ``` @@ -223,7 +230,7 @@ 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))); ``` From 1d743a6bd1259937db3b002290b5cd887bd26189 Mon Sep 17 00:00:00 2001 From: liljanadimovska <82022673+liljanadimovska@users.noreply.github.com> Date: Mon, 21 Jun 2021 16:24:37 +0200 Subject: [PATCH 2/7] Update jssdk.md --- docs/jssdk.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/jssdk.md b/docs/jssdk.md index edc6de87..336bf839 100644 --- a/docs/jssdk.md +++ b/docs/jssdk.md @@ -58,7 +58,7 @@ InPlayer.Account.signUp({ 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 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 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. From d0cc7af123d0a1ee7ea4dcc1242e7a3d44578300 Mon Sep 17 00:00:00 2001 From: liljanadimovska <82022673+liljanadimovska@users.noreply.github.com> Date: Mon, 21 Jun 2021 17:18:18 +0200 Subject: [PATCH 3/7] Update jssdk.md --- docs/jssdk.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/jssdk.md b/docs/jssdk.md index 336bf839..ff8a916f 100644 --- a/docs/jssdk.md +++ b/docs/jssdk.md @@ -58,7 +58,7 @@ InPlayer.Account.signUp({ 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 `clientId`. 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. From 660d637e46c3269b47caf3ce2bce9b09d2fb9a5f Mon Sep 17 00:00:00 2001 From: liljanadimovska <82022673+liljanadimovska@users.noreply.github.com> Date: Tue, 22 Jun 2021 11:43:36 +0200 Subject: [PATCH 4/7] Update jssdk.md Expanded the guide with integration checklist. --- docs/jssdk.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/jssdk.md b/docs/jssdk.md index ff8a916f..4cfd32ce 100644 --- a/docs/jssdk.md +++ b/docs/jssdk.md @@ -236,6 +236,18 @@ InPlayer.Account ``` +## 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) From 1ff62d66ae8568ea01634f6b3eb96bf042662cbf Mon Sep 17 00:00:00 2001 From: liljanadimovska <82022673+liljanadimovska@users.noreply.github.com> Date: Fri, 6 Aug 2021 12:26:48 +0200 Subject: [PATCH 5/7] Update jssdk.md --- docs/jssdk.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/jssdk.md b/docs/jssdk.md index 4cfd32ce..c274c3e6 100644 --- a/docs/jssdk.md +++ b/docs/jssdk.md @@ -71,7 +71,7 @@ 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', @@ -82,7 +82,7 @@ InPlayer.Account.authenticate({ Having the account logged in, you should be able to see an object containing the **InPlayer auth token** in `localStogare`. -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: @@ -146,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, @@ -155,18 +155,18 @@ InPlayer.Payment accessFee: 2341, paymentMethod: 1, referrer: 'http://example-website.com', - voucherCode: 'fgh1982gff-0f2grfds', - brandingId: 1234, 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, @@ -175,13 +175,13 @@ InPlayer.Subscription accessFee: 2341, paymentMethod: 1, referrer: 'http://example-website.com', - voucherCode: 'fgh1982gff-0f2grfds', - brandingId: 1234, 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: @@ -204,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))); ``` @@ -217,11 +217,11 @@ To create the 'My Account' menu for a logged in customer, you need the following ### Fetching Account Details -By passing in the authorisation token, you can fetch all the account details using the `getAccount` method. +You can fetch all the account details by using the `getAccountInfo` method. ```js InPlayer.Account -.getAccount(InPlayer.Account.token()) +.getAccountInfo() .then(data => console.log(data)) .catch(error => error.response.json().then(data => console.log("Error", data))); ``` From f90a6a21df8b3a1d8a26f296b4018ada2fa33fa6 Mon Sep 17 00:00:00 2001 From: liljanadimovska <82022673+liljanadimovska@users.noreply.github.com> Date: Fri, 6 Aug 2021 12:33:11 +0200 Subject: [PATCH 6/7] Update jssdk.md --- docs/jssdk.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/jssdk.md b/docs/jssdk.md index c274c3e6..e3aed52e 100644 --- a/docs/jssdk.md +++ b/docs/jssdk.md @@ -136,7 +136,7 @@ After the end-user has chosen both the price option and the preferred payment me ### 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)); From 96506d7f3340d8d47c70bbffdeee40aac19ecab4 Mon Sep 17 00:00:00 2001 From: liljanadimovska <82022673+liljanadimovska@users.noreply.github.com> Date: Mon, 6 Sep 2021 16:19:10 +0200 Subject: [PATCH 7/7] Update jssdk.md localStogare -> localStorage typo --- docs/jssdk.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/jssdk.md b/docs/jssdk.md index e3aed52e..6e01b0e7 100644 --- a/docs/jssdk.md +++ b/docs/jssdk.md @@ -80,7 +80,7 @@ InPlayer.Account.signIn({ }).then(data => console.log(data)); ``` -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.getToken()` call. Additionally, you may call `InPlayer.Account.isAuthenticated()` to check if someone is logged in or not.