Verxio Protocol

Award Loyalty Points

Grant loyalty points to users based on their actions. Points are automatically calculated based on your program's point allocation rules and can trigger tier upgrades.

Overview

The awardLoyaltyPoints function adds points to a user's loyalty pass based on a specific action type. The system automatically calculates tier progression and updates the user's status.

import { awardLoyaltyPoints } from '@verxioprotocol/core'

const result = await awardLoyaltyPoints(context, {
  passAddress: publicKey('USER_PASS_ADDRESS'),
  action: 'purchase',
  signer: programAuthority,
  multiplier: 2  // Optional: 2x points for this action
})

Parameters

ParameterTypeRequiredDescription
contextVerxioContextThe initialized Verxio context object
passAddressPublicKeyThe loyalty pass address to award points to
actionstringAction type (must be defined in program's pointsPerAction)
signerSignerProgram authority required for awarding points
multipliernumberPoint multiplier (default: 1)

Return Value

{
  points: number,           // New total points
  signature: string,        // Transaction signature
  newTier?: LoyaltyProgramTier  // New tier if user was upgraded
}

Common Actions

🛒 Purchase

Award points when users make purchases

action: 'purchase'

⭐ Review

Reward users for leaving product reviews

action: 'review'

👥 Referral

Bonus points for referring new customers

action: 'referral'

📱 Social Share

Points for social media engagement

action: 'socialShare'