Question

Google error when restoring purchase.

  • 18 April 2023
  • 8 replies
  • 215 views

Badge

If I call ‘restorePurchasesWith’ and there are no purchases to restore, I see an error out of the google billing wrapper: “Error acknowledging purchase. Will retry next queryPurchases. DebugMessage: Item is not owned by the user.. ErrorCode: ITEM_NOT_OWNED.” But this error does not bubble out of the wrapper up to the error handler provided to the ‘restorePurchasesWith’  call. How can I tell if restore fails in this manner.


8 replies

Userlevel 3
Badge +6

Hey @chris-86bdc1 ,

 

This is an error that is returned from Google themselves and is not a RevenueCat error. This happens when the requested action on the item failed since it is not owned by the user. In this case it is happening because we are requesting to restore the purchase of an item that the user doesn't own so it fail's returning this. 

 

More information about this error can be found here: https://developer.android.com/reference/com/android/billingclient/api/BillingClient.BillingResponseCode#ITEM_NOT_OWNED

Badge

Hey @Michael Fogel Yeah, I see that it’s a Google error. The problem is, the error is caught in the restore method and logged and then thrown away instead of being propagated out of the SDK. Because of this I have no way to tell if the restore call failed (or why it failed).  

Userlevel 3
Badge +6

Hey @chris-86bdc1 ,

 

In this instance, I am pretty sure that the restore would fail because their isn't a purchase for the restore to link to an ID. Are you able to get debug logs of this flow so you can see how the SDK responds to it? 

Badge

Hey @Michael Fogel Here’s some logs:

You can see the last line showing an error for ‘item not owned by user’ but the call to  ‘restorePurchasesWith’ returns with a success result, not an error.

