The purchase reward API is mainly responsible for rewarding your player score and points through Purchase Reward program based on the actual paid amount by your players.
Gameball allows you to reward your players with score, points, or both based on the configured settings on Gameball Purchase Reward program. To learn more about puchase rewards, check this article at our Help Center.
Reward can be sent along with Events and Redemption using Actions Composite API endpoint.
The following APIs use Hashing Function SHA1, check how hashing is done below.
Reward Points
POST/integrations/transaction/reward
Access reward points API to reward your players for each unit currency they actually paid for your product or service.
{"code": 4,"message": "The Amount field is required."}
{}
{"code": 305,"message": "Transaction with Id tra_123456789 has already been placed"}
{}
Response Description
In case the player doesn't exist on Gameball before sending the Purchase Reward API call, the player will be created automatically on Gameball and granted the points.
Usage Examples
Example One
The example shown is a request sent to Gameball when you want to reward a player ofplayerUniqueId"player123" with points equivalent to amountof 99.98. The points to be granted will be according to your points configurations on Purchase Reward program.
The example shown is a request sent to Gameball when you want to reward a player ofplayerUniqueId"player456" with points equivalent to amountof 2500.
In addition to reward information, playerAttributesobject is sent to Gameball to create or update player details in our system with any custom attributes.
Merchant object as described in Object reference section
playerUniqueId
string
Player unique identifier used to uniquely identify the player on Gameball.
amount
number
Monetary value that the player will be rewarded for based on the Purchase Reward program configurations. (Amount must be positive).
transactionId
string
Unique transaction ID which identifies the underlying transaction in your system, e.g. order number, invoice number. It will be used for reversing any reward or redemption transaction on Gameball.
transactionTime
string
Time of transaction in your system in UTC, e.g. order datetime, invoice datetime.
Note: transactionTime is automatically handled when using server-side SDKs.
hash
string
Hashed body with SHA1 algorithm. As described in Hashing Transaction Messages section.
Note: hashing is automatically handled when using server-side SDKs.
playerAttributes
object
An object containing all of the attributes of the player. Player object is described in Object Reference section.
Attribute
Description
playerUniqueId
Player unique identifier used to uniquely identify the player on Gameball.
playerAttributes
An object containing all of the attributes of the player. Player Object is described in Object Reference section.
gameballTransactionId
Transaction ID on Gameball system.
amount
Monetary value that the player will be rewarded for based on the Purchase Reward. (Amount must be positive)
transactionId
Unique transaction ID which identifies the underlying transaction in your system, e.g. order number, invoice number. It will be used for reversing any reward or redemption transaction on Gameball.
transactionTime
Time of transaction in your system in UTC, e.g. order datetime, invoice datetime. Note:transactionTime is automatically handled when using server-side SDKs.
points
The number of points rewarded to the player for the specified amount