Non-Renewing Subscription Already purchased alert track - ios

I am implementing Non-renewing subscription IAP in my app where I am making server implementation to expire a subscription. I am stuck when I click on a subscription I already have bought, It shows a dialog, "This In-App purchase has already been bought. It will be restored for free." with OK button. I have two questions here:
Sometime it shows the above dialog but sometimes it shows "Tap buy to renew or extend it." dialog. Can anyone tell me whats reason behind this? Or it is just a Sandbox issue. (This screenshot from another thread.)
When I get "This In-App purchase has already been bought. It will be restored for free." alert, how i can stop activity indicator? Is there a delegate method to track this?
I could not found but is there anything new came in iOS 8?
Thank you

For a non-renewable subscription, the correct dialog is "Tap buy to renew or extend it.". The reason for this is that once a non-consumable product is owned, it is owned permanently; hence the "renew or extend" language.
You are getting this dialog because you are attempting to purchase the same product again before completing the transaction on the app's side. The App Store has approved the transaction and sent you a transaction ID, but you have not confirmed that you have delivered the promised content/access. Thus, the transaction is left in the approved state. The transaction remains tied to the app until you finish it.
See "Finishing the Transaction" in Apple's (confusing, convoluted) documentation.

I met this problem in consumable IAP, and I have called the function [[SKPaymentQueue defaultQueue] finishTransaction:transaction]. Then I found that there is a exception occurred in a function before the call, then I exchange the position of two function, the problem is solved now.

Related

In-App-Purchase subscribed state in Swift?

So I have a question about doing an in-app purchase with a subscription in swift. I read at this link: https://www.revenuecat.com/blog/the-ultimate-guide-to-subscription-testing-on-ios#sandbox that you need your app to enter subscribed state. Is this some kind of delegate method or something I call, or does it simply mean that I enable the features? I haven't been able to find much detail on that part. Any guidance would be much appreciated. I do have the in-app purchase dialog appearing and the sandbox account working. I also get the alert saying the purchase was a successful. But even 2 seconds later if I try again it just allows me to purchase again.
By subscribed state they mean that a user still should have access to the content he unlocked with the subscription.
But even 2 seconds later if I try again it just allows me to purchase again.
Unfortunately, it is your responsibility to hide already bought in-app purchases from your users. Although, Apple prevents buying the same subscription again. So, when your first purchases succeeded, the second one should lead to an alert from Apple, that the purchases weren't executed. Otherwise, I assume your purchase logic is faulty.
How do you check the eligibility of your users? Do you validate the receipt locally, or are you using RevenueCat for that?

In-App Purchases restore button necessary?

