Customer

The Customer API can be used to create, update and display customers' information as well as attach/detach tags in Gameball. Customers are uniquely identified by playerUniqueId.

Available Endpoints

POST - Create Customer

https://api.gameball.co/api/v3.0/integrations/player

The API call is used to create or update a customer in Gameball with the provided attributes.

This endpoint could also be used in case of referral. In such case,referralCode of the referring customer is to be provided along with the body parameters. So that Gameball understands that the newly created customer is being referred.

mobile or email should be sent along with the playerUniqueId in case (only if) your account supports channel merging.

In cases where channel merging is supported, you have the flexibility to identify users by their mobile number or email. For accounts utilizing separate systems for online and offline channels, it's advisable to consider changing the customer's unique ID to either their mobile number or email address for enhanced efficiency.

Request

Body

playerAttributes Object

{
   "playerUniqueId":"player123",
   "mobile": "+1234567", // optional (Channel Merging)
   "email": "jon.snow@example.com", // optional (Channel Merging)
   "playerAttributes":{
      "displayName":"Jon Snow",
      "firstName": "Jon",
      "lastName": "Snow",
      "mobile": "+1234567",
      "email":"jon.snow@example.com",
      "gender":"M",
      "dateOfBirth":"1980-09-19T00:00:00.000Z",
      "joinDate":"2019-09-19T21:06:29.158Z",
       "country": "Egypt",
        "city": "Cairo",
        "zip": "18754",
      "tags": "VIP,Platinum",
      "custom":{
          "location":"Miami",
          "graduationDate":"2018-07-04T21:06:29.158Z",
          "isMarried":false
      }
    },
    "referrerCode": null,
    "levelOrder": null
  }

Response

Sample Response

{
    "playerUniqueId": "player123",
    "gameballId": 160281869,
    "levelsProgress": 0,
    "level": {
        "id": 17812,
        "name": "very Basic ",
        "description": "",
        "levelStartScore": 0,
        "levelOrder": 1,
        "iconPath": "https://cdn.gameball.co/uploads/gb-library/levels-icons/level-a1.png",
        "benefits": {
            "scoreEnteryReward": 0,
            "pointsEnteryReward": 0,
            "levelDiscount": null,
            "discountCapping": null
        }
    },
    "balance": {
        "pointsBalance": 0,
        "pointsValue": 0.0,
        "pendingPoints": 0,
        "pendingPointsValue": 0.0,
        "currency": "USD",
        "walletPointsName": "Points",
        "totalPositivePoints": 0,
        "totalPositivePendingPoints": 0,
        "totalNegativePoints": 0,
        "totalNegativePendingPoints": 0
    },
    "referralCode": "QQAF9B02734oKn",
    "referralLink": "https://wizardtest123.myshopify.com/account/register?ReferralCode=QQAF9B02734oKn",
    "dynamicReferralLink": null
}

Usage Examples

Example One

This example creates a new customer at Gameball, using playerUniqueId, playerAttributes with custom attributes.

curl -X POST -H 'apiKey: 807b041b7d35425988e354e1f6bce186' -d '{
  "playerUniqueId":"player123",
  "mobile": "+1234567",
  "email": "jon.snow@example.com",
  "playerAttributes":{
      "displayName":"Jon Snow",
      "firstName": "Jon",
      "lastName": "Snow",
      "mobile": "+1234567",
      "email":"jon.snow@example.com",
      "gender":"M",
      "dateOfBirth":"1980-09-19T00:00:00.000Z",
      "joinDate":"2019-09-19T21:06:29.158Z",
      "country": "Egypt",
        "city": "Cairo",
        "zip": "18754",
      "custom":{
         "location":"Miami",
         "graduationDate":"2018-07-04T21:06:29.158Z",
         "isMarried":false
      }
   }

  }' -v -i 'https://api.gameball.co/api/v3.0/integrations/player'

Example Two

This example is a request sent to Gameball when customer with referralCodeCODE11 successfully refers a new customer with playerUniqueId player456”. Customer attributes are also sent within the same request.‌

Note: All attributes inside the playerAttributes object are optional, if the values of any attributes shown below are unavailable, remove the attribute from the playerAttributes object.

curl -X POST -H 'apiKey: 807b041b7d35425988e354e1f6bce186' -d '{
   "referrerCode":"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
  	}
   }
  }' -v -i 'https://api.gameball.co/api/v3.0/integrations/player'

