Inline Ad Reward
Award automated, pre-configured credit incentives to users directly from your custom modal controllers after they view an ad.
Instead of passing hardcoded amounts from your code, this calls your centralized dashboard config values (adCredits) to award static, consistent incentive points.
typescript
// Ad complete signal confirmed by network
const result = await settle.billing.rewardAd('user_998877')
console.log(result.creditsAwarded) // e.g. 5 (controlled in dashboard)
console.log(result.newBalance) // e.g. 455The Ultimate "Vibe Fallback" Flow
typescript
try {
// 1. Charge user for premium action
await settle.wallet.debit(userId, { amount: 5, description: "AI Tool" })
} catch (err) {
if (err instanceof InsufficientCreditsError) {
// 2. Prompt them to watch a quick sponsored ad to gain free credits
const watched = await triggerRewardedAdClient()
if (watched) {
// 3. Inform the API and grant their instant incentive
await settle.billing.rewardAd(userId)
// 4. Retry original action now that balance is restored!
await settle.wallet.debit(userId, { amount: 5, description: "AI Tool" })
}
}
}