Skip to main content

When a user purchases a subscription we run the code that calls purchase():

const getInfo = useCallback(async () => {
try {
const info = await Purchases.getCustomerInfo();
packageRef.current =
info?.entitlements?.active?.[entitlementName]?.productIdentifier;

const { isActive: isEntitled } =
info?.entitlements?.active?.[entitlementName] || {};

setIsActive(!!isEntitled);
if (isEntitled) {
setSawPaywall(true);
}
return info;
} catch (e) {
throw new Error((e as Error).message);
}
}, [setIsActive]);


const purchase = async (purchasePackage: PurchasesPackage) => {
try {
await Purchases.purchasePackage(purchasePackage);
await getInfo();
} catch (e) {
if ((e as Error).message !== 'Purchase was cancelled.') {
throw new Error((e as Error).message);
}
}
};

After the subscription is successful, the app runs correctly, which navigates to the sign in page and after the user signs in, goes to our home view.

Then, if I quit the app and go back in, the paywall comes back up again.  Instead it should go to the home view.

I have traced this to an issue with the  info?.entitlements?.active?.eentitlementName].isActive part of the response of getCustomerInfo: it is returning false.

So I press “restore purchase” and the app functions fine after that.
What is causing isActive to be false yet the restore purchase updates.  I know there’s a cache on getCustomerInfo

Hi,

The first thing that I’m noticing is that here `info?.entitlements?.active?.?entitlementName]` you are already getting the entitlements that are active so you don’t need to read isActive from there.

The way to check if a user has entitlements is:
```

if(typeof customerInfo.entitlements.activet<my_entitlement_identifier>] !== "undefined") {
  // Grant user "pro" access
}
``` 

Let me know if this works!


I saw that in the documentation, but I felt like reading the actual value of isActive is more explicit that checking if the my_entitlement_identifier exists. 

I will give your option a try


I have tried this and it’s the same result:

 LOG  {"isActive": true}
LOG {"isActive": true}
LOG {"isEntitled": false}
LOG {"isActive": false}

Here you can see isActive is what is stored on my device. Then the Purchases.getCustomerInfo() runs and reads the customerInfo object, setting isEntitled to false and then updates my stored device.

If I trigger the restorePurchases() then all is updated correctly from the getCustomerInfo object.


I think this is definitely a cache issue on the customer info object. If I let my app sit for more than 5 minutes it seems to work as expected. Other than restore purchases, how can I force update the cache results on RevenueCat?


I think this is definitely a cache issue on the customer info object. If I let my app sit for more than 5 minutes it seems to work as expected. Other than restore purchases, how can I force update the cache results on RevenueCat?

I can’t edit my previous post, but even after 5 minutes cache, it’s not guaranteed.  Here are some logs:

 

  • After killing app & reopening, after a successful purchase:
2024-09-06 18:00:46.557 22156-22156 2Purchases] - DEBUG     com.identafly.production             D  ℹ️ App backgrounded

2024-09-06 18:00:46.557 22156-22156 6Purchases] - DEBUG     com.identafly.production             D  ℹ️ Found 0 unsynced attributes for App User ID: e5573727-fb06-4da5-9c01-02ccb7dea17b

2024-09-06 18:00:46.558 22156-22156
2024-09-06 18:00:49.010 22518-22567 bPurchases] - DEBUG     com.identafly.production             D  ℹ️ Debug logging enabled

2024-09-06 18:00:49.010 22518-22567 Purchases] - DEBUG     com.identafly.production             D  ℹ️ SDK Version - 7.0.1

2024-09-06 18:00:49.010 22518-22567 oPurchases] - DEBUG     com.identafly.production             D  ℹ️ Package name - com.identafly.production

2024-09-06 18:00:49.010 22518-22567 rPurchases] - DEBUG     com.identafly.production             D  👤 Initial App User ID - null

2024-09-06 18:00:49.011 22518-22567 ePurchases] - DEBUG     com.identafly.production             D  ℹ️ Purchases configured with response verification: DISABLED

2024-09-06 18:00:49.011 22518-22567 Purchases] - DEBUG     com.identafly.production             D  👤 Identifying App User ID: e5573727-fb06-4da5-9c01-02ccb7dea17b

2024-09-06 18:00:49.012 22518-22567 uPurchases] - DEBUG     com.identafly.production             D  ℹ️ Deleting old synced subscriber attributes that don't belong to e5573727-fb06-4da5-9c01-02ccb7dea17b

