Report transactions in Observer Mode in iOS SDK

In Observer mode, the Adapty SDK can’t track purchases made through your existing purchase system on its own. You need to report transactions from your app store. It’s crucial to set this up before releasing your app to avoid errors in analytics.

Use reportTransaction to explicitly report each transaction for Adapty to recognize it.

Warning

Don’t skip transaction reporting! If you don’t call reportTransaction, Adapty won’t recognize the transaction, it won’t appear in analytics, and it won’t be sent to integrations.

If you use Adapty flows & paywalls, include the variationId when reporting a transaction. This links the purchase to the flow or paywall that triggered it, ensuring accurate analytics.

do {
    // every time when calling transaction.finish()
    // verificationResult is the VerificationResult<Transaction> StoreKit 2 returns
    try await Adapty.reportTransaction(verificationResult, withVariationId: <YOUR_PAYWALL_VARIATION_ID>)
} catch {
    // handle the error
}

Parameters:

ParameterPresenceDescription
transactionrequiredVerificationResult<Transaction>, as StoreKit 2 returns it, before you unwrap it. Adapty sends the signed transaction to the server. The overload that takes a bare Transaction is deprecated since SDK 4.3.2.
variationIdoptionalThe unique ID of the paywall variation. Pass the variationId of the AdaptyPaywallProduct the user bought. It’s the same value as the variationId of the AdaptyFlowPaywall that contains this product.