I'm creating an iOS app with an auto-renewal subscription. I've been reading a lot of tutorials and documentation but I'm a bit confused about how to handle certain scenarios.
Here's how my app works:
- User installs app
- User creates account within signup flow
- User is asked to select a plan and pay within signup flow
- The payment receipt is uploaded to my server and I activate their account in my database.
- My server polls the
/verifyReceipt
endpoint on regular basis to renew the user's account or deactivate it depending on what the latest info from apple. (or use Apple's new Status Update Notification, both serve the same purpose to get me the latest subscription info on my server)
After a month when the subscription renews I know a transaction will appear on the SKPaymentQueue
on the user's device. Because of this a lot of tutorials/documentation recommend having your AppDelegate
implement the SKPaymentTransactionObserver
protocol so that you can handle a transaction at any time.
But, I didn't use AppDelegate
. I used the view controller in signup where the user picks their plans to implement SKPaymentTransactionObserver
.
My reasoning is that since I'm getting info on the backend do I need to care about the transactions that will show up in the queue in the client each month when the subscription renews? Can't I just ignore these transactions, or will I need to call queue.finishTransaction
on them?
I also read some things about restoring transactions when the user deletes the app and re-installs or gets a new phone. Again, do I need to worry about this? Because I should still know about the subscription on the backend and all the user has to do when they get a new phone is log in to their account for my service and it'll check the backend to see if their subscription is active.
I guess my larger question is: When you have a backend to handle IAP auto-renewal subscriptions, can you ignore some of the stuff happening on the client with the payment queue because that feature was built for apps that don't have a backend.