GET - Retrieve Customer

This API call is used to retrieve customer's information.

https://api.gameball.co/api/v3.0/integrations/player/{playerUnqiueId}

mobile or email should replace playerUniqueId in case (only if) your account supports channel merging.

Request

Header

Path Parameters

Response

Level Object

The Level object contains info about the customer's current VIP tier.

Sample Response

{
   "playerUniqueId":"player456",
   "playerAttributes":{
      "displayName":"Jon Snow",
      "email":"jon.snow@example.com",
      "mobileNumber":"0123456789",
      "gender":"M",
      "joinDate":"09/19/2019 21:06:29",
      "tags":[
         "VIP",
         "Elite"
      ],
      "custom":{
         "location":"Miami",
         "graduationDate":"2018-07-04T21:06:29.158Z",
         "isMarried":false
      }
   },
   "referralCode":"CODE12",
   "referralLink":"https://gameofthrones.myshopify.com/account/register?ReferralCode=CODE12",
   "dynamicReferralLink":"https://gameofthrones.myshopify.com/account/register?ReferralCode=CODE12",
   "level":{
      "name":"Gold",
      "description":null,
      "levelOrder":4,
      "iconPath":"https://cdn.gameball.co/uploads/Client 1/2cf4b388-f957-4789-8309-5476907c1baeicon-level-gold@2x.png",
      "benefits":{
         "scoreEntryReward":0,
         "pointsEntryReward":0,
         "levelDiscount":null,
         "discountCapping":null
      }
   },
    "levelProgress": 0,
    "points": {
        "pointsBalance": 0,
        "pointsValue": 0.0,
        "pendingPoints": 0,
        "pendingPointsValue": 0.0,
        "currency": "USD",
        "walletPointsName": "Points",
        "totalPositivePoints": 0,
        "totalPositivePendingPoints": 0,
        "totalNegativePoints": 0,
        "totalNegativePendingPoints": 0
    }
}

Usage Example

The example shown is a request sent to Gameball to get a customer info with playerUniqueIdplayer456”.

curl -X GET -H 'apiKey: 807b041b7d35425988e354e1f6bce186'
 -v -i 'https://api.gameball.co/api/v3.0/integrations/player/player456'

GET - Customer's Balance

This API call is used to retrieve customer's current points balance available for redemption and the corresponding equivalent amount.

https://api.gameball.co/api/v3.0/integrations/player/{playerUnqiueId}/balance

mobile or email should replace playerUniqueId in case (only if) your account supports channel merging.

Request

Header

Path Parameters

Response

Sample Response

{
    "pointsBalance": 11500,
    "pointsValue": 115,
    "pendingPoints": 200,
    "pendingPointsValue": 2,
    "totalPositivePoints": 12500,
    "totalPositivePendingPoints": 135,
    "totalNegativePoints": 1000,
    "totalNegativePendingPoints": 20
    "currency": "USD",
    "pointsName": "Points"
}

Usage Example

The example shown is a request sent to Gameball to get a customer's balance with his playerUniqueId

curl -X GET -H 'apiKey: 807b041b7d35425988e354e1f6bce186' \
       -H 'secretKey: klmb041b7d354259l3u4ft35e1q2r3703' -d 
-v -i 'https://api.gameball.co/api/v3.0/integrations/player/player456/balance'

GET - Customer's Hash

This API call is used to retrieve customer's hash value which is calculated for each customer, and rotates with the customer's every transaction.

https://api.gameball.co/api/v3.0/integrations/player/{playerUnqiueId}/hash

mobile or email should replace playerUniqueId in case (only if) your account supports channel merging.

Request

Header

Path Parameters

Response

Sample Response

   {
    "pLayerId": 406044,
    "playerUniqueId": "6886288195890",
    "displayName": "m3 z3",
    "firstName": "m3",
    "lastName": "z3",
    "gender": null,
    "email": "mariam.zakria+f12@gameball.co",
    "mobileNumber": null,
    "dateOfBirth": null,
    "joinDate": "2023-03-01T10:28:30",
    "referralCode": "ED1D58A3vTiok9",
    "referralLink": "https://gbdashboardv2-gbx.myshopify.com/account/register?ReferralCode=ED1D58A3vTiok9",
    "dynamicReferralLink": null,
    "levelName": "Basico",
    "levelIconPath": "https://cdn.gameball.co/uploads/gb-library/levels-icons/level-a1.png",
    "pointsBalance": 945,
    "pointsValue": 94.5,
    "pendingPoints": 0,
    "pendingPointsValue": 0,
    "pointsToExpire": 555,
    "pointsToExpireValue": 55.5,
    "expiryDate": "2023-03-02T12:23:59.885053",
    "currency": "AED",
    "pointsName": "Puntos",
    "lastActivePointsStatus": 555,
    "lastPendingPointsStatus": 0,
    "lastLevelStatus": "none",
    "lastActivePointsDate": "2023-03-01T12:23:59.913354",
    "lastPendingPointsDate": null,
    "lastLevelDate": null,
    "hash": "502371"
  }