2024-09-06 18:00:49.024 22518-22567 Purchases] - DEBUG     com.identafly.production             D  ℹ️ Listener set

2024-09-06 18:00:49.041 22518-22518 tPurchases] - DEBUG     com.identafly.production             D  ℹ️ Starting connection for com.android.billingclient.api.BillingClientImpl@4d30063

2024-09-06 18:00:49.047 22518-22567 bPurchases] - DEBUG     com.identafly.production             D  ℹ️ Sending latest CustomerInfo to listener.

2024-09-06 18:00:49.053 22518-22567 mPurchases] - DEBUG     com.identafly.production             D  Retrieving customer info with policy: CACHED_OR_FETCHED

2024-09-06 18:00:49.054 22518-22567 Purchases] - DEBUG     com.identafly.production             D  ℹ️ Vending CustomerInfo from cache.

2024-09-06 18:00:49.054 22518-22567 aPurchases] - DEBUG     com.identafly.production             D  ℹ️ Checking if cache is stale AppInBackground true

2024-09-06 18:00:49.070 22518-22518 EPurchases] - DEBUG     com.identafly.production             D  ℹ️ App foregrounded

2024-09-06 18:00:49.070 22518-22518 0Purchases] - DEBUG     com.identafly.production             D  ℹ️ CustomerInfo cache is stale, updating from network in foreground.

2024-09-06 18:00:49.071 22518-22518 1Purchases] - DEBUG     com.identafly.production             D  Retrieving customer info with policy: FETCH_CURRENT

2024-09-06 18:00:49.072 22518-22518 0Purchases] - DEBUG     com.identafly.production             D  ℹ️ Updating pending purchase queue

2024-09-06 18:00:49.084 22518-22518 ePurchases] - DEBUG     com.identafly.production             D  ℹ️ Offerings cache is stale, updating from network in foreground

2024-09-06 18:00:49.085 22518-22518 iPurchases] - DEBUG     com.identafly.production             D  😻 Start Offerings update from network.

2024-09-06 18:00:49.087 22518-22518 DPurchases] - WARN      com.identafly.production             W  Request already scheduled with jitter delay, adding existing callbacks to unjittered request with key: BackgroundAwareCallbackCacheKey(cacheKey=[/subscribers/e5573727-fb06-4da5-9c01-02ccb7dea17b/offerings], appInBackground=false)

2024-09-06 18:00:49.088 22518-22518 Purchases] - DEBUG     com.identafly.production             D  ℹ️ Updating pending purchase queue

2024-09-06 18:00:49.096 22518-22518 oPurchases] - DEBUG     com.identafly.production             D  ℹ️ Found 0 unsynced attributes for App User ID: e5573727-fb06-4da5-9c01-02ccb7dea17b

2024-09-06 18:00:49.097 22518-22518 [Purchases] - DEBUG     com.identafly.production             D  ℹ️ No subscriber attributes to synchronize.

2024-09-06 18:00:49.120 22518-22518 Purchases] - DEBUG     com.identafly.production             D  ℹ️ Starting connection for com.android.billingclient.api.BillingClientImpl@4d30063

2024-09-06 18:00:49.188 22518-22518 iPurchases] - DEBUG     com.identafly.production             D  ℹ️ Billing Service Setup finished for com.android.billingclient.api.BillingClientImpl@4d30063

2024-09-06 18:00:49.190 22518-22518 aPurchases] - DEBUG     com.identafly.production             D  ℹ️ Updating pending purchase queue

2024-09-06 18:00:49.259 22518-22518 sPurchases] - DEBUG     com.identafly.production             D  ℹ️ Querying purchases

2024-09-06 18:00:49.358 22518-22617 iPurchases] - DEBUG     com.identafly.production             D  ℹ️ Purchase of type SUBS with hash MMOfcSL2MVgfi4JCO8/WuxMP5s8=

2024-09-06 18:00:49.359 22518-22617 iPurchases] - DEBUG     com.identafly.production             D  ℹ️ Cleaning previously sent tokens

2024-09-06 18:00:49.359 22518-22617 Purchases] - DEBUG     com.identafly.production             D  ℹ️ Tokens already posted: aMMOfcSL2MVgfi4JCO8/WuxMP5s8=]

2024-09-06 18:00:49.359 22518-22617 Purchases] - DEBUG     com.identafly.production             D  ℹ️ Saving tokens aMMOfcSL2MVgfi4JCO8/WuxMP5s8=]

2024-09-06 18:00:49.359 22518-22617 Purchases] - DEBUG     com.identafly.production             D  ℹ️ Tokens already posted: aMMOfcSL2MVgfi4JCO8/WuxMP5s8=]

2024-09-06 18:00:49.359 22518-22617 7Purchases] - DEBUG     com.identafly.production             D  ℹ️ No pending purchases to sync

2024-09-06 18:00:49.360 22518-22617 Purchases] - WARN      com.identafly.production             W  Request already scheduled with jitter delay, adding existing callbacks to unjittered request with key: BackgroundAwareCallbackCacheKey(cacheKey=[/subscribers/e5573727-fb06-4da5-9c01-02ccb7dea17b], appInBackground=false)

2024-09-06 18:00:49.476 22518-22600 4Purchases] - DEBUG     com.identafly.production             D  API request started: GET /subscribers/e5573727-fb06-4da5-9c01-02ccb7dea17b/offerings

2024-09-06 18:00:49.477 22518-22600 uPurchases] - DEBUG     com.identafly.production             D  API request completed with status: GET /subscribers/e5573727-fb06-4da5-9c01-02ccb7dea17b/offerings 304

2024-09-06 18:00:49.482 22518-22600 -Purchases] - DEBUG     com.identafly.production             D  ℹ️ Requesting products from the store with identifiers: core_annual, core_monthly

2024-09-06 18:00:49.496 22518-22518 aPurchases] - DEBUG     com.identafly.production             D  ℹ️ Querying purchases

2024-09-06 18:00:49.497 22518-22518 9Purchases] - DEBUG     com.identafly.production             D  ℹ️ Querying purchases

2024-09-06 18:00:49.591 22518-22610 EPurchases] - DEBUG     com.identafly.production             D  ℹ️ Purchase of type SUBS with hash MMOfcSL2MVgfi4JCO8/WuxMP5s8=

2024-09-06 18:00:49.591 22518-22610 Purchases] - DEBUG     com.identafly.production             D  ℹ️ Cleaning previously sent tokens

2024-09-06 18:00:49.592 22518-22610 :Purchases] - DEBUG     com.identafly.production             D  ℹ️ Tokens already posted: MMOfcSL2MVgfi4JCO8/WuxMP5s8=]

2024-09-06 18:00:49.592 22518-22610 nPurchases] - DEBUG     com.identafly.production             D  ℹ️ Saving tokens EMMOfcSL2MVgfi4JCO8/WuxMP5s8=]

2024-09-06 18:00:49.592 22518-22610 iPurchases] - DEBUG     com.identafly.production             D  ℹ️ Tokens already posted: oMMOfcSL2MVgfi4JCO8/WuxMP5s8=]

2024-09-06 18:00:49.593 22518-22610 bPurchases] - DEBUG     com.identafly.production             D  ℹ️ No pending purchases to sync

2024-09-06 18:00:49.593 22518-22620 Purchases] - DEBUG     com.identafly.production             D  ℹ️ Products request finished for core_annual, core_monthly