2023-04-27 11:48:34.615 13324-13324 [Purchases] - DEBUG     com.wysrquotes.android               D  ℹ️ Restoring purchases
2023-04-27 11:48:34.616 13324-13324 [Purchases] - WARN com.wysrquotes.android 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
2023-04-27 11:48:34.784 13324-13324 rquotes.androi com.wysrquotes.android W Verification of void com.revenuecat.purchases.Purchases$restorePurchases$1$1.invoke(java.util.List) took 167.040ms (628.59 bytecodes/s) (3688B approximate peak alloc)
2023-04-27 11:48:34.923 13324-13324 rquotes.androi com.wysrquotes.android W Verification of void com.revenuecat.purchases.Purchases$restorePurchases$1$2.invoke(com.revenuecat.purchases.PurchasesError) took 138.745ms (144.15 bytecodes/s) (1920B approximate peak alloc)
2023-04-27 11:48:34.924 13324-13324 [Purchases] - DEBUG com.wysrquotes.android D ℹ️ Querying purchase history for type subs
2023-04-27 11:48:34.973 13324-13324 Choreographer com.wysrquotes.android I Skipped 37 frames! The application may be doing too much work on its main thread.
2023-04-27 11:48:35.169 13324-15043 [Purchases] - INFO com.wysrquotes.android I 😻💰 Purchase history retrieved skus: [wysr_subscription], purchaseTime: 1682542732788, purchaseToken: ecidnfeohdkoojdkgfolffif.AO-J1OzyCTvF3dfdipejsbtY2JwZ5GbxT_jPkJEvszXCgQ9CHIR6Bza7kgpE5Tsxwh9rm3pPaXC5yd86KEknT1nBWBv1SqDiQK_PzMxa1Nr6FhHX31t558Q
2023-04-27 11:48:35.170 13324-15043 [Purchases] - DEBUG com.wysrquotes.android D ℹ️ Querying purchase history for type inapp
2023-04-27 11:48:35.276 13324-15052 [Purchases] - DEBUG com.wysrquotes.android D ℹ️ Purchase history is empty.
2023-04-27 11:48:35.475 13324-15052 rquotes.androi com.wysrquotes.android W Verification of void com.revenuecat.purchases.Purchases$restorePurchases$1$1$2$1$1.invoke(java.util.Map) took 195.802ms (612.86 bytecodes/s) (3616B approximate peak alloc)
2023-04-27 11:48:35.478 13324-15052 [Purchases] - DEBUG com.wysrquotes.android D ℹ️ Found 0 unsynced attributes for App User ID: 03DgwSElpmP6elOXdgE7yqaAzdA2
2023-04-27 11:48:35.622 13324-15052 rquotes.androi com.wysrquotes.android W Verification of void com.revenuecat.purchases.Purchases$restorePurchases$1$1$2$1$1$1.invoke(com.revenuecat.purchases.CustomerInfo, org.json.JSONObject) took 143.584ms (800.92 bytecodes/s) (3624B approximate peak alloc)
2023-04-27 11:48:35.767 13324-15052 rquotes.androi com.wysrquotes.android W Verification of void com.revenuecat.purchases.Purchases$restorePurchases$1$1$2$1$1$2.invoke(com.revenuecat.purchases.PurchasesError, boolean, org.json.JSONObject) took 144.205ms (672.65 bytecodes/s) (3520B approximate peak alloc)
2023-04-27 11:48:36.554 13324-14176 [Purchases] - DEBUG com.wysrquotes.android D API request started: POST /receipts
2023-04-27 11:48:36.561 13324-14176 [Purchases] - DEBUG com.wysrquotes.android D API request completed with status: POST /receipts 200
2023-04-27 11:48:44.968 13324-14176 [Purchases] - DEBUG com.wysrquotes.android D 💰 Acknowledging purchase with token ecidnfeohdkoojdkgfolffif.AO-J1OzyCTvF3dfdipejsbtY2JwZ5GbxT_jPkJEvszXCgQ9CHIR6Bza7kgpE5Tsxwh9rm3pPaXC5yd86KEknT1nBWBv1SqDiQK_PzMxa1Nr6FhHX31t558Q
2023-04-27 11:48:44.980 13324-14176 [Purchases] - DEBUG com.wysrquotes.android D ℹ️ Purchase StoreTransaction(orderId=null, productIds=[wysr_subscription], type=SUBS, purchaseTime=1682542732788, purchaseToken=ecidnfeohdkoojdkgfolffif.AO-J1OzyCTvF3dfdipejsbtY2JwZ5GbxT_jPkJEvszXCgQ9CHIR6Bza7kgpE5Tsxwh9rm3pPaXC5yd86KEknT1nBWBv1SqDiQK_PzMxa1Nr6FhHX31t558Q, purchaseState=UNSPECIFIED_STATE, isAutoRenewing=null, signature=En0efxAMPx9Q3TY4LM2uuiB4/hNlRCvJesrqpc7B47ONhcMxA7NV+KOnD0HdQz3PKyQt6EvwfKiMov1afvsy61j9xDeFCYJe0XexwFU4PaFh0fVe4Lk2/n+O8HRGcLEh59d1JZIdu/srCyFtSYZLQ3PaoJon/3ztUrWTvZsM5Y3yprfB7iv2fYin7cccJiB/j9hcW3RwIDAURI/xH3M8jl22mKMlTOppbeVrj4jExV5NoSNoepLhhqtKiTmDVAu/q/H+ES1nfP83PggWQ426nnzE2GP/RrYDOD42vk6C/CK/N7TiVTNw6mzlWoQoWM1LOwl+84XrzWcAuAMz5oxEwQ==, originalJson={"productId":"wysr_subscription","purchaseToken":"ecidnfeohdkoojdkgfolffif.AO-J1OzyCTvF3dfdipejsbtY2JwZ5GbxT_jPkJEvszXCgQ9CHIR6Bza7kgpE5Tsxwh9rm3pPaXC5yd86KEknT1nBWBv1SqDiQK_PzMxa1Nr6FhHX31t558Q","purchaseTime":1682542732788,"quantity":1,"developerPayload":null}, presentedOfferingIdentifier=null, storeUserID=null, purchaseType=GOOGLE_RESTORED_PURCHASE, marketplace=null, subscriptionOptionId=null) restored
2023-04-27 11:48:45.204 13324-15207 [Purchases] - ERROR com.wysrquotes.android E 🤖‼️ Error acknowledging purchase. Will retry next queryPurchases. DebugMessage: Item is not owned by the user.. ErrorCode: ITEM_NOT_OWNED.

 

Userlevel 3
Badge +6

What transfer behavior are you using? 

Badge

We’re using ‘Keep with original App User ID’.

Userlevel 3
Badge +6

Hey there!

 

Can you open a support ticket with us? This seems to need some more information to solve this. 

Badge

Ok @Michael Fogel I just opened a ticket. There was no ref number or anything on the page after or in the email that I got back though. Thanks, -Chris

Reply