guys I've implemented an in-app purchase using PARSE. Now there is no restore button in my app . My DB, hosted on the PARSE cloud has a an attribute called "hasMadePurchase" in my User's table which is checked every time the user tries to make a purchase. The attribute is set to yes as soon as a successful purchase has been made.
Now with that, do I need a restore purchases button for the app to get it through the app store? Cause clearly, even if the user changes his/her device deletes and re-installs the app or whatever he/she will still be able to get all his/her purchases back.
If yes, than what do I need to implement in my restore function? (which would basically do nothing, other than making fake calls, i don't know i am kinda lost)
A restore purchases button is needed only if the app offers non-consumable IAPs, e.g. unlocking content. Our game got rejected recently exactly for this reason - we were offering weapon unlocks and we were missing the restore purchases button.
If you are offering non-consumable IAPs then you can start by looking into [[SKPaymentQueue defaultQueue] restoreCompletedTransactions] and go from there. Basically, this fetches the list of all IAP SKUs that have been previously purchased by the user.

Does Non-Renewing subscription requires a restore button?

My app got rejected because of restore button on non-renewing in app purchase. Do i have to remove restore button ? If i have to do so then how user will restore his purchases.Please help.
Non-renewing subscriptions are consumable. Therefore they cannot be restored. A restore button therefore makes no sense. You also need some kind of authentication/login system for the user. (See below for detailed explanations.)
Sources:
consumable vs. non-consumable in app purchases
non-renewing subscriptions
Update from WWDC2017: In Session #303 App Store Engineer Pete Hare explains at 3:00 that a non-renewing-subscription can be seen as "a consumable product with an expiry date on it"
There has been some debates in the comments wether non-renewing subscriptions are consumable or not, so I want to say something about it. "Consumable" means that you can consume them multiple times. Like "30 minutes of talking" in a voice-over-IP telephony application. On the other hand, there are non-consumables that you can buy only once. Like when you unlock all levels in a game app. You buy it once, and when you reset the device and redownload the app, you should be able to restore the purchase, so that you don't have to pay twice to unlock all levels. Furthermore, if you don't tap the restore-button in this case but just buy the "unlock all levels" package again, it works, but you will not be charged by apple a second time. That's why it is called non-consumable. It's some kind of metapher. An apple is "consumable". Once it is consumed, it is gone. A chair is non-consumable. You have it as long as you don't destroy it or give it away.
So, it makes sense to regard a non-renewing subscription as non-consumable. If you buy it a second time, you shouldn't pay twice, you should just use the old subscription you already have. If you reset the device, you should be able to restore the subscription once you re-download the app. The restoration is just not done by Apple but by the app itself.
I still regard non-renewing subscriptions as consumable though. I use a simple definition of consumable vs. non-consumable: An in-app-purchase is consumable, when, from the point of view of the StoreKit API, it can be purchased multiple times in the same week by the same user. All consumable IAP-items cannot be restored through the StoreKit. All non-consumable IAP-items can be restored through the StoreKit.
So, the developer is himself responsible for restoring the in-app-purchase of a non-renewing subscription, right? No, sorry. How would the app restore the in-app-purchase of a non-renewing subscription? Suppose I have an iPod and I subscribe to 1 month of listening to the Foo-radio. Now I want to also listen to the Foo-Radio on my iPad. Soo, I install the Foo-App on my iPad and tap the "restore" button. Well... what is the "restore" button supposed to do? How can it know if I already have purchased a "Foo"-subscription or not, and how long it will still be valid? Answer: it can not. This approach does not work.
In order for a non-renewing subscription to work, you have to login the user first, to tie the subscription to some online account. Username/Password, Open-ID, Login via Gmail, Facebook, etc. all would work. Then, when the user purchases an n-r subscription you have to store the fact that he subscribed on some server and link it to his account on the server. You also have to prevent the user from buying the n-r subscription when he is not already logged in. Let's continue with my iPod/iPad-example above. I download the app on my iPad, I login with Facebook, and voila, I can use the "Foo"-subscription now. There is no need for a "restore" button, because the app should check at login-time which subscriptions the user has.
There will be some additional problems to deal with. (1) For example, nothing prevents the user from logging in into 200 devices. Here the problem is not a user with 200 devices, but a university with 1000 students where 180 students share the same account. (2) If the server crashes, some people will probably lose their subscriptions. Problem (1) can potentially lead to decreased income. Problem (2) can lead to angry and unhappy customers.
From Apple: "Non-renewable subscriptions. Subscriptions that don’t involve delivering episodic content. Examples include access to a database of historic photos or a collection of flight maps. It’s your app’s responsibility to make the subscription available on all of the user’s devices and to let users restore the purchase. This product type is often used when your users already have an account on your server that you can use to identify them when restoring content. Expiration and the duration of the subscription are also left to your app (or your server) to implement and enforce." [Italics and bold added] https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/Products.html
Apple Reviewer's current-similar response about Non-Renewing Subscriptions "Your app offers Non-Renewing Subscriptions and this purchasability type must have its own restoring function - if you have removed it please re-implement it. Furthermore, your app must also offer a function, such as account creation, such that purchases can be tracked across all of a user's devices. Please implement a login feature as well as a restore mechanism prior to resubmitting your revised binary for review."

iOS auto-renewable subscription purchase issue

Here is the reproduce steps of issue:
I tap the "purchase" button in my app.
I enter the password of Apple ID.
Apple show a dialog to confirm purchase or not. And I tap "Yes."
Apple show a dialog to say that I have no payment information, need to complete it.
(This moment I got a transaction with state SKPaymentTransactionStateFailed in updatedTransactions: function)
I tap continue then jump to iTunes app and start to complete my credit card information.
After complete the payment information , apple ask me to confirm purchase again.
I tap "confirm" then the purchase is done.
(Notice that it didn't come back to my app automatically.)
Here is my questions:
Why this flow didn't invoke the callback function I wrote when transaction with state SKPaymentTransactionStatePurchased is coming?
The last one, do I need to finish transaction when I receive transaction with state SKPaymentTransactionStateFailed?
In my experience, if you're in the sandbox and are asked for credit card info, something is wrong. Could you try to log out of your App Store account before you build/run the app? That usually solves it for me. If that doesn't work, you might try deleting the app as well as logging out before running the app again. Are you making sandbox purchases with a test user created through iTunesConnect?
According to SKPaymentTransactionObserver Protocol Reference, yes, you should call -finishTransaction: even for SKPaymentTransactionStateFailed. I do this in my own projects with no ill effects.

Refund the previously purchased non-renewing subscription, not the current one. Possible?

I'm implementing an iOS app with non-renewing subscription. Not much relevant information was available online; so I seek your guidance.
A use case which worries me the most is when a user purchased the subscription once and then immediately after purchase it again to extend the duration of service (see such scenario here). What if that user were to refund the first purchase, leaving the second one intact? Is this even possible in practice, or am I just too paranoid?
Assuming the above case is possible, my app will run into a problem because, as far as I know, verifyReceipt only returns the latest, good receipt (watch Managing Subscriptions with In-App Purchase in WWDC'12).
I find nowhere Apple provides relevant information about refunding policies.
(Auto-renewable subscription seems to rule out this case as a renewing action is taken care by iTunes automagically and it seems not possible to extend this type of subscription until iTunes allows it.)
verifyReceipt will not only return the latest good receipt, it will also tell you if the receipt you submitted for verification is good. So if you're concerned that a user may have cancelled* a transaction, then submit every receipt you're questioning.
*But what do you mean by "cancel" the first purchase? Do you mean when they tap "cancel" instead of "buy?" Well then the transaction won't go through and you won't even get a receipt.
Or do you mean when they request a refund? I don't know any other way they can cancel a purchase.
Edit:
If you're referring to refunds, there's no way for a developer to tell if a user has been issued a refund. The assumption is that Apple expects you to continue to deliver services to that user regardless of the fact that they received a refund. Your receipts will probably all verify correctly regardless of the status of a refund.

Resources