You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/getting-started/restoring-purchases.mdx
+36-12Lines changed: 36 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,38 +60,59 @@ Consumables and non-renewing subscriptions can only be restored by using an acco
60
60
61
61
By logging in your users with a custom App User ID, RevenueCat can continue to provide transaction details in a user's [CustomerInfo](/customers/customer-info) for their previous consumable and non-renewing subscription purchases.
62
62
63
-
## Issues restoring one-time purchases with Google's Billing Client 8 when using anonymous users
63
+
## [SOLVED] Issues restoring one-time purchases with Google's Billing Client 8 when using anonymous users
64
+
65
+
:::info[Android Fix Available (9.16.0+)]
66
+
As of [purchases-android 9.16.0](https://github.com/RevenueCat/purchases-android/releases/tag/9.16.0), the Android SDK includes a fix for the Billing Client 8 limitation described below. If you're using purchases-android 9.0.0-9.15.x, upgrading to 9.16.0 or later is strongly recommended.
67
+
68
+
For cross-platform SDKs (React Native, Flutter, etc.), ensure you're using a version that includes purchases-android 9.16.0+.
Starting on Billing Client 8, Google removed the ability to query consumed one-time purchases through Google's Billing Client library. This means that our SDKs using that version of Billing Client won't be able to restore these purchases. This affects the following versions:
66
83
67
-
| RevenueCat SDK | Version using Billing Client 8+ |
- Your app DOESN'T offer an account system (so users can't log in to recover their purchases) and you rely on RevenueCat's anonymous users AND
79
97
- Your app has or had at any point in time used one-time products that were consumed. RevenueCat automatically consumes purchases for products that are configured as consumables in the RevenueCat dashboard.
80
98
81
99
In this scenario, these users will have anonymous user ids that won't be easily recoverable and won't be able to recover their purchases through the Billing Client, so those purchases can not be recovered.
82
100
83
-
One way to reduce the impact of this issue is by making sure RevenueCat's data is safely backed up in the user's Google account, so it is automatically restored when the user reinstalls the app and/or changes devices. RevenueCat stores data in its own SharedPreferences file. The exact name of that file is available as the constant `RevenueCatBackupAgent.REVENUECAT_PREFS_FILE_NAME`, which you can reference when setting up backups. We recommend you also include your app's default SharedPreferences file.
101
+
One way to reduce the impact of this issue is by making sure RevenueCat's data is safely backed up in the user's Google account, so it is automatically restored when the user reinstalls the app and/or changes devices. RevenueCat stores data in its own SharedPreferences file. The exact name of that file is available as the constant `RevenueCatBackupAgent.REVENUECAT_PREFS_FILE_NAME`, which you can reference when setting up backups. We recommend you also include your app's default SharedPreferences file.
84
102
85
103
There are 2 recommended approaches Google offers to perform backups:
Auto Backup is enabled by default in your app. This backs up most of your app content, including the RevenueCat SharedPreferences file, up to a 25MB limit, at which point, it stops doing backups. You can configure what you want to backup following [the official documentation](https://developer.android.com/identity/data/autobackup#IncludingFiles).
91
111
92
112
We recommend adjusting the files you want to back up to make sure you don't go over the limit and making sure the RevenueCat SharedPreferences file is included.
93
113
94
114
#### Key-Value backups
115
+
95
116
Please note that enabling this will disable Auto backup and will just back up RevenueCat files!
96
117
97
118
If you prefer to disable auto-backup and just back up the RevenueCat SharedPreferences file, you may optionally use our provided `RevenueCatBackupAgent` to perform a backup of the relevant files. To do this, you need to add to your app's `AndroidManifest.xml``<application>` node a property like this:
For the majority of apps, Auto Backup is enabled by default and should handle backups for you without doing anything. However, there are some situations where it won't:
127
+
105
128
- If your app has the potential of having more than 25MB of data over the files that Auto Backup automatically backs up (See [docs](https://developer.android.com/identity/data/autobackup#Files))
106
129
- If you have modified the files you would like to backup using Auto Backup and have not included RevenueCat's SharedPreferences file.
107
130
- If you have disabled backups
@@ -111,6 +134,7 @@ If you are in one of those positions, we recommend you make sure your backup con
111
134
Both options are powered by similar Google backup mechanisms and either should work pretty similarly, so we recommend using Auto Backup unless there is a reason you prefer to use a Backup Agent.
112
135
113
136
### How to test backups
137
+
114
138
Whether you're using Auto Backup or Key-Value backups, Google provides some documentation on how to test backups and restores [in their documentation](https://developer.android.com/identity/data/testingbackup).
115
139
116
140
One thing to note, however, is that these backups are not guaranteed to work across all devices and might require factory resets in the target device to use the backup.
As of [purchases-android 9.16.0](https://github.com/RevenueCat/purchases-android/releases/tag/9.16.0), this issue has been resolved for the Android SDK. We've added support for querying consumed one-time purchases using Google Play's AIDL service interface, which works around the Billing Client 8 limitation.
9
+
10
+
:::info Upgrade Recommendation
11
+
**If you're using purchases-android 9.0.0-9.15.x**, we strongly recommend upgrading to 9.16.0 or later to benefit from this fix.
Starting on Billing Client 8, Google removed the ability to query consumed one-time purchases through Google's Billing Client library. This means that our SDKs using that version of Billing Client won't be able to restore these purchases. This affects the following versions:
9
28
10
-
| RevenueCat SDK | Version using Billing Client 8+ |
This situation can cause problems if **both** of the following are true:
21
40
@@ -32,9 +51,10 @@ In this scenario, these users will have anonymous user ids that won't be easily
32
51
We found there is no good way to recover these purchases with Billing client 8. Currently the only way to lower the number of times users will run into issues restoring purchases is by being able to recover the RevenueCat anonymous user id used in previous installations. In order to do that, we recommend that you make sure you have configured backups correctly for your apps. We have written some documentation on the topic [here](https://www.revenuecat.com/docs/getting-started/restoring-purchases#issues-restoring-one-time-purchases-with-googles-billing-client-8-when-using-anonymous-users).
33
52
34
53
So right now, for everyone affected by this issue we would recommend to:
54
+
35
55
- Stay in major 8 of our SDK which uses Billing client 7. We will continue to bring important fixes to the major 8 until Billing client 8 is mandatory next year.
36
56
- Make sure backups for your app work and include the RevenueCat Shared Preferences file as mentioned in the [docs](https://www.revenuecat.com/docs/getting-started/restoring-purchases#issues-restoring-one-time-purchases-with-googles-billing-client-8-when-using-anonymous-users)
37
57
38
58
For users that have a backup performed in this situation and have a device compatible with backups, they would recover the RevenueCat anonymous user id, effectively recovering all their purchases as well.
39
59
40
-
Note that this solution won't fix all cases, since there are situations and devices where backups won't work. For those, the only solution right now is a manual approach by asking them for proof of purchase to obtain the Order ID of their purchase (Starting in `GPA.....`), then search the user for that orderId in the RevenueCat dashboard, which will allow you to find the user that did that purchase, then, from the RevenueCat dashboard itself, transfer those purchases to the new anonymous user the user is using. So for this manual approach you would need both the Order ID of the purchase and the anonymous user ID that the customer is using.
60
+
Note that this solution won't fix all cases, since there are situations and devices where backups won't work. For those, the only solution right now is a manual approach by asking them for proof of purchase to obtain the Order ID of their purchase (Starting in `GPA.....`), then search the user for that orderId in the RevenueCat dashboard, which will allow you to find the user that did that purchase, then, from the RevenueCat dashboard itself, transfer those purchases to the new anonymous user the user is using. So for this manual approach you would need both the Order ID of the purchase and the anonymous user ID that the customer is using.
0 commit comments