Console →
SDK Reference

Record Ad Reward

Award credits to a user after they watch a rewarded ad. Use this as a fallback when their balance hits zero.

typescript
await settle.wallet.recordAdReward('user_123', {
  adNetwork: 'admob',           // The ad network that served the ad
  rewardAmount: 5,              // Credits to award
  adUnitId: 'ca-app-pub-xxx',  // Optional — the specific ad unit
})

Typical flow#

typescript
try {
  await settle.wallet.debit(userId, { amount: 10, description: 'AI Query' })
} catch (err) {
  if (err instanceof InsufficientCreditsError) {
    // Show a rewarded ad to the user
    const adResult = await showRewardedAd()

    if (adResult.completed) {
      // User watched the ad — give them credits
      await settle.wallet.recordAdReward(userId, {
        adNetwork: 'admob',
        rewardAmount: 10,
      })
      // Retry the original action
      await settle.wallet.debit(userId, { amount: 10, description: 'AI Query' })
    }
  }
}