adaptyteam / AdaptySDK-Flutter

SDK for growing mobile in-app purchases
https://docs.adapty.io/docs/quickstart
MIT License
95 stars 17 forks source link

Already purchased error mapping is not aligned with AdaptyError object #59

Closed ch-muhammad-adil closed 1 year ago

ch-muhammad-adil commented 2 years ago

Hello there,

we are using your SDK for payments, but there is a problem in error handling. I get an error which is native iOS one that says I have already purchased that item. Adapty is also throwing an exception but when I try to read error code and message there is nothing aligned with one Apple is throwing at native level. See below <SKPaymentQueue: 0x28171e640>: Payment completed with error: Error Domain=ASDServerErrorDomain Code=3532 "You are currently subscribed to this" UserInfo={NSLocalizedDescription=You are currently subscribed to this}

And adapty gives me

Screenshot 2022-09-07 at 5 05 24 PM

I have no way to handle that error. I guess inside this method Adapty.makePurchase(product); , you can include few callback like onAlreadyPruchased and there you can provide MakePurchaseResult object as well if possible, or may be some other receipt related information.

x401om commented 1 year ago

Hi! Thanks for the report, we are currently working on a major update, which among other things will be redesigned error system, so that in the future this problem should not arise.

x401om commented 1 year ago

Hey, @ch-muhammad-adil! We have released a new version of our sdk, feel free to upgrade! Our tests showed that you should get success in the makePurchase function if you are paying for a subscription within a subscription group. If you continue to run into this situation, reopen the issue.