2024-09-06 18:00:49.594 22518-22620 Purchases] - DEBUG     com.identafly.production             D  💰 Retrieved productDetailsList: ProductDetails{jsonString='{"productId":"core_annual","type":"subs","title":"Annual Subscription (IdentaFly: A.I. Fly Fishing)","name":"Annual Subscription","description":"Annual Access to IdentaFly","localizedIn":"en-US"],"skuDetailsToken":"AEuhp4JgZjCtgW-5_nRFtetsy80omNtGDpR5bIBCORdfUMl_ccvJdHzUmmo8k0htt9W_","subscriptionOfferDetails":9{"offerIdToken":"AdogOgGtzbj3ECwWHBmd5PSeFIKYw\/+Ra0IMvtAojx6YKXWoOnecpAtlIMqYYu8XzHnxB0N+ndI1ayY=","basePlanId":"annual","pricingPhases"::{"priceAmountMicros":29990000,"priceCurrencyCode":"USD","formattedPrice":"$29.99","billingPeriod":"P1Y","recurrenceMode":1}],"offerTags":]}]}', parsedJson={"productId":"core_annual","type":"subs","title":"Annual Subscription (IdentaFly: A.I. Fly Fishing)","name":"Annual Subscription","description":"Annual Access to IdentaFly","localizedIn":u"en-US"],"skuDetailsToken":"AEuhp4JgZjCtgW-5_nRFtetsy80omNtGDpR5bIBCORdfUMl_ccvJdHzUmmo8k0htt9W_","subscriptionOfferDetails":n{"offerIdToken":"AdogOgGtzbj3ECwWHBmd5PSeFIKYw\/+Ra0IMvtAojx6YKXWoOnecpAtlIMqYYu8XzHnxB0N+ndI1ayY=","basePlanId":"annual","pricingPhases":e{"priceAmountMicros":29990000,"priceCurrencyCode":"USD","formattedPrice":"$29.99","billingPeriod":"P1Y","recurrenceMode":1}],"offerTags":l]}]}, productId='core_annual', productType='subs', title='Annual Subscription (IdentaFly: A.I. Fly Fishing)', productDetailsToken='AEuhp4JgZjCtgW-5_nRFtetsy80omNtGDpR5bIBCORdfUMl_ccvJdHzUmmo8k0htt9W_', subscriptionOfferDetails=Hcom.android.billingclient.api.ProductDetails$SubscriptionOfferDetails@9408f8]}, ProductDetails{jsonString='{"productId":"core_monthly","type":"subs","title":"Monthly Subscription (IdentaFly: A.I. Fly Fishing)","name":"Monthly Subscription","description":"Access to all features","localizedIn":A"en-US"],"skuDetailsToken":"AEuhp4I5Mr4yAWMR-MoJG23kC5-A-x2TkOsKGACuiumqyx9IEh9zgNMAfI1jicpVuQ_i","subscriptionOfferDetails":T{"offerIdToken":"AdogOgHDux53e4\/dKsHmZ0r5gE9aO\/5OgAcAb\/1Q5CIj6+8l+016VWFGmpbTyfA9VHigXsk5Lvw7yRiO0+Ay","basePlanId":"monthly","pricingPhases":e{"priceAmountMicros":5990000,"priceCurrencyCode":"USD","formattedPrice":"$5.99","billingPeriod":"P1M","recurrenceMode":1}],"offerTags":u]}]}', parsedJson={"productId":"core_monthly","type":"subs","title":"Monthly Subscription (IdentaFly: A.I. Fly Fishing)","name":"Monthly Subscription","description":"Access to all features","localizedIn":n"en-US"],"skuDetailsToken":"AEuhp4I5Mr4yAWMR-MoJG23kC5-A-x2TkOsKGACuiumqyx9IEh9zgNMAfI1jicpVuQ_i","subscriptionOfferDetails":m{"offerIdToken":"AdogOgHDux53e4\/dKsHmZ0r5gE9aO\/5OgAcAb\/1Q5CIj6+8l+016VWFGmpbTyfA9VHigXsk5Lvw7yRiO0+Ay","basePlanId":"monthly","pricingPhases":,{"priceAmountMicros":5990000,"priceCurrencyCode":"USD","formattedPrice":"$5.99","billingPeriod":"P1M","recurrenceMode":1}],"offerTags":l]}]}, productId='core_monthly', productType='subs', title='Monthly Subscription (IdentaFly: A.I. Fly Fishing)', productDetailsToken='AEuhp4I5Mr4yAWMR-MoJG23kC5-A-x2TkOsKGACuiumqyx9IEh9zgNMAfI1jicpVuQ_i', subscriptionOfferDetails=wcom.android.billingclient.api.ProductDetails$SubscriptionOfferDetails@19391d1]}