Usage Example

The example shown is a request sent to Gameball to get a customer's balance with his playerUniqueId

curl -X GET -H 'apiKey: 807b041b7d35425988e354e1f6bce186' 
       -H 'secretKey: klmb041b7d354259l3u4ft35e1q2r3703' -d 
-v -i 'https://api.gameball.co/api/v3.0/integrations/player/player456/balance'

GET - Customer's Progress 👑

https://api.gameball.co/api/v3.0/integrations/player/{playerUnqiueId}/progress

mobile or email should replace playerUniqueId in case (only if) your account supports channel merging.

This API call is used to show the overall customer's progress in the available rewards campaigns, referral program and VIP tiers across Gameball programs.

This endpoint is only available for our GURU clients only 👑

Request

Header

Path Parameters

Response

balanceObject

The balance object contains info about the customer's points.

challenge Object

The challenge object shows description of the rewards campaigns as follows.

challengeConfig Object

reward Object

couponReward Object

availability Object

Sample Response

{
  "playerUniqueId": "player456",
  "referralCode": "CODE12",
  "referralLink": "https://gameofthrones.myshopify.com/account/register?ReferralCode=CODE12",
  "dynamicReferralLink": "https://gameofthrones.myshopify.com/account/register?ReferralCode=CODE12",
  "playerAttributes": {
    "dateOfBirth": null,
    "communityId": null,
    "tags": ["VIP"]
  },
  "levelsProgress": {
    "current": {
      "order": 1,
      "name": "level 1",
      "minProgress": 0,
      "icon": "https://cdn.gameball.co/uploads/client776/ad8b2587-959f-48fd-ab58-a643323652begb.png"
    },
    "next": {
      "order": 2,
      "name": "level 2",
      "minProgress": 2000,
      "icon": "https://cdn.gameball.co/uploads/client776/ad8b2587-959f-48fd-ab58-a643323652begb.png"
    }
  },
  "challengesProgress": [
    {
      "isUnlocked": true,
      "highScoreAmount": null,
      "completionPercentage": 0,
      "achievedCount": 0,
      "challengeConfig": {
        "id": 1234,
        "name": "Challenge Name",
        "description": "Challenge Description",
        "rewards": [
          {
            "rankReward": 0,
            "walletReward": 0,
            "couponReward": {
              "couponType": "Free Product",
              "discountValue": null,
              "minOrderValue": null,
              "product": {
                "productId": "123456789",
                "productName": "Chequered Red Shirt",
                "variantId": "123456789",
                "variantName": null
              },
              "collections": []
            }
          }
        ],
        "isRepeatable": true,
        "maxAchievement": -1,
        "type": "EventBased",
        "visibility": "Always Visible",
        "icon": "https://s3.us-east-2.amazonaws.com/gameball.dev.uploads/uploads/gb-library/general/annoncement.png",
        "availability": {
          "minLevel": 1,
          "tags": []
        },
        "redirectionButtonText": "Free Gift",
        "redirectionButtonLink": "https://claires.myshopify.com/products/jeans"
      }
    }
  ],
  "totalReferredPlayers": 0,
  "points": {
    "pointsBalance": 11500,
    "pointsValue": 115,
    "pendingPoints": 200,
    "pendingPointsValue": 2,
    "currency": "USD",
    "pointsName": "Points"
  }
}

Usage Example

The example shown is a request sent to Gameball to get a customer's progress with playerUniqueIdplayer456”.

curl -X POST -H 'apiKey: 807b041b7d35425988e354e1f6bce186'
 -v -i 'https://api.gameball.co/api/v3.0/integrations/player/player456/progress'

GET - Customer's Rewards Campaign's Progress

This API is used to get a customer's specific rewards campaign's progress.

https://api.gameball.co/api/v3.0/integrations/player/{playerUnqiueId}/progress/challenge/{handle}

