iOS Auto-Renewable Subscriptions with sandbox test account - ios

I have changed my client's current non renewable subscription in app purchase to an auto-renewable one, and when I test it on my iPhone with a test sandbox account it shows the "" message and goes through successfully. I receive all the content I would normally get, but I noticed the amount of days that gets returned from the "daysRemainingOnSubscriptionForProductWithIdentifier: productIdentifier" increases by ~1400 every time i try to purchase it again. Also, it doesn't seem to show if it auto renews or not (6 months -> 30 minutes)... The subscriptions remain paid even when I close the app out and delete it. Is this all part of the sandbox testing and how it functions? Because the in app purchase is/was working fine, I just created a new auto-renewable in app purchase product in itunes connect and replaced the productID of the non renewing subscription with the new auto-renewable one in the .plist file. Does anyone have any experience with this?

Related

iOS: In App Auto-Renewable Subscription error while purchase

I have successfully implemented the in app purchases for consumable products. And it is working great.
Now i'm getting "Can't connect to iTunes store" when i'm trying to confirm the auto- renewable subscription. Is there anything special that we should do for the subscriptions.
Checklist that i have already gone through and verified several times
Tax, agreements are all set
Localization is all set i believe
Price tier is set
Tried new sandbox user with multiple territories (UK & Pakistan). Store is pakistani right now.
Found the solution after a lot of hit and try. I was missing period of subscription on iTunes connect.

iOS app - Logic to implement for in-app purchases

We have a non consumable IAP in our app which costs €3.49. I have purchased the IAP on my phone ages ago and also tested restore a couple of times and everything works just fine. This morning however, while testing the app, I uninstalled and installed the app from the App Store back on my phone. Instead of tapping 'Restore Purchases', I chose to 'Remove Ads', hence purchase the IAP again. I thought that the SDK(Xamarin.InAppPurchase) itself, would automatically track that I had previously purchased this IAP and it would go through the restore process on its own. However, I was proved wrong since a couple of minutes later, I received an invoice from Apple, that I had purchased the IAP again. I also received a statement from my bank for my purchase.
So my question here is: shouldn't the SDK itself check that the IAP was previously purchased under the Apple ID I was using? Should I amend my code on 'Remove Ads' to firstly go through the restore process and if I get a fail callback then move on to the actual purchase process?
Server side should check if non consumable purchase was made before or not.
In case if you try to buy second time your should get message like this:
"You have already purchased this. Do you want to
purchase this again for free?"
It works for non consumable purchases. Check inside itunesconnect if your app really non consumable, probably you made it consumable by mistake.
Also FYI info from apple communities:
https://discussions.apple.com/thread/5574903

How to get Auto-renewable in-app purchase status?

I am implementing auto-renewable in app-purchase. Here user can access application on difrent devices either iOS or android. when user is in app and allow purchase a auto-renewable subscription Then
1). is he will get a transaction success method or something same?
if yes
Then i submit a success bool and subscription end-time on local-server by hit a api-url. but my problem is
2). how can i get to know that money has been deducted from itunes (in automatically renew process)?
3).how can i get subscriptions state to save it on local server, if user never use that app on that device, or he changed his device from iOS to android?

Restore purchases in auto renewable app

In my Cocoa app, there is only auto-renewing subscription.
I check all the purchases when app starts and load the data only for purchased items.
I am also checking if there is any change(especially discontinuing the subscription) in the purchases every hour.(i.e I am not serializing user subscription in NSUserDefaults for security. They are always loaded from server when app starts)
Is it still necessary to put a Restore Purchases button in app ?
IMHO Restore button does not make any sense in app where you have only auto-renewing subscription.
Also is there any notification from apple when auto-renewable subscription ends ? Or what is the right way to check if the auto-renewing subscription has ended. Presently I am polling every hour for latest valid subscriptions.
You must need to provide a Restore Purchases option or functionality unless it will be reject by apple reviewer.
If you delete the app and again try to install this app then how to validate this user already having valid subscription.
Please check below what apple document says -
https://developer.apple.com/in-app-purchase/In-App-Purchase-Guidelines.pdf

iOS In-App purchasing and subscriptions : Testing

A college of mine has implemented iOS in-app purchasing on a auto-renewing monthly basis. I am taking over the code base and want to test it is working. I know the purchasing is wokring but the auto-renewing is what I am worried about.
I have set up a test user and read the Apple documentation that says in sandbox mode, a month is 5 minutes in the sandbox.
However I am not getting any post back from Apple after 5 minutes? should I?
In the AppDelegate I have
inAppPurchase = [TFInAppPurchase new];
[[SKPaymentQueue defaultQueue] addTransactionObserver:inAppPurchase];
[inAppPurchase updateAvailableProductsCache];
I am expecting after 5 minutes, it to fire of a notification or something?
In the iTunes development guide, there's list of how long auto-renew subscriptions last in sandbox mode:
Sandbox Testing Your In-App Purchases
You are required to test your in-app purchases in a sandbox environment before you submit them for
review by Apple. You must first sign out of your iTunes Store account
from your test device Settings before attempting to use the sandbox
environment. If you mistakenly use your test-user-account credentials
to log in to a production environment on your test device (instead of
in to your test environment), your account credentials become invalid
and cannot be used as a test account again. For more details on how to
avoid mistakes during test account use, see “Using Test User
Accounts.”
When testing auto-renewable in-app purchase subscriptions in the
sandbox environment, the duration times will be compressed to allow
for more streamlined testing. Additionally, a sandbox subscription
will only auto-renew a maximum of 6 times. After the subscription has
auto-renewed 6 times, it will no longer renew in the sandbox. The
compressed duration times are as follows:
Actual duration Sandbox duration
1 week 3 minutes
1 month 5 minutes
2 months 10 minutes
3 months 15 minutes
6 months 30 minutes
1 year 1 hour
There is no notification. You keep track of it yourself (the duration). You get a receipt with the original transaction that you save. Use this to verify (perhaps on launch each time) that the user's subscription is still active.
No notification will be generated by apple.
You have to save the recipes on server or device by using nsuserdefaults or keychain.
you have to track the duration by yourself.By caluclating
Compare the product identifier in question to the product identifier of each in-app purchase receipt.
If there is a receipt that matches, validation succeeds. Otherwise, validation fails.
When validation succeeds, your application enables the purchased functionality—for example, by downloading content or adding features. When validation fails, your application simply does not enable the functionality.

Resources