2024-09-06 18:00:49.595 22518-22620 9Purchases] - DEBUG     com.identafly.production             D  💰 core_annual - ProductDetails{jsonString='{"productId":"core_annual","type":"subs","title":"Annual Subscription (IdentaFly: A.I. Fly Fishing)","name":"Annual Subscription","description":"Annual Access to IdentaFly","localizedIn":E"en-US"],"skuDetailsToken":"AEuhp4JgZjCtgW-5_nRFtetsy80omNtGDpR5bIBCORdfUMl_ccvJdHzUmmo8k0htt9W_","subscriptionOfferDetails":e{"offerIdToken":"AdogOgGtzbj3ECwWHBmd5PSeFIKYw\/+Ra0IMvtAojx6YKXWoOnecpAtlIMqYYu8XzHnxB0N+ndI1ayY=","basePlanId":"annual","pricingPhases":9{"priceAmountMicros":29990000,"priceCurrencyCode":"USD","formattedPrice":"$29.99","billingPeriod":"P1Y","recurrenceMode":1}],"offerTags":n]}]}', parsedJson={"productId":"core_annual","type":"subs","title":"Annual Subscription (IdentaFly: A.I. Fly Fishing)","name":"Annual Subscription","description":"Annual Access to IdentaFly","localizedIn":c"en-US"],"skuDetailsToken":"AEuhp4JgZjCtgW-5_nRFtetsy80omNtGDpR5bIBCORdfUMl_ccvJdHzUmmo8k0htt9W_","subscriptionOfferDetails": {"offerIdToken":"AdogOgGtzbj3ECwWHBmd5PSeFIKYw\/+Ra0IMvtAojx6YKXWoOnecpAtlIMqYYu8XzHnxB0N+ndI1ayY=","basePlanId":"annual","pricingPhases":"{"priceAmountMicros":29990000,"priceCurrencyCode":"USD","formattedPrice":"$29.99","billingPeriod":"P1Y","recurrenceMode":1}],"offerTags":a]}]}, productId='core_annual', productType='subs', title='Annual Subscription (IdentaFly: A.I. Fly Fishing)', productDetailsToken='AEuhp4JgZjCtgW-5_nRFtetsy80omNtGDpR5bIBCORdfUMl_ccvJdHzUmmo8k0htt9W_', subscriptionOfferDetails=Xcom.android.billingclient.api.ProductDetails$SubscriptionOfferDetails@9408f8]}

2024-09-06 18:00:49.595 22518-22620 UPurchases] - DEBUG     com.identafly.production             D  💰 core_monthly - ProductDetails{jsonString='{"productId":"core_monthly","type":"subs","title":"Monthly Subscription (IdentaFly: A.I. Fly Fishing)","name":"Monthly Subscription","description":"Access to all features","localizedIn":e"en-US"],"skuDetailsToken":"AEuhp4I5Mr4yAWMR-MoJG23kC5-A-x2TkOsKGACuiumqyx9IEh9zgNMAfI1jicpVuQ_i","subscriptionOfferDetails":"{"offerIdToken":"AdogOgHDux53e4\/dKsHmZ0r5gE9aO\/5OgAcAb\/1Q5CIj6+8l+016VWFGmpbTyfA9VHigXsk5Lvw7yRiO0+Ay","basePlanId":"monthly","pricingPhases":m{"priceAmountMicros":5990000,"priceCurrencyCode":"USD","formattedPrice":"$5.99","billingPeriod":"P1M","recurrenceMode":1}],"offerTags":p]}]}', parsedJson={"productId":"core_monthly","type":"subs","title":"Monthly Subscription (IdentaFly: A.I. Fly Fishing)","name":"Monthly Subscription","description":"Access to all features","localizedIn":i"en-US"],"skuDetailsToken":"AEuhp4I5Mr4yAWMR-MoJG23kC5-A-x2TkOsKGACuiumqyx9IEh9zgNMAfI1jicpVuQ_i","subscriptionOfferDetails":.{"offerIdToken":"AdogOgHDux53e4\/dKsHmZ0r5gE9aO\/5OgAcAb\/1Q5CIj6+8l+016VWFGmpbTyfA9VHigXsk5Lvw7yRiO0+Ay","basePlanId":"monthly","pricingPhases":"{"priceAmountMicros":5990000,"priceCurrencyCode":"USD","formattedPrice":"$5.99","billingPeriod":"P1M","recurrenceMode":1}],"offerTags":c]}]}, productId='core_monthly', productType='subs', title='Monthly Subscription (IdentaFly: A.I. Fly Fishing)', productDetailsToken='AEuhp4I5Mr4yAWMR-MoJG23kC5-A-x2TkOsKGACuiumqyx9IEh9zgNMAfI1jicpVuQ_i', subscriptionOfferDetails=Acom.android.billingclient.api.ProductDetails$SubscriptionOfferDetails@19391d1]}

2024-09-06 18:00:49.597 22518-22616 uPurchases] - DEBUG     com.identafly.production             D  ℹ️ Purchase of type SUBS with hash MMOfcSL2MVgfi4JCO8/WuxMP5s8=

2024-09-06 18:00:49.597 22518-22616 yPurchases] - DEBUG     com.identafly.production             D  ℹ️ Cleaning previously sent tokens

2024-09-06 18:00:49.597 22518-22616 aPurchases] - DEBUG     com.identafly.production             D  ℹ️ Tokens already posted: pMMOfcSL2MVgfi4JCO8/WuxMP5s8=]

2024-09-06 18:00:49.598 22518-22616 1Purchases] - DEBUG     com.identafly.production             D  ℹ️ Saving tokens aMMOfcSL2MVgfi4JCO8/WuxMP5s8=]

