Skip to main content
Solved

Purchased on iOS with app user id, but same app user id on android not showing anything


onlyhumn.nathan
Forum|alt.badge.img+2
I am unable to see entitlements/purchases on android when I’m logged in with the same user id that I used for iOS (I purchased through iOS).

Here is how I setup the app user id:

 
import React from "react";
import { useSelector } from "react-redux";
import Purchases from 'react-native-purchases'
 
const SetupRevenuecat = () => {
const stateAuthSession = useSelector(state => state.auth.session)
React.useEffect(() => {
Purchases.setLogLevel(Purchases.LOG_LEVEL.DEBUG)
console.log(stateAuthSession?.user.id)
if (Platform.OS === 'ios') {
console.log('ios user id: ', stateAuthSession?.user.id)
Purchases.configure({apiKey: 'appl_xxx', appUserID: stateAuthSession?.user.id })
} else if (Platform.OS === 'android') {
console.log('android user id: ', stateAuthSession?.user.id)
Purchases.configure({apiKey: 'goog_xxx', appUserID: stateAuthSession?.user.id })
}
Purchases.setAttributes({ "email": stateAuthSession?.user.email })
}, [])
}
export default SetupRevenuecat

Loading both android and ios shows:
 

 BUNDLE  ./index.js 

 

 LOG  Running "memlane" with {"rootTag":11,"initialProps":{}}

. . .

 LOG  ios user id:  68476cab-37c7-43b6-a7f0-cf39104ca76a

 LOG  android user id:  68476cab-37c7-43b6-a7f0-cf39104ca76a

 

Here is the button that triggers the purchase:
 
<TouchableOpacity
style={[{width: '100%', height: 50, alignItems: 'center', justifyContent: 'center'}]}
onPress={async () => {
try {
const offerings = await Purchases.getOfferings();
if (offerings.current !== null && offerings.current.availablePackages.length !== 0) {
const productDetails = offerings.current.availablePackages.find(pack => pack.identifier === pack_product_id)
await Purchases.purchasePackage(productDetails)
}
} catch (e) {
console.error('error: ', e.message);
}
}}
>
<Text style={[{ fontWeight: 'bold', fontSize: 25, color: 'white' }]}>Unlock Pack!</Text>

 

For checking if there is a purchase already, I do
 
const fetchCustomerInfo = async () => setCustomerInfo(await Purchases.getCustomerInfo())
console.log('starterPack.product_id ', starterPack?.product_id)
console.log('customerInfo?.entitlements?.active ', customerInfo?.entitlements?.active)
 
Then I do a check with typeof customerInfo?.entitlements?.active[starterPack?.product_id] !== "undefined"

Here are the logs I see showing the entitlements are empty :(

 

 LOG  starterPack.product_id  pack_romantic_essentials_1

 LOG  customerInfo?.entitlements?.active  {}

 LOG  {"activeSubscriptions": [], "allExpirationDates": {}, "allExpirationDatesMillis": {}, "allPurchaseDates": {}, "allPurchaseDatesMillis": {}, "allPurchasedProductIdentifiers": [], "entitlements": {"active": {}, "all": {}, "verification": "NOT_REQUESTED"}, "firstSeen": "2024-02-01T21:58:59.000Z", "firstSeenMillis": 1706824739000, "latestExpirationDate": null, "latestExpirationDateMillis": null, "managementURL": null, "nonSubscriptionTransactions": [], "originalAppUserId": "68476cab-37c7-43b6-a7f0-cf39104ca76a", "originalApplicationVersion": null, "originalPurchaseDate": "2024-02-01T14:22:43.000Z", "originalPurchaseDateMillis": 1706797363000, "requestDate": "2024-02-05T19:29:27.402Z", "requestDateMillis": 1707161367402}

 LOG  starterPack.product_id  pack_romantic_essentials_1

 LOG  customerInfo?.entitlements?.active  {}

 LOG  {"activeSubscriptions": [], "allExpirationDates": {}, "allExpirationDatesMillis": {}, "allPurchaseDates": {}, "allPurchaseDatesMillis": {}, "allPurchasedProductIdentifiers": [], "entitlements": {"active": {}, "all": {}, "verification": "NOT_REQUESTED"}, "firstSeen": "2024-02-01T21:58:59.000Z", "firstSeenMillis": 1706824739000, "latestExpirationDate": null, "latestExpirationDateMillis": null, "managementURL": null, "nonSubscriptionTransactions": [], "originalAppUserId": "68476cab-37c7-43b6-a7f0-cf39104ca76a", "originalApplicationVersion": null, "originalPurchaseDate": "2024-02-01T14:22:43.000Z", "originalPurchaseDateMillis": 1706797363000, "requestDate": "2024-02-05T19:29:27.402Z", "requestDateMillis": 1707161367402}

 LOG  starterPack.product_id  pack_romantic_essentials_1

 LOG  customerInfo?.entitlements?.active  {}

 

This shouldn’t be empty AFAIK. Anyone know why this isn’t working? product_ids are the same across platforms.

Here is the customer in the dashboard


 

 

Best answer by onlyhumn.nathan

The only way I can get this to work is if I use a sandbox account to make purchases… Maybe I missed it, but I had no idea this was a hard requirement.

View original
Did this post help you find an answer to your question?

4 replies

Forum|alt.badge.img+8
  • RevenueCat Staff
  • 509 replies
  • February 14, 2024

Hi, it looks like you are logging the same user in correctly. Can you let me know if your iOS app and Android app are inside the same RevenueCat project? And when you use our get subscriber API endpoint are you able to get the correct information about the user?

Additionally, can you try using invalidateCustomerInfoCache() before fetching the customerInfo() to make sure this isn’t an issue of somehow the customerInfo caching?


onlyhumn.nathan
Forum|alt.badge.img+2

Yep, they are
 


I added Purchases.invalidateCustomerInfoCache() before and after each call and no luck :(

It’s got to be something on the RevenueCat end :(


onlyhumn.nathan
Forum|alt.badge.img+2

The only way I can get this to work is if I use a sandbox account to make purchases… Maybe I missed it, but I had no idea this was a hard requirement.


Forum|alt.badge.img+8
  • RevenueCat Staff
  • 509 replies
  • March 6, 2024

Hi, one other way you can check this on Android is by using our  get subscriber API endpoint for cases like this.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings