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

Resolved repurchasing a non-consumable not calling completion, on macOS. #105

Closed
wants to merge 5 commits into from

Conversation

Megatron1000
Copy link

I also had this same issue. #98

On OSX at least, when you attempt to make a payment for a non-consumable product that's already been purchased by that account the transaction result comes back as a restore. Because of the if condition in the restore case, the transaction transactionResults would never get updated.

I've only tested this on OSX, so I can't comment on the behaviour on iOS, but from reading the code I can't see the point in the isPurchaseRequest boolean. I've reduced the protection so all it does now is avoid doing anything with non matching products identifiers, only when you're purchasing, not restoring.

Fixed an issue, discovered on OSX, where when a user attempts to repurchase a non-consumable IAP, the 'purchase' completion block is never called.
@bizz84
Copy link
Owner

bizz84 commented Nov 13, 2016

@Megatron1000 Thank you for the PR!

I will be doing some testing on iOS in due course and verify if some changes are needed to make this work on all platforms.

@aporat
Copy link

aporat commented Nov 17, 2016

this is also an issue on iOS.

if the user already purchased a specific product, but the finishTransaction wasn't call after the purchase, the same issue happens. next time the user tries to purchase the same product, a dialog will show up "This in-App Purchase has already been bought. It will be restored for free". However, the SwiftyStoreKit.purchaseProduct does not call the completion block (with neither success or failure)

# Conflicts:
#	SwiftyStoreKit/InAppProductPurchaseRequest.swift
#	SwiftyStoreKit/SwiftyStoreKit.swift
@aporat
Copy link

aporat commented Nov 17, 2016

sorry, seems my issue is related to SKPaymentTransactionObserver and not to the library itself.

after some debugging, it seems SKPaymentTransactionObserver will not call the func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) in specific cases.

the dialog "This in-App Purchase has already been bought. It will be restored for free" shows up, but the SKPaymentTransactionObserver doesn't trigger the restore / purchase event.

@doffen
Copy link

doffen commented Nov 29, 2016

I prefer adding THIS change to replace new line 146 of InAppProductPurchaseRequest.swift:
if isPurchaseRequest {
transactionResults.append(.restored(product: product))
} else {
transactionResults.append(.purchased(product: product))
}

With this modification, when you go to purchase a previously-purchased product, it returns in the same way as a new purchase would return (since the calling software doesn't need to distinguish between these two cases -- it just needs to know success or failure). I found the callbacks were getting messed up without this change.

@bizz84
Copy link
Owner

bizz84 commented Jan 21, 2017

This PR is outdated following upcoming changes to the purchase flows in SwiftyStoreKit. See new PR: #131

@Megatron1000 @doffen @aporat Could anyone test the new PR on macOS?

@bizz84
Copy link
Owner

bizz84 commented Feb 4, 2017

@Megatron1000 @doffen @aporat Can you test if the required functionality works correctly on version 0.7.0? If this issue is not updated in the next few weeks it will be closed.

@doffen
Copy link

doffen commented Feb 4, 2017 via email

@bizz84
Copy link
Owner

bizz84 commented Apr 24, 2017

I'm going to close this MR as the code has changed significantly since version 0.7.0.

If you still experience problems, please open a new issue.

@bizz84 bizz84 closed this Apr 24, 2017
@EzDream
Copy link

EzDream commented Jun 7, 2017

@bizz84 On OSX, I have updated to 0.10.2. unfortunely, The issue still exist.

@bizz84
Copy link
Owner

bizz84 commented Dec 22, 2017

@EzDream Apologies for the late reply, it seems like there are a few open issues around purchases not working correctly. I have just found a bug in completeTransactions that may be relevant. See #322.

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

Successfully merging this pull request may close these issues.

None yet

5 participants