ActivePerks

interface ActivePerks

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

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

Link copied to clipboard
abstract suspend fun addFavoriteMerchant(merchantId: Int)

Marks a merchant as a favorite of the member. Completes when the favorite is saved.

Link copied to clipboard

Adds a payment method to the member's ActivePerks account.

Link copied to clipboard
abstract suspend fun checkGiftCardBalance(orderNumberDetail: Int): ActivePerksGiftCardBalance

Reads the live remaining balance of one gift card from the merchant.

Link copied to clipboard
abstract suspend fun checkout(merchantId: Int, ecodeId: Int, denomination: Double, quantityRequested: Int): ActivePerksCheckout

Opens a gift card checkout and returns its server-side pricing.

Link copied to clipboard

Retrieves the member's active (non-archived) gift cards.

Link copied to clipboard

Retrieves the member's archived gift cards.

Link copied to clipboard
abstract suspend fun getCashbackBalance(): Double

Retrieves the member's available cashback balance.

Link copied to clipboard

Retrieves the member's cashback history.

Link copied to clipboard
abstract suspend fun getEnrollment(): ActivePerksEnrollment

Retrieves the member's ActivePerks enrollment status.

Link copied to clipboard

Retrieves the member's ActivePerks profile: identity, program branding, cashback totals, saved payment methods and favorite merchant ids.

Link copied to clipboard
abstract suspend fun getMerchantDetails(merchantId: Int): ActivePerksMerchantDetails

Retrieves the full detail of one merchant, including gift card (ecode) and online-mall purchase options.

Link copied to clipboard
abstract suspend fun getMerchants(): List<ActivePerksMerchant>

Retrieves the merchant catalog available to the member, with each merchant's favorite flag already resolved for this member.

Link copied to clipboard

Retrieves the member's past ActivePerks orders.

Link copied to clipboard

Pays for and completes a gift card order opened by checkout.

Link copied to clipboard
abstract suspend fun redeemCashback(redemption: ActivePerksCashbackRedemption)

Redeems cashback to a charity. Completes when the redemption is saved.

Link copied to clipboard
abstract suspend fun removeFavoriteMerchant(merchantId: Int)

Removes a merchant from the member's favorites. Completes when the change is saved.

Link copied to clipboard
abstract suspend fun removePaymentMethod(savedCardId: Int)

Removes a saved card from the member's ActivePerks account.

Link copied to clipboard
abstract suspend fun setDefaultPaymentMethod(savedCardId: Int)

Makes a saved card the member's default payment method.

Link copied to clipboard
abstract suspend fun setPaymentMethodNickname(savedCardId: Int, nickname: String)

Renames a saved card so the member can tell two cards apart.

Link copied to clipboard
abstract suspend fun signUp(details: ActivePerksSignUpDetails): ActivePerksEnrollment

Enrolls the member in ActivePerks with a payment card.

Link copied to clipboard
abstract suspend fun updateGiftCard(orderNumberDetail: Int, notes: String?, archive: Boolean)

Archives, unarchives or annotates a gift card in the wallet. Completes when the change is saved.