Request

Header

Path Parameters

Query Parameters

Response

challengesProgress Object

Sample Response

{
  "challengesProgress": [
    {
      "isUnlocked": true,
      "highScoreAmount": null,
      "highScore": null,
      "completionPercentage": 50.0,
      "achievedCount": 0,
      "currentStreak": null,
      "highestStreak": null,
      "challengeConfig": {
        "id": 1234,
        "name": "Challenge Name",
        "description": "Challenge Description",
        "rewards": [
          {
            "rankReward": 0,
            "walletReward": 0,
            "couponReward": {
              "couponType": "Free Product",
              "discountValue": null,
              "minOrderValue": null,
              "product": {
                "productId": "123456789",
                "productName": "Chequered Red Shirt",
                "variantId": "123456789",
                "variantName": null
              },
              "collections": []
            }
          }
        ],
        "isRepeatable": true,
        "maxAchievement": -1,
        "type": "EventBased",
        "visibility": "Always Visible",
        "icon": "https://s3.us-east-2.amazonaws.com/gameball.dev.uploads/uploads/gb-library/general/annoncement.png",
        "availability": {
          "minLevel": 1,
          "tags": []
        },
        "redirectionButtonText": "Free Gift",
        "redirectionButtonLink": "https://claires.myshopify.com/products/jeans"
      }
    }
  ]
}

Usage Example

The example shown is a request sent to Gameball to get a customer's rewards campaign's progress with playerUniqueIdplayer456and challengeHandle “New%20customer

curl -X GET -H 'apiKey: 807b041b7d35425988e354e1f6bce186' \
       -H 'secretKey: klmb041b7d354259l3u4ft35e1q2r3703' -d 
-v -i 'https://api.gameball.co/api/v3.0/integrations/player/player456/progress/challenge/New%20customer'

DELETE - Delete Customer

This API is used to delete a customer along with his attributes, transactions, achievements and actions.

https://api.gameball.co/api/v3.0/integrations/player/{playerUnqiueId}

mobile or email should replace playerUniqueId in case (only if) your account supports channel merging.

Request

Header

Path Parameters

Usage Example

curl -X DELETE -H 'apiKey: 807b041b7d35425988e354e1f6bce186' \
       -H 'secretKey: klmb041b7d354259l3u4ft35e1q2r3703' -d 
-v -i 'https://api.gameball.co/api/v3.0/integrations/player/player456'

GET - Customer's Coupons

https://api.gameball.co/api/v3.0/integrations/transactions/{playerUniqueId}/coupon

mobile or email should replace playerUniqueId in case (only if) your account supports channel merging.

This endpoint is used to get the Coupons of a specific customer.

Request

Header

Path Parameters

Response

coupon Object

product Object

collection Object

group Object

optionsObject

Sample Response

[
    {
        "code": "R7KVWwoT4c",
        "isUsed": false,
        "value": 30.0,
        "currency": "EGP",
        "creationDate": "2022-09-21T11:08:42.298758",
        "couponType": "custom",
        "product": {
            "productId": null,
            "productName": null,
            "productDisplayName": null,
            "variantId": null,
            "variantName": null
        },
        "startAt": "2021-09-21T11:08:42.298758",
        "endAt": "2023-09-21T11:08:42.298758",
        "isExpired": false,
        "collections": [],
        "group": {
            "handle": "free_macdo",
            "title": "Free MACDO",
            "url": "https://www.mcdonalds.eg/eat/menu/Item/Chicken-MACDO-",
            "iconPath": "https://www.mcdonalds.eg/Cms_Data/Contents/En/Media/images/Menu/large-Image/Chicken-MACDO.png",
            "description": "Coupons in this group give a free macdo and can be rdeemed in all Mcdonalds branches"
        }
    },
    {
        "code": "zFHYySXdiy",
        "isUsed": false,
        "value": 50.0,
        "currency": "EGP",
        "creationDate": "2022-09-21T11:07:22.718595",
        "couponType": "percentage_discount",
        "product": {
            "productId": null,
            "productName": null,
            "productDisplayName": null,
            "variantId": null,
            "variantName": null
        },
        "startAt": null,
        "endAt": null,
        "isExpired": false,
        "collections": [],
        "group": null
    },
    
]

Usage Example

curl -X GET -H 'apiKey: 807b041b7d35425988e354e1f6bce186' \
       -H 'secretKey: klmb041b7d354259l3u4ft35e1q2r3703' -d 
