This repository contains the open source SDK for integrating Gameball's API into your NodeJs app. The Gameball NodeJS SDK provides convinient access to the Gameball API frpm applicatopns written in the JavaScript langauage.
Please refer to the Gameball API docs.
You don't need this source code unless you want to modify the SDK. If you just want to use the SDK, just run:
npm install gameball-nodejs-sdk
The SDK needs to be configured with your account's API & Transaction keys available in your Gameball Dashboard
Require 'gameball-nodejs-sdk' in your file
var gameball = require('gameball-nodejs-sdk')
Create a handler using the api key and transaction key (optional field), then call commands on it.
var Gameball = new gameball(apikey, transactionkey)
Gameball.initializePlayer(PlayerRequest, callback) //creates a new player with the given player attributes.
Gameball.sendEvent(EventRequest, callback) //performs action based on event triggered by users.
Gameball.createReferral(ReferralRequest, callback) //refers a new user through player with the given player code.
Gameball.getPlayerBalance(PlayerBalanceRequest, callback) //obtains player's balance value.
Gameball.holdPoints(HoldPointsRequest, callback) //holds a specific amount of points from the player’s points balance.
Gameball.reverseHold(ReverseHoldRequest, callback) //cancels previously held points identified by the given hold reference.
Gameball.reverseTransaction(ReverseTransaction, callback) //cancels a purchase reward or refund a points redemption transactions in Gameball.
Gameball.redeemPoints(RedeemPointsRequest, callback) //enables the player to use Gameball points as a payment method since it can be substituted for monetary values.
Gameball.rewardPoints(RewardPointsRequest, callback) //rewards a player with points equivalent to the given amount.
Gameball.sendEvent({
"events":{
"reserve":{
"rooms":2
}
},
"playerUniqueId":" player123",
"playerAttributes":{
"displayName":" Jon Snow",
"email":"jon.snow@example.com",
"dateOfBirth":"1980-09-19T00:00:00.000Z",
"joinDate":"2019-09-19T21:06:29.158Z"
}
})
Gameball.sendEvent({
"events":{
"place_order": {
"total_amount":"100",
"category":[
"electronics",
"cosmetics"
]
},
"review":{}
},
"playerUniqueId":"1596487841748"
})
Gameball.createReferral({
"playerCode":"CODE11",
"playerUniqueId":"player456"
})
Gameball.createReferral({
"playerCode":"CODE11",
"playerUniqueId":"player456",
"playerAttributes":{
"displayName":" Tyrion Lannister",
"firstName":"Tyrion",
"lastName":"Lannister",
"email":"tyrion@example.com",
"gender":"M",
"dateOfBirth":"1978-01-11T00:00:00.000Z",
"joinDate":"2019-09-19T21:06:29.158Z",
"custom":{
"location":"Miami",
"graduationDate":"2018-07-04T21:06:29.158Z",
"isMarried":false
}
}
})
Gameball.rewardPoints({
"playerUniqueId":"player123",
"amount":99.98
})
Gameball.rewardPoints({
"playerUniqueId":"player456",
"amount":2500,
"playerAttributes":{
"displayName":" Tyrion Lannister",
"firstName":"Tyrion",
"lastName":"Lannister",
"email":"tyrion@example.com",
"gender":"M",
"dateOfBirth":"1978-01-11T00:00:00.000Z",
"joinDate":"2019-09-19T21:06:29.158Z",
"custom":{
"location":"Miami",
"graduationDate":"2018-07-04T21:06:29.158Z",
"isMarried":false
}
}
})
Gameball.getPlayerBalance({
"playerUniqueId":"player456"
})
Gameball.holdPoints({
"playerUniqueId":"player456",
"amount":98.89
})
Gameball.redeemPoints({
"playerUniqueId":"player456",
"amount":10,
"holdReference":"2342452352435234"
})
Gameball.reverseTransaction({
"playerUniqueId":"player456",
"transactionId":"1234567890",
"reversedTransactionId":"234567891"
})
Gameball.reverseHold({
"playerUniqueId":" player456",
"holdReference":"9245fe4a-d402-451c-b9ed-9c1a04247482"
})
For usage questions\suggestions drop us an email at support[ at ]gameball.co. Please report any bugs as issues.