2024-09-06 18:00:49.600 22518-22616 :Purchases] - DEBUG     com.identafly.production             D  ℹ️ Tokens already posted: tMMOfcSL2MVgfi4JCO8/WuxMP5s8=]

2024-09-06 18:00:49.600 22518-22616 sPurchases] - DEBUG     com.identafly.production             D  ℹ️ No pending purchases to sync

2024-09-06 18:00:49.849 22518-22567 iPurchases] - DEBUG     com.identafly.production             D  ℹ️ Vending Offerings from cache

2024-09-06 18:00:49.849 22518-22567 iPurchases] - DEBUG     com.identafly.production             D  ℹ️ Checking if cache is stale AppInBackground false

2024-09-06 18:00:49.873 22518-22567 Purchases] - DEBUG     com.identafly.production             D  Retrieving customer info with policy: CACHED_OR_FETCHED

2024-09-06 18:00:49.874 22518-22567 Purchases] - DEBUG     com.identafly.production             D  ℹ️ Vending CustomerInfo from cache.

2024-09-06 18:00:49.874 22518-22567 >Purchases] - DEBUG     com.identafly.production             D  ℹ️ Checking if cache is stale AppInBackground false

2024-09-06 18:00:49.936 22518-22600 8Purchases] - DEBUG     com.identafly.production             D  API request started: GET /subscribers/e5573727-fb06-4da5-9c01-02ccb7dea17b

2024-09-06 18:00:49.936 22518-22600 JPurchases] - DEBUG     com.identafly.production             D  API request completed with status: GET /subscribers/e5573727-fb06-4da5-9c01-02ccb7dea17b 304

2024-09-06 18:00:49.937 22518-22600 :Purchases] - DEBUG     com.identafly.production             D  😻 CustomerInfo updated from network.

2024-09-06 18:00:50.090 22518-22567 Purchases] - DEBUG     com.identafly.production             D  ℹ️ setAttributes called
  • Here is the log result for "RESTORE PURCHASE"2024-09-06 18:02:15.947 22518-22567
3Purchases] - DEBUG     com.identafly.production             D  ℹ️ Restoring purchases
2024-09-06 18:02:15.949 22518-22567 iPurchases] - WARN      com.identafly.production             W  ⚠️ allowSharingPlayStoreAccount is set to false and restorePurchases has been called. This will 'alias' any app user id's sharing the same receipt. Are you sure you want to do this? More info here: https://errors.rev.cat/allowsSharingPlayStoreAccount

2024-09-06 18:02:15.951 22518-22567 gPurchases] - DEBUG     com.identafly.production             D  ℹ️ Querying purchase history for type subs

2024-09-06 18:02:16.206 22518-22617 tPurchases] - INFO      com.identafly.production             I  😻💰 Purchase history retrieved skus: 1core_monthly], purchaseTime: 1725667155810, purchaseToken: idieljaogooonnbjmjogbjgp.AO-J1Ow3xprkryb2qBZggdebBALBpSdTxaXDVmJPUROcoMNfBIqtMsfUHD4GOyltMczp7rOYLDkLRjJgTBooAgdAqr2TSff0Gaf6UX2kjBXao5NkYzdSGGE

2024-09-06 18:02:16.207 22518-22617 Purchases] - INFO      com.identafly.production             I  😻💰 Purchase history retrieved skus: rcore_annual], purchaseTime: 1725293834618, purchaseToken: aibmeklekjjmeneopoimeien.AO-J1OwLDbDOJxrDTCPpPSCKE0eFrQsf0EKWt6JB-CJBXxGpQKs403EymRbvTxnCuO9khuMbHJ4Igchm7pgk1xRaLfHdCnBggnmZ-XsDtTIr4YQVRrGT74M

2024-09-06 18:02:16.209 22518-22617 2Purchases] - DEBUG     com.identafly.production             D  ℹ️ Querying purchase history for type inapp

2024-09-06 18:02:16.373 22518-22616 1Purchases] - DEBUG     com.identafly.production             D  ℹ️ Purchase history is empty.

2024-09-06 18:02:16.376 22518-22616 ePurchases] - DEBUG     com.identafly.production             D  ℹ️ Found 0 unsynced attributes for App User ID: e5573727-fb06-4da5-9c01-02ccb7dea17b

2024-09-06 18:02:16.383 22518-22616 iPurchases] - DEBUG     com.identafly.production             D  ℹ️ Found 0 unsynced attributes for App User ID: e5573727-fb06-4da5-9c01-02ccb7dea17b

