Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is this Production ready? #5

Closed
sabiland opened this issue Sep 14, 2022 · 7 comments
Closed

Is this Production ready? #5

sabiland opened this issue Sep 14, 2022 · 7 comments
Labels
question Further information is requested

Comments

@sabiland
Copy link

sabiland commented Sep 14, 2022

In the examples I do not see anywhere switch cases for failed purchasings (as in SwiftyStoreKit, etc.) ?

How about restoring purchases? How to check if IAP was already purchased before? Reinstalling the app, etc.

@tikhop tikhop added the question Further information is requested label Sep 14, 2022
@tikhop
Copy link
Owner

tikhop commented Sep 14, 2022

Hi @sabiland, thanks for asking. Yes, it's production ready and I have been using it since I released it.
Failed transaction will throw an error from StoreKit framework.
Restoring purchases works differently in store kit 2 and Mercato supports it as well.
With store kit 2 you can only track non-consumable + subscriptions iaps, Mercato only support subscriptions, but I will add support for non-consumable.

@sabiland
Copy link
Author

sabiland commented Sep 14, 2022

Thx for quick reply. About non-consumable, can I make non-consumable purchase with Mercato? I have already checked about restoring purchases with StoreKit 2, will do it manually for now probably.

And where is Mercato.purchase completion block? Success, etc.? Maybe I don’t yet understand how StoreKit2 and/or Mercato works.
EDIT: I saw the StoreKit 2 is handling error messages via popups right?

@sabiland
Copy link
Author

Ok I think I have managed to refactor first of my apps to StoreKit 2 with the help of Mercato.

@tikhop
Copy link
Owner

tikhop commented Sep 15, 2022

Sounds good!

@tikhop tikhop closed this as completed Sep 15, 2022
@sabiland
Copy link
Author

@tikhop Will you allow another question, where are string messages defined for your errors?

I get this for example if I simulate IAP and then cancel it. I know Apple does not allow those kind of messages for the user.
The operation couldn’t be completed. (Mercato.MercatoError error 2.)

public enum MercatoError: Error
{
	case storeKit(error: StoreKitError)
	case purchase(error: Product.PurchaseError)
	case purchaseCanceledByUser
	case userCancelledRefundProcess
	case purchaseIsPending
	case failedVerification
	case genericError
}

@tikhop
Copy link
Owner

tikhop commented Sep 19, 2022

@sabiland the message comes from the system.

@sabiland
Copy link
Author

sabiland commented Sep 19, 2022

Yes, but it adds extra info e.g. (Mercato.MercatoError error 0.). Apple would not allow this kind of message.

So I fixed this by checking for "(" character and remove everything behind.

func cleanPossibleStoreKitAndExtraAddedMessage(input: String) -> String
        {
            // NOTE: Input can be like this ---> "The operation couldn’t be completed. (Mercato.MercatoError error 0.)"
            let splitted = Array(input.components(separatedBy: "("))
            return (splitted.first ?? input).fullTrim()
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants