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

Question on purchase response #32

Closed
psuarez opened this issue May 2, 2016 · 12 comments
Closed

Question on purchase response #32

psuarez opened this issue May 2, 2016 · 12 comments
Labels
iOS & iPadOS directly related to iPhone and iPad type: question

Comments

@psuarez
Copy link

psuarez commented May 2, 2016

Hello,
I'm using 0.2.7 version
I'm experiencing the following problem: I got the Success response before I got the Store popups to do the purchase. Sometimes I got the Failed (Cannot connect to the App Store) and after that the Store popups to do the purchase appear.
Is there a way to control the flow of Store popups? or at least prevent them to appear in those situations?

@bizz84
Copy link
Owner

bizz84 commented May 2, 2016

Are you running on iOS or OS X?

Could it be possible that you started the purchase, then closed or killed the app?

It appears that if a purchase is started, the OS continues with the purchase even after the app is killed.
In this scenario, if the app is started again and you perform a purchase, you are likely to receive the callback from the completed purchase from the previous session.

I'm aware that this can cause confusion and to address this problem on version 0.2.8 I have added a new completeTransactions() method that should be called when the app launches.

Could you please try version 0.2.8 (see the README and demo app for how to use this) and let me know if it works?

@bizz84
Copy link
Owner

bizz84 commented May 2, 2016

Does this StackOverflow Q/A describe well the issue you're encountering?

http://stackoverflow.com/questions/4988663/skpaymentqueue-addtransactionobserver-asking-for-app-store-password-on-startup-a

If so, could you try to follow the steps and let me know if it solves the problem?

@psuarez
Copy link
Author

psuarez commented May 2, 2016

Hi,
I'm using iOS latest version of everything, deployment target 8.0, testing
on iPhone6 with 9.3

I started coding my own IAP but when I found yours totally like it and I
switched last week.
My code for the purchase is exactly the same as the Demo App.

