Skip to main content

Using the SDK with your own IAP Code (formerly: Observer Mode)

If you already have your own in-app purchase handling logic in your app and want to start using RevenueCat alongside it, you might need to set the SDK configuration option that your app will complete the purchases itself (configuration option purchasesAreCompletedBy, see code below). Completing a purchase tells the device billing library that a purchase has been processed and can be discarded. RevenueCat does this by default, however, this may interfere with pre-existing purchase handling code in your app.

If you set the SDK option that your app will complete purchases itself, you can still make use of most of RevenueCat's features, without replacing your existing purchase handling code.

📘Observer mode

The setting where your app completes purchases was formerly called "observer mode". Older versions of the SDK (currently including the iOS and cross-platform SDKs) still refer to this terminology.

⚠️Purchases need to manually be synced on Amazon Appstore

For Amazon Appstore apps, you will need to call the syncAmazonPurchase() method after making a purchase using your own IAP code.

SDK Configuration

with: .init(withAPIKey: "<public_sdk_key>")
.with(purchasesAreCompletedBy: .myApp, storeKitVersion: .storeKit2)