Pending Bonus

A pending bonus is a reward that will be credited to the user account immediately when issued, but will requires user action before activated. Pending bonuses are great to use when you want to award an achievement badge, and once you click on it, it will activate the given bonus.

Pending Deposit Bonuses works in the same way, but this bonus will instead offer the user a code to be used when making the next deposit

Authentication

In order to make this work, you need to have an endpoint at your side which purpose is to validates the user session id (sid). This sid will be porivded when initializing the intergration.

Read more here about that auth endpoint / sid validation

Basic Installation of CRM

Insert the following code snippet before the end of </body> replace {brand} with supplied brand name from fasttrack.

<script>
  var sid = 'xx-xx-xx-xx';

  //Global Variable
  window.fasttrackbrand = '{brand}';

  //Script Setup
  var fastTrackCrmScript = document.createElement('script');
  fastTrackCrmScript.async = true;
  fastTrackCrmScript.onload = function () {
    new window.FastTrackLoader();
  }
  fastTrackCrmScript.src = "https://crm-lib.fasttrack-solutions.com/loader/fasttrack-crm.js";
  document.body.appendChild(fastTrackCrmScript);
</script>

The sid variable should contain an authentication token or other unique token for the user.

Pending bonuses

With pending bonuses you will be able to grab pending bonuses and also consume those bonuses. Our script will register a global variable FasttrackCrm.

There are three different types of bonuses:

  • Type = 1 - Pending Bonus - This type can be consumed at any time by calling the Consume endpoint.
  • Type = 2 - Pending Deposit Bonus - In this type, the bonus code needs to be passed to the cashier and it then gets consumed automatically through the corresponding queue message if deposit was successful.
  • Type = 3 - Locked Bonus - In this type, the bonus code needs to be passed to the cashier, and if deposit is successful and criteria met then it is marked as unlocked. At this point, the Consume endpoint needs to be called to apply the bonus.

GetPendingBonuses

To get pending bonuses you will use the following code

FasttrackCrm.getPendingBonuses()
  .then(response => console.log(response))
  .catch(error => console.log(errror));

So our call will return a Promiseand then you can do what you want in then & catch to implement error handling

An Example response looks like this:

[
  {
    "Id": 1,
    "Reference": "3-3-ABC124",
    "MobileGameId": 3,
    "DesktopGameId": 4,
    "MobileGameUrl": "https://fasttrack-solutions.com/game/1234",
    "DesktopGameUrl": "https://fasttrack-solutions.com/game/1234",
    "ImageUrl": "https://www.fasttrack-solutions.com/",
    "DateCreated": "2018-04-26 09:20:14",
    "Description": "10 Free spins on Aloha",
    "Type": 1
  },
  {
    "Id": 2,
    "Reference": "3-3-ABC124",
    "MobileGameId": 3,
    "DesktopGameId": 4,
    "MobileGameUrl": "https://fasttrack-solutions.com/game/1234",
    "DesktopGameUrl": "https://fasttrack-solutions.com/game/1234",
    "ImageUrl": "https://www.fasttrack-solutions.com/",
    "DateCreated": "2018-04-26 09:20:54",
    "Description": "10 Free spins on Aloha",
    "Type": 2,
    "BonusCode": "STEPHENTESTBONUS"
  },
  {
    "Id": 3,
    "Reference": "3-3-ABC124",
    "MobileGameId": 3,
    "DesktopGameId": 4,
    "MobileGameUrl": "https://fasttrack-solutions.com/game/1234",
    "DesktopGameUrl": "https://fasttrack-solutions.com/game/1234",
    "ImageUrl": "https://www.fasttrack-solutions.com/",
    "DateCreated": "2018-04-26 09:23:55",
    "Description": "10 Free spins on Aloha",
    "Type": 3,
    "BonusCode": "STEPHENTESTBONUS2",
    "IsLocked": 1,
    "UnlockAmount": 10
  }
]

Type = 1 = Standard Bonus (no bonus code supplied)

Type = 2 = Deposit Bonus (code for deposit supplied)

Tyoe = 3 = Unlockable Bonus (code for bonus supplied)

Activate Pending Bonus

This method should be run only for:

  • Type = 1 Standard Bonuses - so that the bonus code is applied to the user and marked as claimed

  • Type = 3 Unlockable Bonus - so that the bonus code is applied to the user and marked as claimed (Needs to have property IsLocked = 0, otherwise error returned)

To consume a pending bonus you should pass the Id from the selected bonus.

FasttrackCrm.consumePendingReward(2)
  .then(response => console.log(response))
  .catch(error => console.log(errror));

So our call will return a Promiseand then you can do what you want in then & catch to implement error handling

An Example response looks like this:

{
  "Id": 3,
  "Reference": "3-3-ABC124",
  "MobileGameId": 3,
  "DesktopGameId": 4,
  "MobileGameSlug": "abc-1243",
  "DesktopGameSlug": "abc-1234",
  "ImageUrl": "https://www.fasttrack-solutions.com/",
  "DateCreated": "2018-04-26 09:23:55",
  "IsConsumed": true,
  "DateConsumed": "2018-04-26 11:25:45",
  "Description": "10 Free spins on Aloha",
  "Type": 1
}