Payments and Ads
Configure RevenueCat purchases and AdMob for Account and Guest projects.
RevenueCat
BillingStore owns customer identity, purchase state, restore, and entitlement refresh. Native gateways present RevenueCat paywalls and Customer Center. BillingConfig.ENTITLEMENT_ID in BillingModels.kt is bowlerkit_pro; create a matching RevenueCat entitlement and attach your store products. The KMP template does not define a fixed list of product IDs.
| Profile | Identity and premium status |
|---|---|
| Account | Authenticated backend UUID becomes the RevenueCat App User ID. Device entitlements are combined with GET /api/v1/app/billing/entitlements. Device status remains available when backend confirmation fails. |
| Guest | Anonymous RevenueCat customer. Premium status comes from the device SDK, without Account entitlement requests. |
Purchase and restore operations may need internet access in either profile. Missing SDK keys make billing unavailable rather than simulate a purchase.
Configuration
Paths below are relative to generated mobile-app/.
| File | Configuration keys |
|---|---|
local.properties | REVENUECAT_ANDROID_API_KEY |
iosApp/Configuration/Config.local.xcconfig | REVENUECAT_IOS_API_KEY |
These files are git-ignored. Use RevenueCat Test Store keys (test_...) for debug builds and real platform store keys for release. Configure your offerings and store products in RevenueCat before testing the paywall.
ONBOARDING_PAYWALL_ENABLED exists on both platforms and defaults to disabled: Android uses false, iOS uses NO. This controls the onboarding paywall, independently of the Billing screen.
AdMob
Both profiles include Google Mobile Ads and the UMP consent flow. AdsStore handles consent ordering, premium gating, retry limits, and interstitial pacing. The native gateways implement interstitial and rewarded ads. Consent must allow requests before the ads SDK starts; ordinary load/show failures return failure states.
Replace all three sample IDs for each platform before release:
| File | Configuration keys |
|---|---|
local.properties | ADMOB_ANDROID_APP_ID, ADMOB_ANDROID_INTERSTITIAL_UNIT_ID, ADMOB_ANDROID_REWARDED_UNIT_ID |
iosApp/Configuration/Config.local.xcconfig | ADMOB_IOS_APP_ID, ADMOB_IOS_INTERSTITIAL_UNIT_ID, ADMOB_IOS_REWARDED_UNIT_ID |
The defaults are Google's sample IDs. AdsPolicy in AdsModels.kt defines pacing and retry settings; use that shared policy when changing ad frequency.
Verify before release
Test Account UUID association, Guest anonymous purchases, restore, Customer Center, cancellation, unavailable billing, and offline backend confirmation. Test consent denial, privacy options, premium ad suppression, rewarded dismissal, and ad no-fill on both platforms. See Release for native artifacts.
Source map
Shared files are under sharedLogic/src/commonMain/kotlin/com/soewidiputra/kmponlate/: BillingStore.kt, BillingModels.kt, BillingRepository.kt, AdsStore.kt, and AdsModels.kt. Android gateways are AndroidBillingGateway.kt and AndroidAdsGateway.kt under sharedUI/src/androidMain/kotlin/com/soewidiputra/kmponlate/. iOS gateways are iosApp/iosApp/IOSBillingGateway.swift and iosApp/iosApp/IOSAdsGateway.swift.
