Giftoin Docs
  • 👋INTRODUCTION
    • Welcome to Giftoin
    • Overview
    • Quick Start
    • FAQs
    • Key Features
  • 🧩API REFERENCE
    • Standards and Conventions
    • Orders API
      • Tokens/Points
      • Collectibles/Cards
      • Collectibles/Random Cards
    • Users API
      • Inventory
      • Progress
    • Error Handling
  • 💻PLATFORM GUIDES
    • Roblox
      • Why use Giftoin?
      • Basic Usage
      • Developer Access
      • Installation
      • Additional Example / Use-Cases
        • Point Reward
        • Daily Reward
        • Advanced Point Distribution System
        • Managed Codes & In-Game Rewards (Coming Soon)
          • Registering Reward Types
      • Tools and Scripts
        • Rotating Script
        • Floating Script
        • Quest System (Coming Soon)
    • Discord
      • Introduction
      • Getting Started
      • Command Reference
      • Role System
      • User Guides
      • Troubleshooting
      • FAQs
    • Wordpress
  • 📚Resources
    • Use Cases
      • Basic
      • eCommerce
      • Games
    • Support
Powered by GitBook
On this page

Was this helpful?

  1. Resources
  2. Use Cases

Games

Gaming Rewards & Achievements

Enhance player engagement and retention in your games with strategic rewards and achievements.

Daily Login Rewards

Reward players for logging in consecutively:

-- Roblox example for daily rewards
local GiftoinModule = require(ServerScriptService:WaitForChild("GiftoinModule"))
local GiftoinEvents = GiftoinModule.Events

-- Track player logins
local function onPlayerJoin(player)
    local userId = tostring(player.UserId)
    local lastLogin = getLastLoginTime(userId)
    local currentTime = os.time()
    
    -- Check if this is a new daily login
    if isNewDay(lastLogin, currentTime) then
        -- Increment streak counter
        local streak = incrementLoginStreak(userId)
        
        -- Award points based on streak length
        local pointsToAward = calculateStreakPoints(streak)
        GiftoinEvents.sendPoints(player, "daily_login", pointsToAward)
        
        -- On milestone days, send special gifts
        if streak == 7 then
            -- Weekly milestone reward
            GiftoinEvents.sendSpecialReward(player, "weekly_milestone")
        elseif streak == 30 then
            -- Monthly milestone reward
            GiftoinEvents.sendSpecialReward(player, "monthly_milestone")
        end
        
        -- Update last login time
        updateLastLoginTime(userId, currentTime)
    end
end

-- Connect to PlayerAdded event
game.Players.PlayerAdded:Connect(onPlayerJoin)

Achievement Systems

Create a comprehensive achievement system:

  1. Define achievement categories:

    • Progression (completing levels, reaching milestones)

    • Collection (gathering items, completing sets)

    • Skill (mastering game mechanics, setting records)

    • Social (team play, community participation)

  2. Design a reward structure:

    • Digital collectibles for visual achievements

    • In-game currency or items for functional rewards

    • Status badges for social recognition

    • Access to exclusive content or features

  3. Implementation example:

// Track achievement progress and award when completed
function updateAchievementProgress(userId, achievementId, progress) {
  // Get current progress
  const currentProgress = getUserAchievementProgress(userId, achievementId);
  const achievement = getAchievementDetails(achievementId);
  
  // Update progress
  const newProgress = currentProgress + progress;
  saveUserAchievementProgress(userId, achievementId, newProgress);
  
  // Check if achievement is completed
  if (newProgress >= achievement.targetValue && !isAchievementCompleted(userId, achievementId)) {
    // Mark as completed
    markAchievementCompleted(userId, achievementId);
    
    // Send Giftoin reward
    sendAchievementReward(userId, achievementId);
  }
}

// Send the reward through Giftoin
async function sendAchievementReward(userId, achievementId) {
  const achievement = getAchievementDetails(achievementId);
  const userEmail = getUserEmail(userId);
  
  try {
    const response = await fetch(`https://api.giftoin.org/api/v1/gcm/reseller/campaign/${achievement.campaignId}/order`, {
      method: 'POST',
      headers: {
        'x-gft_api_key': 'YOUR_API_KEY',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        contacts: [userEmail],
        title: `Achievement Unlocked: ${achievement.name}`,
        description: achievement.rewardDescription,
        metadata: {
          achievementId: achievementId,
          userId: userId
        }
      })
    });
    
    // Notify the user in-game
    notifyUserOfAchievement(userId, achievementId);
    
  } catch (error) {
    console.error(`Error sending achievement reward for ${achievementId}:`, error);
    // Handle error - queue for retry
  }
}

Player Retention Strategies

  • Create progression systems with increasing rewards

  • Implement surprise gifts for reaching milestones

  • Design limited-time events with exclusive rewards

  • Create collection mechanics that encourage completionism

  • Implement leaderboards with periodic rewards

  • Use rewards to guide players to underutilized game features

Analytics and Optimization

Track these metrics to optimize your gaming rewards:

  • Redemption rates by reward type

  • Player retention lift from reward programs

  • Session frequency and duration changes

  • Social sharing of achievements

  • Conversion impact on in-game purchases

PreviouseCommerceNextSupport

Last updated 2 months ago

Was this helpful?

📚