...

  NetworkActivityIndicatorManager.networkOperationStarted()

  SwiftyStoreKit.purchaseProduct(productIDToBuy) { result in

    NetworkActivityIndicatorManager.networkOperationFinished()



    //self.showAlert(self.alertForPurchaseResult(result))



    switch result {

    case .Success(let productId):


      self.productPurchasedByID(productId)


    case .Error:

      self.indicator.stopAnimating()

    }

...

And no, the app didn't close... but we have been doing so many tests with
the sandbox that when you look at the receipt you have dozens of old
transactions.

Thanks!

On Mon, May 2, 2016 at 4:41 PM, Andrea Bizzotto notifications@github.com
wrote:

Are you running on iOS or OS X?

Could it be possible that you started the purchase, then closed or killed
the app?

It appears that if a purchase is started, the OS continues with the
purchase even after the app is killed.
In this scenario, if the app is started again and you perform a purchase,
you are likely to receive the callback from the completed purchase from the
previous session.

I'm aware that this can cause confusion and to address this problem on
version 0.2.8 I have added a new completeTransactions() method that
should be called when the app launches.

Could you please try version 0.2.8 (see the README and demo app for how to
use this) and let me know if it works?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#32 (comment)

@bizz84 bizz84 added the iOS & iPadOS directly related to iPhone and iPad label May 2, 2016
@psuarez
Copy link
Author

psuarez commented May 2, 2016

Nop is not that case... I'll try to explain it step by step

This is the code, I'll put fake number lines to explain:

L1. NetworkActivityIndicatorManager.networkOperationStarted()

L2. SwiftyStoreKit.purchaseProduct(productIDToBuy) { result in

    NetworkActivityIndicatorManager.networkOperationFinished()

L3. self.showAlert(self.alertForPurchaseResult(result))

    switch result {

    case .Success(let productId):

L4. self.productPurchasedByID(productId)

    case .Error:

      self.indicator.stopAnimating()

    }

Step 1- Start purchase
Step 2- L1 ok... I see the network activity indicator
Step 3- L2. ok... debugging I can see the line is correctly executed
Step 4- I got the result almost immediately either is Success or Error
(some times I got connection error)
Step 5- L3. alert is shown
Step 6- Almost in the same moment I start receiving App Store Popups that
appear on top of the app indicating what I'm going to buy, how much, some
times asking for my apple ID or password or touch id
Step 7- When I get rid of all the popups, either buying or cancelling
finally I got to the Alert to close it.
Step 8- If I got .Success on Step 4 the app continues to what should happen
if you have paid the subscription L4. etc. (even if you cancelled the
payment on the popups)

Does it help? It's more clear?
Thanks!

On Mon, May 2, 2016 at 4:59 PM, Andrea Bizzotto notifications@github.com
wrote:

Does this StackOverflow Q/A describe well the issue you're encountering?

http://stackoverflow.com/questions/4988663/skpaymentqueue-addtransactionobserver-asking-for-app-store-password-on-startup-a

If so, could you try to follow the steps and let me know if it solves the
problem?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#32 (comment)

@bizz84
Copy link
Owner

bizz84 commented May 3, 2016

The issue you are describing seems very similar in nature to this: #30
Would you be able to test with version 0.2.8 and make sure that you call completeTransactions() when the app starts in your AppDelegate? This should clear any old pending transactions and should improve things especially if you were testing with multiple accounts.

@psuarez
Copy link
Author

psuarez commented May 3, 2016

I'm testing it, looks promising!

I have 2 more questions after I finish with this one.

Thanks!

On Tue, May 3, 2016 at 11:43 AM, Andrea Bizzotto notifications@github.com
wrote:

The issue you are describing seems very similar in nature to this: #30
#30
Would you be able to test with version 0.2.8 and make sure that you call
completeTransactions() when the app starts in your AppDelegate? This
should clear any old pending transactions and should improve things
especially if you were testing with multiple accounts.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#32 (comment)

@bizz84
Copy link
Owner

bizz84 commented May 24, 2016

@psuarez did version 0.2.8 solve this in your implementation?

@psuarez
Copy link
Author

psuarez commented May 25, 2016

Hi,
yes, still having some issues with the beta tester users, we didn't know
that Apple considers testflight users as sandbox users so we had to add a
fail back validation of the receipts so we can upload a build to testflight
and have the same build published, that seems to be working for now but
some users are getting the receipt ok but according to our logs the receipt
doesn't contain the product IDs they are supposedly bought...

Is there a way to have more visibility of what happens at production level
with the IAP?, we have some remote logs implemented but it will not scale
when the app will be more used.

Thanks!

On Tue, May 24, 2016 at 3:31 PM, Andrea Bizzotto notifications@github.com
wrote:

@psuarez https://github.com/psuarez did version 0.2.8 solve this in
your implementation?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#32 (comment)

@bizz84
Copy link
Owner

bizz84 commented May 25, 2016

@psuarez Please take a look at the ReceiptVerifyURL type as the correct value should be passed in depending on whether the app runs in Test or Production mode.

Currently SwiftyStoreKit only processes requests but doesn't have a way to track IAPs in more detail and I'm not sure I could come up with an unified set of rules for what needs to be tracked (different organisations may have different requirements). I would suggest you fork the project and add hooks as needed.

Also it's possible that once a test plan is devised and implemented (see #38) we can have some more confidence that the library is doing the right thing - however I don't anticipate being able to look at this in detail any time soon (proposals and contributions would be welcome though).

@psuarez
Copy link
Author

psuarez commented May 26, 2016

URLs are ok! Did you understood the problem with the fail-back mechanism?

Off course if I found anything that could be added to the library I'll do
it, for now I think is OK.

On Wed, May 25, 2016 at 4:08 PM, Andrea Bizzotto notifications@github.com
wrote:

@psuarez https://github.com/psuarez Please take a look at the
ReceiptVerifyURL type as the correct value should be passed in depending
on whether the app runs in Test or Production mode.

Currently SwiftyStoreKit only processes requests but doesn't have a way to
track IAPs in more detail and I'm not sure I could come up with an unified
set of rules for what needs to be tracked (different organisations may have
different requirements). I would suggest you fork the project and add hooks
as needed.

Also it's possible that once a test plan is devised and implemented (see
#38 #38) we can have
some more confidence that the library is doing the right thing - however I
don't anticipate being able to look at this in detail any time soon
(proposals and contributions would be welcome though).


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#32 (comment)

@josueruiz7
Copy link

josueruiz7 commented Oct 18, 2016

I have the method callback :
SwiftyStoreKit.completeTransactions() { completedTransactions in

        for completedTransaction in completedTransactions {

            if completedTransaction.transactionState == .Purchased || completedTransaction.transactionState == .Restored {

                print("purchased: \(completedTransaction.productId)")
            }
        }
    }

But It keep display the prompt of password, while I am navigating inside the app, with out purchasing any product.

I am using version 0.3.0
Any advice?

@bizz84
Copy link
Owner

bizz84 commented Feb 20, 2017

@psuarez Apologies for the very late reply.

There have been some major improvements to the purchase flows recently.

Could you update to the latest version and let me know if everything now works as expected?

I will close this issue if there are no updates in the next few weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
iOS & iPadOS directly related to iPhone and iPad type: question
Projects
None yet
Development

No branches or pull requests

3 participants