Associate paywalls to purchase transactions in Observer mode
In Observer mode, Adapty SDK cannot determine the source of purchases as you are the one processing them. Therefore, if you intend to use paywalls and/or A/B tests in Observer mode, you need to associate the transaction coming from your app store with the corresponding paywall in your mobile app code. This is important to get right before releasing your app, otherwise it will lead to errors in analytics.
After the preliminary configuration is done, you need to associate the transaction generated by Apple or Google to the corresponding paywall in your mobile app code using the variationId
parameter as shown in the example below. Make sure you always associate the transaction with the paywall that generated it, only then you will be able to see the correct metrics in the Adapty Dashboard.
- Swift
- Kotlin
- Java
- Flutter
- Unity
- React Native (TS)
let variationId = paywall.variationId
// There are two overloads: for StoreKit 1 and StoreKit 2
Adapty.setVariationId(variationId, forPurchasedTransaction: transaction) { error in
if error == nil {
// successful binding
}
}
Adapty.setVariationId(transactionId, variationId) { error ->
if (error == null) {
// success
}
}
Adapty.setVariationId(transactionId, variationId, error -> {
if (error == null) {
// success
}
});
final transactionId = transaction.transactionIdentifier
final variationId = paywall.variationId
try {
await Adapty().setVariationId('transaction_id', variationId);
} on AdaptyError catch (adaptyError) {
// handle the error
} catch (e) {
}
Adapty.SetVariationForTransaction("<variationId>", "<transactionId>", (error) => {
if(error != null) {
// handle the error
return;
}
// successful binding
});
const variationId = paywall.variationId;
try {
await adapty.setVariationId('transaction_id', variationId);
} catch (error) {
// handle the `AdaptyError`
}
Request parameters:
Parameter | Presence | Description |
---|---|---|
variationId | required | The string identifier of the variation. You can get it using variationId property of the AdaptyPaywall object. |
transaction | required | For iOS, StoreKit1: an For iOS, StoreKit 2: Transaction object. For Android: String identifier ( |
For accurate analytics, ensure the transaction is associated with the paywall within 3 hours of its creation.