Step1: Load JSSDK File
<script type="text/javascript" src="https://h-cdn.pengpengla.com/up/opengamejs/1.3.8/assets/seed.js"></script> |
Please confirm that the sdk resource have been integrated to your game html before using it.
- Download JSSDK:
- 1.3.1[Stabled, and support AD]: https://h-cdn.pengpengla.com/up/opengamejs/1.3.8/assets/seed.js
- View JSSDK DEMO:http://sg-oauth-demo.pengpengla.com:8000/index.html
- Download JSSDK DEMO:http://sg-oauth-demo.pengpengla.com:8000/openplatform_demo.zip
Step2: Initialize JSSDK
must confirm that method called openSdk.init
was invoked before using other APIs openSdk
provide.
openSdk.init(Object object)
Arguments
Object object
Parameter | Necessary | Default | Description |
---|---|---|---|
env | No | pro | Define current server data environment. stage :test server data environment. pro : product server data environment |
client_id | YES | The unique id for developer, can get it from Funpepper platform | |
game_id | YES | The unique id for game, also can get it from Funpepper platform | |
mode | YES | game currency mode, two options ‘diamond/gold/ad’ |
Example
openSdk.init({ |
Step3: APIs
openSdk.oauth(Object object)
This method can help you get a new authorization code from Funpepper platform, and the new code will be appended to the game link after the authorization process is completed.
Arguments
Object object
Parameter | Necessary | Description |
---|---|---|
redirect_url | Yes | This is a url that will jump after authorization is done, and the url was configured for the game on Funpepper platform, certainly you can get it from the game config. |
Example
openSdk.oauth({ |
openSdk.recharge(Object object)
used to help user recharge game currency.
Arguments
Object object
Parameter | Necessary | Description |
---|---|---|
upliveCode | YES | The unique id for Funpepper user |
lang | YES | Language code, tell game which language version should be displayed for user |
counytryCode | YES | country code of users, developer could get it from our server APIs |
success | NO | The callback method after successful recharge |
fail | NO | The callback method after failure rechare |
cancel | NO | The callback method after cancellation of rechare. |
Example
openSdk.recharge({ |
openSdk.ping(Object object)
Certainly confirm that the method will be invoked when any user enter your game page, due to this determine PV and UV data statistics.
Arguments
Object object
Parameter | Necessary | Description |
---|---|---|
open_id | YES | The unique user id of Funpepper in your application |
success | NO | The callback method after successful ping. |
Example
openSdk.ping({ |
openSdk.quitGame()
Quit the game and return to the home page.
Example
openSdk.quitGame(); |
openSdk.receiver(Number)
In the gold mode, the game must invoke this method after giving golden incentives to users. When the balance of gold coins reaches a certain amount, such as 5000, 20000, 50000, the user will be prompted to exchange uDiamonds in the pop-up window. This logic is automatically handled by SDK, and the game does not need to care.
[Note] In the uDiamonds mode, the game does not need to call this method.
Arguments
The number is the gold balance in the user’s account after the gold award is given to the user.
Example
openSdk.receiver(10000); |
openSdk.getGold(object object)
In the gold mode, this method is called when the amount required for a single bet is larger than the balance of the user.
Detailed steps:
- When the balance is insufficient, the game handles the first bullet window by itself, and the bullet window copy is set as: “Gold coin is insufficient, try to get free gold by lucky?”
- When the user clicks the confirmation button on the pop-up window, the method can be invoked.
[Note] In the uDiamonds mode, the game does not need to call this method.
Arguments
Object object
Parameter | Necessary | Description |
---|---|---|
open_id | YES | The unique user id of Funpepper in your application |
getGoldSuccess | YES | The game usually refreshes the user’s gold balance in the callback function, which receives the free gold successfully. |
Example
openSdk.getGold({ |
openSdk.showLandingVideo(object object)
LandingPage Video Advertising Page, LandingPage contains game ICON, game description, game start button and banner video.
Arguments
Object object
Parameter | Necessary | Description |
---|---|---|
start | YES | callback when user click the “Start Game” button. |
Example
openSdk.ads.showLandingVideo({ |
openSdk.showRewardVideo(object object)
Video Advertising - Reward Video。The advertisement allows developers to encourage users to complete the video, so that SDK will trigger the reward conditions。When the user completes the browsing task of the incentive video,The SDK will trigger the success
method to tell the developer to send the corresponding incentive
Arguments
Object object
Parameter | Necessary | Description |
---|---|---|
open_id | YES | The unique user id of Funpepper in your application |
success | YES | When the user completes the browsing task of the incentive video,The SDK will trigger the success method to tell the developer to send the corresponding incentive |
close | YES | The callback when the advertisement is closed。When the video is turned off when the user is not watching, the value of the return is false. When the user watches the video and hits the closing button in the introduction page, the value of the return is true. |
error | YES | Error callback。callback when SDK can’t get the advertiserment |
Example
openSdk.ads.showRewardVideo({ |