Github repository: ok-js-sdk
App examples using SDK: ok-js-sdk/samples
With this SDK you can:
Setting up and configuring SDK
Before setting up External SDK check your application’s settings:
- MOBILE_HTML or External platform should be enabled;
- for MOBILE_HTML apps:
- callback url must be specified for payments to work correctly;
- for External apps:
- client OAuth authorization is enabled;
- redirect_uri field contains an url that will be used for authorization process;
- all required permissions are enabled. It is highly recommended to enable LONG_ACCESS_TOKEN permission for native IOS and Android applications.
To enable External SDK in your project you need to:
copy oksdk.js file from repository to your project;
enable this script on your page, i.e:
- OKSDK.init - OK SDK initialization.
This method must be invoked once before using any other SDK method (i.e. on app launch).
OK REST API
- OKSDK.REST.call - OK REST API methods call;
- OKSDK.REST.calcSignature - calculate a signature for REST API method call.
- OKSDK.Payment.show - open in-app payment dialog on a new page;
- OKSDK.Payment.showInFrame - open in-app payment dialog in an embedded iframe;
- OKSDK.Payment.closePaymentFrame - close in-app payment opened in an iframe;
- OKSDK.Payment.query - generate URL for processing in-app payment.
In-app video ads
- OKSDK.Ads.init - ads API initialization;
- OKSDK.Ads.prepareMidroll - request a video ad;
- OKSDK.Ads.showMidroll - shown found video ad;
- OKSDK.Ads.destroy - delete ad widget.
- OKSDK.Widgets.post - publish a topic to user’s feed via publishing widget;
- OKSDK.Widgets.invite - invite a friend to a game via invite/suggest widget;
- OKSDK.Widgets.suggest - send a notification from game to a friend via invite/suggest widget.