Deferred purchases

Deferred and pending purchases

Deferred or interrupted in-app purchases may happen when SCA confirmation is needed, in the case of parental control and some other cases.
Here is how the deferred purchase flow looks like:

  • a user initiates a purchase
  • purchase is received in state deferred
  • you get a purchase error with deferred purchase description
  • if a transaction completes successfully later, Apple StoreKit or Google Billing Service returns a successful purchase
  • Qonversion SDK returns a successful purchase

Make sure your app handles deferred or interrupted transactions by setting a delegate and a function that is triggered when such a transaction is made.

🚧

Attention

Please note, this function is called only in case of deferred purchases. The purchase flow happens as described above for all other cases.

Set delegate (iOS only)

Set the delegate to handle pending purchases.

Qonversion.setPurchasesDelegate(self)
[Qonversion setPurchasesDelegate:self];

Add function to handle permissions

Add this function to handle new permissions when the purchase is completed

func qonversionDidReceiveUpdatedPermissions(_ permissions: [String : Qonversion.Permission]) {
    // handle updated permissions here
}
- (void)qonversionDidReceiveUpdatedPermissions:(NSDictionary<NSString *, QNPermission *>  * _Nonnull)permissions {
    // handle updated permissions here
}
Qonversion.setUpdatedPurchasesListener(permissions -> {
    // handle updated permissions here
});
Qonversion.setUpdatedPurchasesListener(object: UpdatedPurchasesListener {
    override fun onPermissionsUpdate(permissions: Map<String, QPermission>) {
        // handle updated permissions here
    }
})
StreamSubscription<Map<String, QPermission>> _deferredPurchasesStream;
_deferredPurchasesStream = Qonversion.updatedPurchasesStream.listen((permissions) => {
   // handle updated permissions here
});

Did this page help you?