Loyalty Integration
Last updated
Last updated
Step 1: To start Trueplay integration, the operator should provide access to game data through the Send Game Transaction endpoint.
Step 2: The Trueplay specialist receives data, sets up a user account in the database, and creates a Trueplay ID.
Note: The first time a user visits the Trueplay loyalty program page, they are immediately added to the Trueplay database.
Step 3: The operator integrates the Get Loyalty Page endpoint and receives a link to the loyalty program.
Step 4: To allow users to make deposits and withdrawals, the operator should set up the following endpoints:
Get User Balance: to notify Trueplay about the user’s current balance.
Token Exchange: for Trueplay to refresh the user’s balance when they make a withdrawal.
Note: Trueplay sends a payment notification when a user purchases tokens in the player’s account currency.
Step 5: The integration requires several endpoints to enable users to receive tokens for Marketing Campaigns:
Tokens for Registration: This means that the user will receive tokens when placing the first bet or visiting the loyalty page.
If it is necessary to credit tokens before the user performs these actions, there is an optional Create User endpoint, which adds a user to the Trueplay database.
The user gets registration tokens right after Trueplay receives a request.
KYC Tokens: The operator must notify Trueplay that the user has passed KYC.
Afterward, the operator should set up the Update User Account endpoint to change the status of passing the KYC verification from false to true.
Deposit Tokens: In the admin panel, navigating to the Marketing Campaigns section, the operator should create a promo campaign and add users who made a deposit using the Deposit API method.
IMPORTANT:
Operators need to whitelist the Trueplay IPs to receive callbacks about the status of transactions. Otherwise, Trueplay will return errors for deposit/withdrawal tokens requests.
All operator IP addresses must be whitelisted within the Trueplay system before traffic can be sent. You can add and manage your IPs through the Trueplay Admin Panel.
If your platform offers sports betting, the operator should make the following updates:
For WIN transactions on the Sportsbook game type, the operator must send transactions with losses as WIN = 0.
In the reference ID parameter, for other WIN type transactions connected to the Sportsbook game type, the operator should send the BET identifier relevant to the reward.
IMPORTANT! WIN = 0 transactions require a unique transaction identifier.
GET
https://integration.trueplay.io/api/v2/user/{operatorUserId}/widget?language=EN
Method Description: This method allows authorized users to retrieve a link to the loyalty page, suitable for embedding within an iframe on the casino platform.
In the request, you need to indicate:
operatorUserId
X-API key
language
In response, you will receive a URL of the page that has to be displayed through an iframe on the casino side.
Name | Type | Description |
---|---|---|
operatorUserId* | String | ID of user on Operator side |
Name | Type | Description |
---|---|---|
language* | String | Localization of user loyalty page Default language of loyalty page: EN Available languages: BN, CS, DE, EN, ES, FR, HU, ID, JA, LT, LV, PL, PT, RU, SK, TR |
view | String | Allows to open the required view of the loyalty page. Available view: account, analytics, deposit, withdraw, token-sale, stream |
Name | Type | Description |
---|---|---|
X-API-KEY* | String | Operator key issued by TruePlay to access TruePlay API |
GET
https://integration.trueplay.io/api/v2/user/widget
Method Description: This method allows anonymous users to retrieve a link to the loyalty page, suitable for embedding within an iframe on the casino platform.
Name | Type | Description |
---|---|---|
X-API-KEY* | String | Operator key issued by TruePlay to access TruePlay API |
Example response
GET
https://integration.trueplay.io/api/v1/user/{operatorUserId}/balance
Method Description: This method retrieves the user's balance on the loyalty page, allowing the operator to display this balance within the casino platform.
In the request, you need to indicate:
operatorUserId
X-API key
In response you will receive the user's token balance on the loyalty page.
Name | Type | Description |
---|---|---|
operatorUserId* | String | ID of user on Operator side |
Name | Type | Description |
---|---|---|
X-API-KEY* | String | Operator key issued by TruePlay to access TruePlay API |
Example:
POST
https://{operator-name}.proxy.trueplay.io/api/v1/accept
Method Description: This method allows operators to send game transaction data to Trueplay. Operators must provide the relevant details of each transaction.
The data on game transactions is required for:
the accrual of Play to Earn rewards to users for each bet
the calculation GGR project for the accrual of rewards to participants of the Hold to Earn program
IMPORTANT! For correct calculation of rewards, it is necessary to indicate correct types of transactions:
BET, WIN - game actions
ROLLBACK - cancellation of BET or WIN transaction
BONUS_BET - a bet using bonus funds
BONUS_WIN - winning using bonus funds
Particularities of data transmission:
In the case of mixed balance bets (part of the funds comes from the real balance, part of the funds comes from bonus balance) - it is necessary to send 2 separate bets BET/WIN and BONUS_BET/BONUS_WIN respectively.
Cashout transactions for sports bets need to be passed as WIN.
Sportbook initial transaction must be sent with parameter Type = Sportbook
Sportbook outcomes must be sent with parameter Type = Win and reference TransactionId (initial transaction identifier). Transaction Amount depends on bet outcome type:
winning bet — Amount is equal to amount won
losing bet — Amount is 0
cashout done — Amount is equal to cashout amount
Name | Type | Description |
---|---|---|
X-API-KEY* | String | Operator key issued by TruePlay to access TruePlay API |
Name | Type | Description |
---|---|---|
operatorUserId* | String | ID of user on Operator side |
transactionId* | String | A unique identifier for each transaction type (BET, WIN, ROLLBACK, BONUS_BET, BONUS_WIN). For every new action (BET, WIN, ROLLBACK, BONUS_BET, BONUS_WIN) a distinct transactionId is generated to track that specific action. |
referenceTransactionId* | String | Used to link related transactions. • For BET and BONUS_BET transactions, this will be null as they are the starting point of the sequence. • For WIN and BONUS_WIN transactions, this field should reference the transactionId of the corresponding BET or BONUS_BET. • For ROLLBACK transactions, this field should reference the transactionId of the original BET or BONUS_BET being rolled back. This also applies to rolling back WIN or BONUS_WIN transactions; the referenceTransactionId should point to the transactionId of the WIN or BONUS_WIN being rolled back. |
type* | String | Type of game transaction (BET | WIN | ROLLBACK | BONUS_BET | BONUS_WIN) |
gameProvider* | String | Indicates the provider of the game or platform associated with the transaction |
gamePublisher* | String | Specifies the game’s publisher |
gameCode* | String | Code of the game |
gameName* | String | An identifier for the specific game associated with the transaction |
gameType* | String | Type of the game |
currency* | String | Currency code used in the transaction |
amount* | Integer | Amount involved in the transaction |
Important: Ensure that referenceTransactionId correctly links to the associated BET or BONUS_BET, or WIN or BONUS_WIN as applicable. Setting it to 0 or leaving it blank when it should be populated will result in errors and incorrect transaction processing.
Request example
Response example
POST
https://{operatorBaseUrl}/user-balance
Method Description: This method allows retrieving the current balance of a user in a casino. Operators must provide the user's unique identifier on their side, and upon successful authentication, the method returns the user's balance along with the currency in which it is denominated.
This method is necessary to implement the token exchange endpoints.
Name | Type | Description |
---|---|---|
X-REQUEST-SIGNATURE* | String | Request signature, Base64(HmacSHA512(SecretKey, MD5(request body))) |
Name | Type | Description |
---|---|---|
operatorUserId* | String | ID of user on Operator side |
POST
https://{operatorBaseUrl}/token-exchange
Method Description: This method enables users to deposit tokens using funds from the casino balance or withdraw tokens to the casino balance. It supports two actions: CREDIT and DEBIT.
CREDIT: Withdraws tokens from the loyalty page balance and converts them into money, adding them to the casino balance.
DEBIT: Deposits money from the casino balance and converts it into tokens, adding them to the loyalty page balance.
To integrate Token Exchange endpoints successfully, operators must specify the Callback URL from which deposit/withdrawal requests will be executed and generate transaction signatures using the Secret Key, which should be included in the request header. Correct transaction types (CREDIT or DEBIT) must be provided in the request body for the method to function accurately.
Name | Type | Description |
---|---|---|
X-REQUEST-SIGNATURE* | String | Request signature, Base64(HmacSHA512(SecretKey, MD5(request body))) |
Name | Type | Description |
---|---|---|
id* | String | operation ID |
action* | String | Specifies the action to be performed. Accepted values are CREDIT (transfer from token balance to operator account balance) and DEBIT (transfer from operator account balance to token balance) |
amount* | Integer | Amount involved in the transaction |
currency | String | Currency code used in the transaction |
tokenAmount* | Integer | Token amount involved in the transaction |
operatorId* | String | ID of Operator |
operatorUserId* | String | ID of user on Operator side |
Requests from TruePlay include X-REQUEST-SIGNATURE
header.
Example of how to generate a signature for SecretKey = secret
node Welcome to Node.js v16.13.0. Type ".help" for more information. var crypto = require('crypto'); undefined var hasher = crypto.createHash('md5'); undefined var hashed = hasher.update('{"id":"103193","action":"CREDIT","amount":4.123,"currency":"USD","exchangeRate":0.00203250655485,"tokenAmount":2500,"operatorId":123,"operatorUserId":"333"}') undefined var hash = hashed.digest('hex'); undefined var hmac = crypto.createHmac('sha512', 'secret'); undefined hmac.update(hash); Hmac { _options: undefined, [Symbol(kHandle)]: Hmac {}, [Symbol(kState)]: { [Symbol(kFinalized)]: false } } var sign = hmac.digest('base64'); undefined console.log('signature: ' + sign); signature: IifPVbfXptagZ6qSXH9vYrQiqSP4sKIC+hV+39z2K+FlLzRoEboPGTTymjmeuAhN1i0ICDyyrrufYspgAJmxHQ==
POST
https://integration.trueplay.io/api/v1/user
Create user on Trueplay side to get promo reward.
Name | Type | Description |
---|---|---|
X-API-KEY* | String | Operator key issued by TruePlay to access TruePlay API |
Name | Type | Description |
---|---|---|
kyc | String | Indicates whether the user has passed the KYC verification process. When true, the user has successfully completed the KYC process; when false, the user has not yet completed KYC. |
operatorUserId* | String | ID of user on Operator side |
PUT
https://integration.trueplay.io/api/v1/user
The method to update user's "Kyc" parameter to get promo reward.
Name | Type | Description |
---|---|---|
X-API-KEY* | String | Operator key issued by TruePlay to access TruePlay API |
Name | Type | Description |
---|---|---|
kyc | String | Indicates whether the user has passed the KYC verification process. When true, the user has successfully completed the KYC process; when false, the user has not yet completed KYC. |
operatorUserId* | String | ID of user on Operator side |
POST
https://integration.trueplay.io/api/v1/promo/deposit
The method to get reward regarding the user's deposit on casino.
Name | Type | Description |
---|---|---|
transactionId* | String | ID of transaction |
operatorUserId* | String | ID of user on Operator side |
amount* | Integer | Deposit amount in Operator currency |
currency* | String | Currency of Operator |
amountUsd* | Integer | Amount of deposit in USD |
createdAt* | String | Deposit date |
The operator can also define a user segment to add to the campaign using API. The Marketing Campaigns API supports the following methods
GET
https://integration.trueplay.io/api/v1/promo-campaign/active
The method returns a list of active marketing campaigns. This must be performed before adding a user to the campaign, so as to avoid adding a user to a campaign with the Draft/Expired/Deactivated status by accident.
Name | Type | Description |
---|---|---|
X-Api-KEY* | String | Operator key issued by TruePlay to access TruePlay API |
GET
https://integration.trueplay.io/api/v1/promo-campaign/{campaign_id}/participants
Returns a list of marketing campaign participants
Name | Type | Description |
---|---|---|
id* | Integer | ID of marketing campaign |
Name | Type | Description |
---|---|---|
X-API-KEY* | String | Operator key issued by TruePlay to access TruePlay API |
POST
https://integration.trueplay.io/api/v1/promo-campaign/{campaignId}/user/{operatorUserId}
The method add a user to the marketing campaign
Name | Type | Description |
---|---|---|
operatorUserId* | Integer | ID of user on Operator side |
campaignId* | Integer | ID of marketing campaign |
Name | Type | Description |
---|---|---|
X-Api-Key* | String | Operator key issued by TruePlay to access TruePlay API |
DELETE
https://integration.trueplay.io/api/v1/promo-campaign/{campaignId}/user/{operatorUserId}
The method delete users from marketing campaign
Name | Type | Description |
---|---|---|
campaignId* | Integer | ID of marketing campaign |
operatorUserId* | Integer | ID of user on Operator side |
Name | Type | Description |
---|---|---|
X-API-KEY* | String | Operator key issued by TruePlay to access TruePlay API |
GET
https://integration.trueplay.io/api/v1/operator/rewards
The method returns a list of all types of rewards by all users. It is possible to set a time interval for receiving a list of rewards
Name | Type | Description |
---|---|---|
startDate* | String | |
endDate* | String |
Name | Type | Description |
---|---|---|
X-API-KEY* | String | Operator key issued by TruePlay to access TruePlay API |
GET
https://integration.trueplay.io/api/v1/users/rewards
The method returns a list of users and their awards for a certain period of time. Maximum time period - 24 hours. The request must indicate the from (date and time) - to (date and time). For example, a request for a period 2024-03-24 13:00:00.000 - 2024-03-24 14:00:00.000 will return a list of users and their rewards for the specified period.
Name | Type | Example |
---|---|---|
from* | String | 2024-04-01 00:00:00.000 |
to* | String | 2024-04-02 00:00:00.000 |
Name | Type | Description |
---|---|---|
X-API-KEY* | String | Operator key issued by TruePlay to access TruePlay API |
GET
https://integration.trueplay.io/api/v1/user/${operatorUserId}/rewards
The method returns a list of all types of rewards by a specific user. It is possible to set a time interval for receiving a list of rewards
Name | Type | Description |
---|---|---|
operatorUserId* | String | ID of user on Operator side |
Name | Type | Description |
---|---|---|
startDate | String | |
endDate | String |
Name | Type | Description |
---|---|---|
X-API-KEY* | String | Operator key issued by TruePlay to access TruePlay API |
GET
https://integration.trueplay.io/api/v1/user/{operatorUserId}/check-balance
The method returns 2 values by selected user :
The total amount of tokens on the user's wallet ;
The total amount of tokens in Hold To Earn programs .
The rate limit is 60 requests per minute.
Name | Type | Description |
---|---|---|
operatorUserId* | String | ID of user on Operator side |
Name | Type | Description |
---|---|---|
X-API-KEY* | String | Operator key issued by TruePlay to access TruePlay API |
POST
https://integration.trueplay.io/api/v1/casino/reward
This method is used when a user on the casino side reaches a specific level that triggers a token reward. The operator can award tokens to users once they complete the following actions:
When the user reaches a certain level of play ;
For tournament participation ;
When the user opens loot boxes ;
Other triggers.
Headers
Name | Type | Description |
---|---|---|
X-API-KEY* | String | Operator key issued by TruePlay to access TruePlay API |
Body
Name | Type | Description |
---|---|---|
operatorUserId | string | ID of user on Operator side |
amount | Integer | The number of tokens that must be credited to the user's loyalty page balance |
requestId | string |
Response
POST
https://integration.trueplay.io/api/v1/casino/loyalty-swap
This method is used when the operator allow the user to withdraw tokens from the loyalty page and receive a bonus balance, freespins or freebets. The operator should add a pop-up, button, etc where the user see the ratio of the number of tokens to the number of freespins (freebets)
Headers
Name | Type | Description |
---|---|---|
X-API-KEY* | String | Operator key issued by TruePlay to access TruePlay API |
Body
Name | Type | Description |
---|---|---|
operatorUserId | string | ID of user on Operator side |
amount | Integer | The number of tokens that must be withdrawn from user's loyalty page balance |
requestId | string |
Response