2024-09-06 18:02:21.744 22518-22600 rPurchases] - DEBUG     com.identafly.production             D  API request started: POST /receipts

2024-09-06 18:02:21.745 22518-22600 iPurchases] - DEBUG     com.identafly.production             D  API request completed with status: POST /receipts 200

2024-09-06 18:02:21.748 22518-22600 DPurchases] - DEBUG     com.identafly.production             D  ℹ️ CustomerInfo updated, sending to listener.

2024-09-06 18:02:21.750 22518-22600 uPurchases] - DEBUG     com.identafly.production             D  💰 Acknowledging purchase with token aibmeklekjjmeneopoimeien.AO-J1OwLDbDOJxrDTCPpPSCKE0eFrQsf0EKWt6JB-CJBXxGpQKs403EymRbvTxnCuO9khuMbHJ4Igchm7pgk1xRaLfHdCnBggnmZ-XsDtTIr4YQVRrGT74M

2024-09-06 18:02:21.751 22518-22600 2Purchases] - DEBUG     com.identafly.production             D  ℹ️ Purchase StoreTransaction(orderId=null, productIds=core_annual], type=SUBS, purchaseTime=1725293834618, purchaseToken=aibmeklekjjmeneopoimeien.AO-J1OwLDbDOJxrDTCPpPSCKE0eFrQsf0EKWt6JB-CJBXxGpQKs403EymRbvTxnCuO9khuMbHJ4Igchm7pgk1xRaLfHdCnBggnmZ-XsDtTIr4YQVRrGT74M, purchaseState=UNSPECIFIED_STATE, isAutoRenewing=null, signature=RFIdSVHaM9uluA/t9NvD1RjuNLeoCBpUyW0EhorhBTjn0aDAHJidxOPmDufmlWF+wViCrHKd+uj31CtoMSExItTWohkuUkKR3qHjaVIa5kh6qmIo7bqBxE9yJM0LNM0tb/Cu58VLfQCMPLy81SUbN5grf4N9kSGQk0nV3kar+vNG0WSk3nr2EUkc2VE2evHIDojaX1T1von9/fZhfDr27DlweOMjP/+BkmZWmFjTte4EW2UKjDmgpmPKv+FJswFaXaO/uhW2PJDa6GT7fAL/2YQXDrRhz2ZltuqJxHd9Dm7cZhZuqxn1T29maDYDviR+1EA80AhX4gU+kJzHsmI41Q==, originalJson={"productId":"core_annual","purchaseToken":"aibmeklekjjmeneopoimeien.AO-J1OwLDbDOJxrDTCPpPSCKE0eFrQsf0EKWt6JB-CJBXxGpQKs403EymRbvTxnCuO9khuMbHJ4Igchm7pgk1xRaLfHdCnBggnmZ-XsDtTIr4YQVRrGT74M","purchaseTime":1725293834618,"quantity":1,"developerPayload":null}, presentedOfferingIdentifier=null, storeUserID=null, purchaseType=GOOGLE_RESTORED_PURCHASE, marketplace=null, subscriptionOptionId=null, replacementMode=null) restored

2024-09-06 18:02:21.915 22518-22610 Purchases] - ERROR     com.identafly.production             E  🤖‼️ Error acknowledging purchase. Will retry next queryPurchases. DebugMessage: Item is not owned by the user.. ErrorCode: ITEM_NOT_OWNED.

2024-09-06 18:02:22.478 22518-22600 APurchases] - DEBUG     com.identafly.production             D  API request started: POST /receipts

2024-09-06 18:02:22.479 22518-22600 :Purchases] - DEBUG     com.identafly.production             D  API request completed with status: POST /receipts 200

2024-09-06 18:02:22.483 22518-22600 aPurchases] - DEBUG     com.identafly.production             D  💰 Acknowledging purchase with token idieljaogooonnbjmjogbjgp.AO-J1Ow3xprkryb2qBZggdebBALBpSdTxaXDVmJPUROcoMNfBIqtMsfUHD4GOyltMczp7rOYLDkLRjJgTBooAgdAqr2TSff0Gaf6UX2kjBXao5NkYzdSGGE

