Active Perks
ActivePerks feature - the member rewards program: merchant catalog with cashback, gift card purchases, a gift card wallet, and cashback redemption.
Error contract
Every function is suspend and throws on failure - network, HTTP and malformed-response errors all surface as AFException (with the underlying cause preserved), never as an empty or defaulted result. An empty list from a getter always means the member genuinely has no data.
Writes that return nothing (payment method changes, cashback redemption, favorites, wallet updates) complete normally only once the server has saved the change; a refusal throws an AFException whose message is the server's own explanation, ready to show to the member.
Typical flows
Entry: getEnrollment decides between the dashboard, the signup form (signUp) and the recovery flow.
Dashboard: getMerchants + getMemberProfile.
Purchase: getMerchantDetails ->checkout ->processOrder.
Wallet: getActiveGiftCards / getArchivedGiftCards / updateGiftCard, plus checkGiftCardBalance on the cards that support it.
Android (Kotlin)
lifecycleScope.launch {
try {
val merchants = AFCore.activePerks().getMerchants()
showCatalog(merchants)
} catch (t: Throwable) {
showError(t)
}
}iOS (Swift)
Task {
do {
let merchants = try await AFCore.shared.activePerks().getMerchants()
self.showCatalog(merchants)
} catch {
self.showError(error)
}
}Functions
Marks a merchant as a favorite of the member. Completes when the favorite is saved.
Adds a payment method to the member's ActivePerks account.
Reads the live remaining balance of one gift card from the merchant.
Retrieves the member's active (non-archived) gift cards.
Retrieves the member's archived gift cards.
Retrieves the member's available cashback balance.
Retrieves the member's cashback history.
Retrieves the member's ActivePerks enrollment status.
Retrieves the member's ActivePerks profile: identity, program branding, cashback totals, saved payment methods and favorite merchant ids.
Retrieves the full detail of one merchant, including gift card (ecode) and online-mall purchase options.
Retrieves the merchant catalog available to the member, with each merchant's favorite flag already resolved for this member.
Retrieves the member's past ActivePerks orders.
Pays for and completes a gift card order opened by checkout.
Redeems cashback to a charity. Completes when the redemption is saved.
Removes a merchant from the member's favorites. Completes when the change is saved.
Removes a saved card from the member's ActivePerks account.
Makes a saved card the member's default payment method.
Renames a saved card so the member can tell two cards apart.
Enrolls the member in ActivePerks with a payment card.
Archives, unarchives or annotates a gift card in the wallet. Completes when the change is saved.