# Event Types

Trueplay events are notifications that the operator receives when users make changes to their loyalty balance. For example, when the holding period expires, Trueplay notifies the operator and the user’s loyalty page.

To notify users about their rewards and other activities with notification emails, you need to set up automatic mailing customized for specific events.

### Event Types <a href="#event-types" id="event-types"></a>

* Play to Earn: A user receives a Play to Earn reward. This can be set as the initial reward event for a user. Send them an invitation to visit the Loyalty page to earn additional rewards.
* Hold to Earn: A user receives a Hold to Earn reward. Notify the user and encourage them to hold more tokens to increase their bonus.
* Balance change: The user’s balance has changed, excluding the Play to Earn and Hold to Earn events.

  Transaction types that included in the "Balance Change" event:

  * `CASINO_REWARD` - For rewards given by the casino.
  * `WITHDRAW / CRYPTO_WITHDRAW` - For withdrawals from the widget made by the user.
  * `DEPOSIT / CRYPTO_DEPOSIT` - For deposits made by the user.
  * `TRANSFER_IN / TRANSFER_OUT` - For transfers that increase or decrease the user’s balance.
  * `PROMO (PROMO_CAMPAIGN_REWARD / DAILY_CASHBACK / WEEKLY_CASHBACK,  PROMO_DEPOSIT_REWARD) -` For promotional rewards credited to the user’s balance.
  * `STAKE / UNSTAKE -`For the start and finish of a staking program (“hold to earn”).
  * `BURN` - For any balance deductions specified as burning points or tokens.

### Events data for developers <a href="#events-data-for-developers" id="events-data-for-developers"></a>

This functionality sends an event with the necessary data to the operator.

**Request body structure:**

<table data-full-width="true"><thead><tr><th width="322">METHOD</th><th>POST</th></tr></thead><tbody><tr><td>URL</td><td>https://{operatorbaseurl}/player-event</td></tr><tr><td>BODY</td><td><p><code>{</code></p><p> <code>"requestId":"uuid",</code></p><p> <code>"operatorUserId":"john12345",</code></p><p> <code>"createdAt":"2022-08-18 06:42:45",</code></p><p> <code>"type":"EVENT_TYPE",</code></p><p> <code>"data": {</code> </p><p>   <code>"eventParam":"eventValue"</code> </p><p>  <code>}</code> </p><p><code>}</code></p></td></tr><tr><td>HEADERS</td><td>X-REQUEST-SIGNATURE:SIccPXmsq6XdaCd9t82ghl1bny54yVnwpjXNo0t0vLkPgtkUIQtt+1OoXp8FQfak0JyjK6FhayLHrO6RPAIIDg== Content-Type: application/json</td></tr><tr><td>DETAILS</td><td>X-REQUEST-SIGNATURE - Request signature, Base64(HmacSHA512(SecretKey, MD5(request body))) Event "data" is individual for each request</td></tr></tbody></table>

**Supported Events:**