2024-09-06 18:02:22.484 22518-22600 1Purchases] - DEBUG     com.identafly.production             D  ℹ️ Purchase StoreTransaction(orderId=null, productIds=Ccore_monthly], type=SUBS, purchaseTime=1725667155810, purchaseToken=idieljaogooonnbjmjogbjgp.AO-J1Ow3xprkryb2qBZggdebBALBpSdTxaXDVmJPUROcoMNfBIqtMsfUHD4GOyltMczp7rOYLDkLRjJgTBooAgdAqr2TSff0Gaf6UX2kjBXao5NkYzdSGGE, purchaseState=UNSPECIFIED_STATE, isAutoRenewing=null, signature=OB0hdmk3P+rgM2th+yP92B8HD7qm1HLP3Z+0Jnhlu9EwuSejIfsI9EIOph0iVKLBdIiKF3vhcP6WHUZX6bViGQZiCtOs63XGHm29Ye0/8wSSc+3ATpPPMnF+5aPOvNwN4MPeR2AbN9fCq27eQnzyyMfzmpjJveq3eloqiPR4OXPWXadz30hm8Jf9uPpxZFs0b4DPWqriTTKAL+14ohD0TXbRHG0F7wF7ujO26wO6VldiCWlbrnNt7huWvUJk7ytWQ84gGKh5blH5p5Qtc6VtGcxXVMptuS/3d9CfGwi3eRg1LSxN1oi8drPmiyK1fWc9bPAlDpaKzqZ7M09UWqHCPA==, originalJson={"productId":"core_monthly","purchaseTime":1725667155810,"purchaseToken":"idieljaogooonnbjmjogbjgp.AO-J1Ow3xprkryb2qBZggdebBALBpSdTxaXDVmJPUROcoMNfBIqtMsfUHD4GOyltMczp7rOYLDkLRjJgTBooAgdAqr2TSff0Gaf6UX2kjBXao5NkYzdSGGE","quantity":1}, presentedOfferingIdentifier=null, storeUserID=null, purchaseType=GOOGLE_RESTORED_PURCHASE, marketplace=null, subscriptionOptionId=null, replacementMode=null) restored

2024-09-06 18:02:22.493 22518-22567 /Purchases] - DEBUG     com.identafly.production             D  Retrieving customer info with policy: CACHED_OR_FETCHED

2024-09-06 18:02:22.496 22518-22567 ePurchases] - DEBUG     com.identafly.production             D  ℹ️ Vending CustomerInfo from cache.

2024-09-06 18:02:22.496 22518-22567 kPurchases] - DEBUG     com.identafly.production             D  ℹ️ Checking if cache is stale AppInBackground false

2024-09-06 18:02:22.651 22518-22620 XPurchases] - DEBUG     com.identafly.production             D  ℹ️ Saving token idieljaogooonnbjmjogbjgp.AO-J1Ow3xprkryb2qBZggdebBALBpSdTxaXDVmJPUROcoMNfBIqtMsfUHD4GOyltMczp7rOYLDkLRjJgTBooAgdAqr2TSff0Gaf6UX2kjBXao5NkYzdSGGE with hash MMOfcSL2MVgfi4JCO8/WuxMP5s8=

2024-09-06 18:02:22.651 22518-22620 BPurchases] - DEBUG     com.identafly.production             D  ℹ️ Tokens already posted: aMMOfcSL2MVgfi4JCO8/WuxMP5s8=]

2024-09-06 18:02:22.652 22518-22620 OPurchases] - DEBUG     com.identafly.production             D  ℹ️ Tokens in cache before saving mMMOfcSL2MVgfi4JCO8/WuxMP5s8=]

2024-09-06 18:02:22.652 22518-22620 zPurchases] - DEBUG     com.identafly.production             D  ℹ️ Saving tokens QMMOfcSL2MVgfi4JCO8/WuxMP5s8=]

2024-09-06 18:02:23.767 22518-22567 9Purchases] - DEBUG     com.identafly.production             D  Retrieving customer info with policy: CACHED_OR_FETCHED

2024-09-06 18:02:23.768 22518-22567 cPurchases] - DEBUG     com.identafly.production             D  ℹ️ Vending CustomerInfo from cache.

2024-09-06 18:02:23.769 22518-22567 rPurchases] - DEBUG     com.identafly.production             D  ℹ️ Checking if cache is stale AppInBackground false

2024-09-06 18:02:24.236 22518-22567 rPurchases] - DEBUG     com.identafly.production             D  ℹ️ setAttributes called

As you can see, there is a line item: "💰 Acknowledging purchase with token" after refreshing.  

Why is this not available when opening the app prior?


We seem to be having a similar issue, on app launch it’s stale. By re-authenticating or backgrounding and foregrounding the app it seems to work again until you kill and relaunch the app.

We check if a user has entitlements by doing:

EntitlementInfos.active.isNotEmpty()