Sections
Theme

Rewards

getRewards and hasReward — reading the current user's reward ledger

The SDK reads the current user's reward ledger — the same records the reward webhook delivers and the dashboard shows. One source of truth, two consumption styles: pull-based reads here, or push via the webhook.

Reward delivery

Reward delivery runs on the server. Use the signed reward webhook to grant free access, currency, or unlocks in your backend. Configured offer codes deliver store benefits; gift cards and cash payouts use the hosted payout flow. The SDK ledger is for displaying reward status; reading an available reward does not grant an entitlement.

getRewards

The current user's full reward ledger, optionally filtered.

ParameterTypeDescription
filter.statusRewardStatusOptional. pending, available, claimed, fulfilled, or expired.
filter.campaignIdstringOptional. Limit to one campaign.
filter.kindstringOptional. Limit to a reward kind, e.g. free_month.

Returns a list of Reward records — { id, kind, status, campaignId, title, payload, createdAt, claimedAt }, with title display-ready.

invitebase.getRewards(filter?: RewardFilter): Promise<Reward[]>
const rewards = await invitebase.getRewards({ status: 'available' });
rewardsList.render(rewards);

hasReward

Render-time availability check for one reward — cheaper and clearer than filtering the full ledger.

ParameterTypeDescription
kindOrIdstringA reward kind (super_referrer_badge) or reward ID (8f3a2b1c-6d94-4e07-9a58-1b7c4d2e9f30).

Returns true if the user has this reward available and unclaimed.

invitebase.hasReward(kindOrId: string): Promise<boolean>
if (await invitebase.hasReward('super_referrer_badge')) {
  profileBadge.show();
}

What's next

On this page