<table data-full-width="true"><thead><tr><th width="243">Event type</th><th width="172.59765625">Description</th><th>Event data</th></tr></thead><tbody><tr><td>PLAY_TO_EARN</td><td>Once a user receives a Play To Earn Reward</td><td><p><code>{</code> </p><p><code>"type": "PLAY_TO_EARN",</code> </p><p><code>"data": {</code></p><p>  <code>"amount": 10</code></p><p>  <code>"balance": 10,</code> <br>   <code>"tokenPriceUsdt": 0.005,</code> </p><p>  <code>"gameType": SLOT // Any game type sent by operator</code></p><p> <code>}</code></p><p><code>}</code><br>List of current game types:  VIDEO_POKER, LIVE_ROULETTE, ROULETTE, BINGO, BLACK_JACK, CASUAL_GAMES, HI_LO, INSTANT_WIN_GAMES, KENO, LIVE_BLACK_JACK, LIVE_DEALER, LIVE_DICE, LIVE_GAMES, LOTTERY, OTHER, POKER, SCRATCH_CARDS, SIC_BO, SPORTS_BOOK, TABLE_GAMES, VIDEO_BINGO, V_SPORT, WHEEL_OF_FORTUNE, BACCARAT, CARD, CRAPS, CRASH, LIVE_BACCARAT, LIVE_LOTTERY</p></td></tr><tr><td>HOLD_TO_EARN</td><td>When a user receives a Hold to Earn reward</td><td><p><code>{</code> </p><p><code>"type": "HOLD_TO_EARN",</code> </p><p><code>"data": {</code></p><p>  <code>"amount": 10, //h2e reward</code></p><p>  <code>"reward": 10, //h2e reward</code></p><p>  <code>"balance": 10,</code></p><p>  <code>"tokenPriceUsdt": 0.005</code> </p><p> <code>}</code> </p><p><code>}</code></p></td></tr><tr><td>BALANCE_CHANGE</td><td>Once the user balance has been changed. Except P2E and H2E events. </td><td><p><code>{</code> </p><p><code>"type": "BALANCE_CHANGE",</code></p><p> <code>"transactionType: "BURN"</code> </p><p><code>"data": {</code></p><p>  <code>"amount": 5 ,</code></p><p>  <code>"balance": 10 ,</code></p><p>  <code>"tokenPriceUsdt": 0.005</code> </p><p> <code>}</code> </p><p><code>}</code></p></td></tr><tr><td>CRYPTO_DEPOSIT_SUCCESS</td><td>When tokens are successfully deposited from user crypto wallet</td><td><p><code>{</code> </p><p><code>"type":"CRYPTO_DEPOSIT_SUCCESS",</code></p><p><code>"data": {</code> </p><p>  <code>"amount": 10.023</code> </p><p> <code>}</code> </p><p><code>}</code></p></td></tr><tr><td>CRYPTO_WITHDRAWAL_SUCCESS</td><td>When tokens are successfully withdrawn to user crypto wallet</td><td><p><code>{</code> </p><p><code>"type":"CRYPTO_WITHDRAWAL_SUCCESS",</code></p><p><code>"data": {</code> </p><p>  <code>"amount": 10.023</code> </p><p> <code>}</code> </p><p><code>}</code></p></td></tr><tr><td>PROMO_REWARD</td><td>When a user receives reward for registration/kyc or for a custom marketing campaigns.</td><td><p><code>{</code> </p><p><code>"type": "PROMO_REWARD",</code> </p><p><code>"data": {</code> </p><p>  <code>"amount": 10,</code> </p><p>  <code>"p2eMultiplier": 10.023,</code></p><p>  <code>"stakingLimitCoefficient": 10.2,</code></p><p>  <code>"balance": 10,</code></p><p>  <code>"tokenPriceUsdt": 0.005</code> </p><p> <code>}</code> </p><p><code>}</code></p></td></tr><tr><td>DAILY_CASHBACK</td><td>When a user receives token reward in the form of daily cashback</td><td><p><code>{</code> </p><p><code>"type": "DAILY_CASHBACK",</code> </p><p><code>"data": {</code> </p><p>  <code>"amount": 10, //daily_cashback</code></p><p>  <code>"balance": 10,</code></p><p>  <code>"tokenPriceUsdt": 0.005</code> </p><p> <code>}</code> </p><p><code>}</code></p></td></tr><tr><td>WEEKLY_CASHBACK</td><td>When a user receives token reward in the form of weekly cashback </td><td><p><code>{</code> </p><p><code>"type": "WEEKLY_CASHBACK",</code> </p><p><code>"data": {</code> </p><p>  <code>"amount": 10, //weekly_cashback</code></p><p>  <code>"balance": 10,</code> </p><p>  <code>"tokenPriceUsdt": 0.005</code> </p><p> <code>}</code> </p><p><code>}</code></p></td></tr><tr><td>DEPOSIT_VOLUME</td><td>When user receives reward with tokens for replenishing your deposit at the casino.</td><td><p><code>{</code> </p><p><code>"type": "DEPOSIT_VOLUME",</code> </p><p><code>"data": {</code> </p><p>  <code>"amount": 10, //deposit_volume</code></p><p>  <code>"balance": 10,</code></p><p>  <code>"tokenPriceUsdt": 0.005</code> </p><p> <code>}</code> </p><p><code>}</code></p></td></tr></tbody></table>

###