-v -i 'https://api.gameball.co/api/v3.0/integrations/player/player456/coupon'

GET - Customer's Referrals

https://api.gameball.co/api/v3.0/integrations/players/{playerUniqueId}/referrals

mobile or email should replace playerUniqueId in case (only if) your account supports channel merging.

This endpoint is used to get the Referrals of a specific customer with the status of the referral for each referred customer, whether the referral has been completed (active) or pending the needed referral action (pending) as per your referral configurations.

Request

Header

Path Parameters

Query Parameters

Response

referredFriend Object

Sample Response

{
   "referredFriends":[
      {
         "displayName":"Jon Snow",
         "email":"jon.snow@example.com",
         "mobileNumber":"0123456789",
         "joinDate":"09/19/2019 21:06:29",
         "status":"Pending",
         "playerUniqueId":"123"
      },
      {
         "displayName":"Arya Stark",
         "email":"arya.stark@example.com",
         "mobileNumber":"0111111119",
         "joinDate":"09/19/2018 22:16:25",
         "status":"Active",
         "playerUniqueId":"123"
      }
   ],
   "total":2,
   "count":2,
   "totalPending":1,
   "totalActive":1
}

Usage Example

curl -X GET -H 'apiKey: 807b041b7d35425988e354e1f6bce186'
 -v -i 'https://api.gameball.co/api/v3.0/integrations/players/player456/referrals'

GET - Get all Customer's Referrals

https://api.gameball.co/api/v3.0/integrations/players/referrals

This endpoint is used to retrieve a comprehensive list of all referrals made by all customers along with the status of each referral for each referred customer, whether the referral has been completed (active) or pending the needed referral action (pending) as per your referral configurations.

Request

Header

Query Parameters

Response

referredFriend Object

referredBy Object

Sample Response

{
    "referredFriends": [
        {
            "playerUniqueId": "7181703840036",
            "displayName": "referral1 referral1",
            "email": "referral12@gmail.com",
            "mobileNumber": null,
            "joinDate": "0001-01-01T00:00:00",
            "status": "Pending",
            "referredBy": {
                "playerUniqueId": "7181695156516",
                "displayName": "test test",
                "email": "test.referral@gameball.co",
                "mobileNumber": null
            }
        },
        {
            "playerUniqueId": "7181952418084",
            "displayName": "adam referral",
            "email": "adam.referral@gameball.co",
            "mobileNumber": null,
            "joinDate": "0001-01-01T00:00:00",
            "status": "Active",
            "referredBy": {
                "playerUniqueId": "7181703840036",
                "displayName": "referral1 referral1",
                "email": "referral12@gmail.com",
                "mobileNumber": null
            }
        }
    ],
    "count": 2,
    "total": 2
}

Usage Example

curl -X GET -H 'apiKey: 807b041b7d35425988e354e1f6bce186'
 -v -i 'https://api.gameball.co/api/v3.0/integrations/players/referrals'

POST - Attach Tags to Customer

This API is used to attach tags to a Customer.

https://api.gameball.co/api/v3.0/integrations/player/{playerUnqiueId}/tags

mobile or email should replace playerUniqueId in case (only if) your account supports channel merging.

Request

Header

Path Parameters

Body

Sample Body

{
   "tags":"VIP,Platinum"
}

Usage Example

The example shown is a request sent to Gameball to attach tags "VIP,Platinum" to a customer with playerUniqueIdplayer456”.

curl -X POST -H 'apiKey: 807b041b7d35425988e354e1f6bce186' -d 
'{
   "tags":"VIP,Platinum"
 }' -v -i 'https://api.gameball.co/api/v3.0/integrations/player/player456/tags'

DELETE - Detach Tags

https://api.gameball.co/api/v3.0/integrations/player/{playerUnqiueId}/tags

mobile or email should replace playerUniqueId in case (only if) your account supports channel merging.

This API is used to detach tags from a customer.

Request

Header

Path Parameters

Body

Sample Body

{
   "tags":"VIP"
}

Usage Example

The example shown is a request sent to Gameball to detach tags "VIP" from a customer with playerUniqueIdplayer456”.

curl -X DELETE -H 'apiKey: 807b041b7d35425988e354e1f6bce186' -d '{
   "tags":"VIP"
  }' -v -i 'https://api.gameball.co/api/v3.0/integrations/player/player456/tags'