Gameball Developers Guide
v3.0
v3.0
  • Introduction
  • What's New in V3.0
  • Installing Gameball
    • Web
      • Show Gameball Customer Widget
      • Track Customer Events
      • Track Orders & Cashback Reward
      • Integrate Redemption
      • Track Referrals
      • Go-Live Checklist
    • iOS
      • Getting Started
      • Initialize Gameball Customer Profile
      • Track Customer Events
      • Track Orders & Cashback Reward
      • Integrate Redemption
      • Track Referrals
      • Push Notifications
      • Go-Live Checklist
    • Android
      • Getting Started
      • Initialize Gameball SDK
      • Initialize Gameball Customer Profile
      • Track Customer Events
      • Track Referrals
      • Push Notifications
      • Go-Live Checklist
    • React Native
      • Getting Started
      • Initialize Gameball Customer Profile
      • Track Customer Events
      • Track Orders & Cashback Reward
      • Integrate Redemption
      • Track Referrals
      • Push Notifications
      • Go-Live Checklist
      • Migration from v1 to v2
    • Flutter
      • Getting Started
      • Initialize Gameball SDK
      • Initialize Gameball Customer Profile
      • Track Customer Events
      • Track Referrals
      • Go-Live Checklist
    • Generic Mobile App
      • Initialize Gameball Customer Profile
      • Track Customer Events
      • Track Orders & Cashback Reward
      • Integrate Redemption
      • Track Referrals
      • Push Notifications
    • Retail & Modern POS
      • Initialize Gameball Customer Profile
      • Track Orders & Cashback Reward
      • Track Refunds
      • Enable Redemption
        • Prepare POS for Redemption
        • Using Virtual ID
          • Using Virtual Card
  • REST API
    • Overview
      • Server-Side SDKs
    • Authentication
    • API Reference
      • Customer
      • Event
      • Transactions
      • Order
      • Coupons
      • Leaderboard 👑
      • Notifications 👑
      • Configurations 👑
      • Batches 👑
        • Batch Operations Data
      • OTP
      • Partner 🤝
        • Client 🤝
        • Redemption Rule 🤝
        • Cashback Rule 🤝
    • Webhooks
      • Notifications Webhook
      • Customer Profile Webhook
    • Errors
    • Object Reference
  • Tutorials
    • Build Custom UI Elements 👑
      • Display Reward Campaign Progress
      • Show VIP Tiers
      • Show Customer Points Balance
      • Build Leaderboards
      • Show Notifications Inbox
      • Adapt UI to Configurations
      • Advanced UI Techniques
        • Increase Sales with Cashback UI Elements
        • Derive Engagement with Rewards Campaigns UI Elements
    • Tracking Customer Events
    • Build your Own Notification System
    • Checkout Integration Example
    • Redemption Integration Options
      • Redeem with coupon system
        • Integrate your coupon system
          • Example using e-commerce platform(WooCommerce)
          • Example using a custom coupon system
        • Build couponing experience
          • Using Gameball widget
          • Build custom experience
            • Showing customers available points
            • Allowing customers to create coupons
            • Apply the discount code to your cart
        • Coupon integration reference
      • Redeem with direct debt
        • Get customers points balance
        • Redeem customer points
  • Third Party Integrations
    • Segment Integration
Powered by GitBook
On this page
  1. Tutorials
  2. Redemption Integration Options
  3. Redeem with coupon system
  4. Build couponing experience
  5. Build custom experience

Showing customers available points

PreviousBuild custom experienceNextAllowing customers to create coupons

Last updated 1 year ago

Allowing customers to view their points is one of the essentials for a top notch Redemption experience. For example, John has been using your e-commerce platform that rewards him with points for making purchases and engaging with the platform. He logged in to his account and checked his points balance by navigating to the points section of your platform. Here, he sees that he has accumulated 1330 points. To display john's points you will have to call which returns the following payload.

{
    "pointsBalance": 1330,
    "pointsValue": 200,
    "pendingPoints": 100,
    "pendingPointsValue": 0,
    "totalPositivePoints": 1230,
    "totalPositivePendingPoints": 100,
    "totalNegativePoints": 0,
    "totalNegativePendingPoints": 0
    "currency": "EGP",
    "pointsName": "Points"
}

The points available to redeem are calculated by deducting the pointsBalance from the pendingPoints

pointsAvailable = pointsBalance - pendingPoints

If we applied this on our example json payload then the points available to use will be :

pointsAvailable = 1330 - 100

To display a customer's current points balance, you can use pointsAvailable which stores the customer's current balance. You can then display this balance on your redemption page using a simple HTML element like a paragraph or span:

<p><span id="points-balance">{{pointsAvailable}}</span>Points</p>

To display the equivalent monetary value of a customer's points, you can use pointsValue that stores the monetary value of available points.

You can display this value on your redemption page using a similar HTML element:

<p>Equals to <span id="points-value">{{pointsValue}} {{currency}}</span></p>

You can also replace currency in the html with the currency attribute in the API response.

function getPlayerBalance(playerUniqueId){
var playerBalanceResponse = {
    "pointsBalance": 1330,
    "pointsValue": 200,
    "pendingPoints": 100,
    "pendingPointsValue": 0,
    "totalPositivePoints": 1230,
    "totalPositivePendingPoints": 100,
    "totalNegativePoints": 0,
    "totalNegativePendingPoints": 0
    "currency": "EGP",
    "pointsName": "Points"
}
var playerActualPoints = playerBalanceResponse["pointsBalance"]
var playerPointsToRedeem = 60 // points your player tried to redeem 
var minimumPointsRequiredToRedeem = 500 // minimum points needed to redeem this reward 
if(playerPointsToRedeem >= playerActualPoints || playerPointsToRedeem < minimumPointsRequiredToRedeem){
    //Display error to user that he can not redeem points.
}
}

Optionally, you can decide the minimum number of points needed to redeem points, for example, you can set this number statically in your code as below

function getPlayerBalance(playerUniqueId){
....
var minimumPointsRequiredToRedeem = 500 // minimum points needed to redeem this reward
}

and compare wether the points the customer redeem is less than the minimum points needed to redeem or not.

function getPlayerBalance(playerUniqueId){
....
var playerPointsToRedeem = 60 // points your customer tried to redeem 
var minimumPointsRequiredToRedeem = 500 // minimum points needed to redeem this reward
if(playerPointsToRedeem < minimumPointsRequiredToRedeem){
//Display error to user that customer can not redeem points less than the minimum.    
}
}

The {{pointsAvailable}} is a placeholder that will be replaced with the actual value of pointsAvailable which will we will get from the when the page is rendered.

To prevent your customer from redeeming points below specific number of points, For example, you might want to prevent your customer from redeeming points. if his point balance is less than 200 points. You can use pointsBalance in API to validate if the points the customer tries to redeem is more than his balance or not.

CustomerBalanceResponse variable is the response body after you call the API to display customer's and you check the pointsBalance against the number points choose to redeem in the UI.

We recommend going through this for more important insights.

guide
GetCustomerBalance
Customer points balance API
Customer points balance
Customer's points balance API