Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Implementation of SKPaymentQueue causes bugs with payments #17

Closed
chrisradford opened this issue Oct 30, 2015 · 2 comments
Closed

Implementation of SKPaymentQueue causes bugs with payments #17

chrisradford opened this issue Oct 30, 2015 · 2 comments

Comments

@chrisradford
Copy link

There is an undocumented flow as part of the StoreKit framework that means some payments don't trigger the callback for a successful payment. I'll do my best to explain but for more information see this thread and specifically the post by Rich from Apple: https://forums.developer.apple.com/thread/6431

Per Apple's Best Practices for In App Payments document (https://developer.apple.com/library/ios/technotes/tn2387/_index.html) the observer should be added to SKPaymentQueue when the app loads. There are two reasons for this:

  1. The "StoreKit Flow" from the above linked thread, means that some users (those required to update payment details or agree to new T&Cs on the store) will be taken out of the app to update their details, and when the app is backgrounded the observer is removed.
  2. As part of the "StoreKit Flow", two statuses will be sent to the observer, one for a cancellation and one for a success (the cancellation once the user leaves the app, the success if they complete the payment), therefore it is desirable to leave the observer in place throughout the lifecycle of the application.

ProMotion-iap is a really nice gem and I did attempt to rework the logic to fix our issue relating to the StoreKit Flow however it proved quite difficult and would mean a reworking of the basic functionality of the gem which wasn't something that I felt comfortable doing on a PR without discussion first.

Hope that helps and do ask if anything isn't clear, I've spent the best part of a week working on this :)

@jamonholmgren
Copy link
Member

@chrisradford , thanks a ton. You're absolutely right that PM-iap really needs somewhat of a rewrite, already. Unfortunately, when I built the gem I had one use case in mind, and didn't really plan ahead to support subscriptions and some other parts. Granted, the Apple documentation on this really sucks.

I'm very interested in this rewrite. I'm happy to help out how I can, although my availability to code is limited given my current position and attempting to build a house.

Your work is hugely appreciated! Let me know what I can do to help.

@kevinvangelder
Copy link
Member

The other consideration here is that automated testing is near impossible due to the fact that StoreKit is essentially disabled on the simulator.

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

No branches or pull requests

3 participants