Solved

Error when purchasing non-subscription and refunding

  • 17 November 2021
  • 5 replies
  • 907 views

Badge +2

I'm testing in a sandbox environment using Flutter (Android).
I purchased a non-subscription and then refunded it.

Then, when I perform a restore, an error handling with the following content is returned:

Code

Purchases.restoreTransactions();

Log

I/flutter (12532): PlatformException(16, There was an unknown backend error., {code: 16, message: There was an unknown backend error., readableErrorCode: UnknownBackendError, readable_error_code: UnknownBackendError, underlyingErrorMessage: Backend Code: 7651 - The payment for this non-subscription product is not complete.}, null)

W/BillingClient(12532): Error consuming purchase with token. Response code: 8

E/[Purchases] - ERROR(12532): 🤖‼️ Error consuming purchase. Will retry next queryPurchases. DebugMessage: Item is not owned by the user.. ErrorCode: ITEM_NOT_OWNED.

I know this error is on Google's side, but is there anything I can do on RevenueCat's side or my code implementation? Is there a way to resolve the error?

 

icon

Best answer by Maddie 4 January 2022, 22:58

View original

5 replies

Badge +2

I share new findings!
I don't think there is any action within the current RevenueCat to consume the refunded product after the refund.
Is there a way to consume the refunded product within RevenueCat?
If not, are there any plans to provide this implementation?
I think it only affects Android.

I'm sorry if this proposal is off the mark for the original issue.

 

- reference:

https://stackoverflow.com/questions/49166270/android-in-app-billing-refunded-in-app-purchases-not-cancelled

 

-Development Environments:

purchases_flutter: ^3.6.0
Flutter (Channel stable, 2.5.3)

Device - Android 9

Badge +2

I share new findings.
As already mentioned, this error occurs after a refund has been made.
However, the restores made after repurchasing same or another product during this error worked fine.
I feel that this issue only occurs immediately after the refund.
And it's not an error that disappears over time. It keeps happening every time I make a restore until I make another purchase.

I hope this helps solve this problem.
Since it is a translation, I apologize if it is difficult to understand.

Thank you!

Userlevel 3
Badge +3

HI @Shichi thanks for providing all these details! I believe I understand everything :) 

The code is actually working as expected in this case, and you don’t need to worry about the error. I do think there are some improvements we can make to provide clearer information and/or not error, though. I agree that seeing those error logs leads to a confusing experience.

For more info on what’s happening with the restore:
Google will continue reporting the refunded purchase in queryPurchaseHistoryAsync, so we don't have a way to know to NOT try to restore the purchase (There's an open issue with Google about thi.). Then, when trying to restore, it fails, because... it's been refunded. Google doesn't provide a very descriptive error, so we can't tell why the restore failed. 

As for consumption:
We actually do consume the purchase when calling queryPurchaseHistoryAsync. There isn’t a good way for us to know NOT to consume it once it’s been refunded, so we will keep trying. That’s where the consumption error comes from. This isn’t really an issue, because trying to consume it again doesn’t have any effect apart from returning an error.

 

However, since functionality isn't technically broken, we probably shouldn't error here (and then you can still get a PurchaserInfo object returned in the callback). I've created a ticket for us to improve this experience. In the meantime, you could call for a new PurchaserInfo object in the case that restore fails, and you should be able to get one. 

Let me know if you have any further questions.

Badge +2

@Maddie

Thank you for your polite and easy-to-understand reply.

 

In the meantime, you could call for a new PurchaserInfo object in the case that restore fails, and you should be able to get one. 

I also implemented it this way, so I was relieved that the idea was the same!

 

RevenueCat is a very nice service.

Good luck with the further development of RevenueCat!

Userlevel 1
Badge +3

There isn’t a good way for us to know NOT to consume it once it’s been refunded

 

If you provided a way (e.g. a checkbox) in the RC dashboard for the developer to mark a product as non-consumable, then that at least that would be a solution for non-consumables.

Reply