Add AIDL to query purchase history inapp products#2872
Conversation
| ).run() | ||
|
|
||
| // For INAPP, use PurchaseHistoryManager (AIDL) | ||
| if (productType == BillingClient.ProductType.INAPP) { |
There was a problem hiding this comment.
Note that I changed to use the AIDL only for INAPP purchases since I don't think we care (other than for importing devs from previous migrations) about expired subscriptions. Lmk if you think we should also use it for SUBS for completeness. I was mostly trying to minimize the aspects where this is necessary.
|
This shouldn't be merged yet, but planning to make a beta build with these changes so we can test them more internally. I would appreciate a review before then @RevenueCat/sdk @RevenueCat/catforms |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2872 +/- ##
==========================================
+ Coverage 78.49% 78.80% +0.31%
==========================================
Files 332 337 +5
Lines 12878 13131 +253
Branches 1749 1770 +21
==========================================
+ Hits 10108 10348 +240
- Misses 2036 2041 +5
- Partials 734 742 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This comment was marked as outdated.
This comment was marked as outdated.
| buildConfigField( | ||
| type = "boolean", | ||
| name = "ENABLE_QUERY_PURCHASE_HISTORY_AIDL", | ||
| value = (localProperties["ENABLE_QUERY_PURCHASE_HISTORY_AIDL"] as? String ?: "false"), |
There was a problem hiding this comment.
Note that this is currently disabled by default, but we still include the AIDL in the SDK, so we should confirm it wouldn't cause issues with automated app reviews mostly.
|
Great work RevenueCat team! Our app is using the anonymous user system, "Share between App User IDs" (legacy), and one-time non-consumable product setup and this fixes the Google Billing Play 8 issue for me. I don't recall our one time product ever being consumable, but restoring purchases was affected by B8 anyway (as noted here). I gave 9.16.0-alphaaidl01 a try and I verified purchases were restored correctly for my setup. Screenshot of RevenueCat Debug UI for reference: |
|
Quick follow up. In the pull request I noticed that the AIDL setting is off by default yet I got purchase information regardless. As a sanity check I re-tested with I'm happy to share my app and product identifiers if it'll help. |
|
Thanks for sharing that @pauledwardtang. That's actually normal. The initial idea was to merge this disabled and enable later, but we ended up making an alpha and beta releases that has this flag enabled without merging this (in the release PRs themselves). We will however enable this flag before merging this. Thanks again! |
|
@pauledwardtang You're completely right. I just rechecked, and while we did enable the flag in |
|
@pauledwardtang We just released 9.16.0-beta02 with a fix for that. Thanks again for reporting that issue! |
This reverts commit f452c66 PR #2872 . ### Description We're removing usage of this unofficial APIs. This will result in a behavior breaking change. Docs for the behavior: https://www.revenuecat.com/docs/known-store-issues/play-billing-library/restore-consumable-purchases-bc8 <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Behavior change for Google Play Billing v8 restores: consumed one-time purchases may no longer appear during restore since the unofficial AIDL `getPurchaseHistory` path is removed. Risk is limited to restore/purchase history behavior; no auth or backend data handling changes. > > **Overview** > **Reverts the unofficial AIDL integration used to fetch Play Store in-app purchase history.** `BillingWrapper.queryPurchaseHistoryAsync` no longer conditionally queries `IInAppBillingService.getPurchaseHistory` and instead always runs `QueryPurchaseHistoryUseCase`. > > This removes the `aidl` build feature and the `ENABLE_QUERY_PURCHASE_HISTORY_AIDL` build config flag, deletes the AIDL interface and `google/history` implementation (`PurchaseHistoryManager` + related models), and drops the associated unit tests that exercised the AIDL fallback behavior. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit e8ec3aa. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->


Description
With BC8, we lost the ability of querying consumed one time products, which sometimes we needed to unlock entitlements correctly on a restore, in cases where the products were accidentally consumed. This uses the old AIDL service to be able to query those products instead of using the billing library.