Testing Auto-renewing in-app purchase in sandbox environment - ios

I have an app in which, content is uploaded on weekly basis and hence using Auto-renewing subscriptions is the best option. Once the user subscribes for a weekly subscription, he is charged on weekly basis until he opts out.
I researched on how to unsubscribe and I read there is no api call or no other way to implement this from the app. The user has to manually turn it off from iTunes & App Store. Is that true ?
Question: I am testing with a sandbox account so is there a way to Manage subscriptions i.e stop subscription to that particular app? I want to turn off the weekly subscription and then try again to turn it on from app. I could not turn it off from device. So is it because I am using sandbox account?
Please reply! Thanks in advance!

Related

How to Handle Canceled iOS In App Purchase Auto-Renewing Subscription

I'm wondering, if a user cancels a subscription and are trying to resubscribe am I supposed to present the management portal from within the App Store to this user and let them resubscribe from within the App Store or am I supposed to allow them to purchase a new subscription from within the App itself? It seems as if once a user has purchased the initial subscription from within the app itself Apple wants all other management to be done using the App Store.
I'm not exactly sure how this works and because I cannot access the 'Manage Subscriptions' portal for a sandbox App Store account I can't tell exactly how subscriptions are handled when they expire.
Thank you!
From the App Store subscription management page a user will be able to:
Change their auto-renew status
Upgrade or downgrade to a different subscription in the same group (e.g. change from a monthly to yearly subscription)
Resubscibe to an expired subscription
Paulw11’s comment is correct that you handle a re-subscribe exactly as a purchase in your app (the user won't receive a free trial if they had before). The purchase will go through as a normal subscription and it will be less confusing to your users.

Auto Renewable Subscription issue with different sandbox users on Same device

I am using Auto Renewable Monthly Subscription in my application and successfully implemented workflow. I am testing application in development mode i.e with sandbox environment. I have added two Sandbox users in iTunes connect > User and Roles Section.
Query -
When user monthly subscribe service using first sandbox account and successfully subscribed product. then user Sign Out first sandbox account from device Settings > iTunes and App Store Section and then again login with second sandbox test user.
When user again open application then it show alert - "you are currently Subscribed to this" with option to manage and Ok, Rather than asking to perform purchase with new second sandbox user. Please guide me what should be the correct behaviour.
How can I add cancel subscription within app and test with sandbox environment.
How does auto renewable - renew subscription and validate subscription work?
Kindly Suggest , I will be very thankful for guide lines.
First of all,SandBox payment validity is 5 mins for monthly recurring payments. And for app inApp Payment details will save in appStoreReceiptURL this url, Apple will check based on Purchase_id(it will create in iTunes) and appStoreReceiptURL, If you want to use another Sandbox tester email You need to delete app and re install.then you will proceed to payment via SandBox.
2) There is no option to cancel Auto-renewable to sandbox payments.
3) Auto renewable will not work in Sandbox payments, it's for just testing purpose how inApp will work with out payment.

iOS In-App Purchase Auto-Renewing Subscription Management

I am implementing auto-renewable subscriptions in iOS and want to be able to test the scenario where the user cancels the subscription but I am unable to do so because when I try to manage subscriptions with the sandbox account the app store wants me to associate a payment method with the sandbox account but in my experience once I do that the sandbox account is no longer valid.
Is it even possible to test cancellations or do I just blindly code for cancellations? I have search high and low and have not found anyone who has been able to manage subscriptions in a sandboxed environment.
I realized today that I was thinking about this all wrong and I can see why its not as necessary to be able to manage subscriptions. I was thinking that the 'Cancellation Date' field would reflect when a user cancel's (or really just opts out of auto-renewing) their subscription. But I was mistaken this field is only for the times when a user contacts Apple Support and requests to cancel early and receive some sort of a refund, and this is not something that is managed directly by a user.
Have you tried using a TestFlight build? You can do sandbox IAP testing via TestFlight with a "normal" iTunes account that has a payment method. I would assume that means you could try out canceling the subscription.

How do auto-renewable in-app-purchase subscriptions work?

My application currently allows the user to subscribe to our service using in-app purchase auto-renewable subscription. The app provides images, 12 images per month, and every month the user needs to renew his/her subscription to see the new content.
I haven't work on the auto-renewable model before, so I have built a model to validate the receipt and it works, but should I check if the user subscription expired or not, and, if so, how?
Also, does the app store only allow magazines and newspaper items to be auto-renewable?
I haven't worked on the auto-renewable model before, so any help on this matter would be highly appreciated.
When a user signs up for an auto-renewable subscription, they continue to be charged until they manually cancel it. This is obviously great from a developer’s point of view, because it takes a lot more effort to cancel something than to just let it continue.
You might already be familiar with a class of apps that use auto-renewable subscriptions already: Newsstand.
Newsstand was first introduced in iOS 5, and allows content providers to easily distribute their newspapers and magazines. With it, Apple introduced the auto-renewable subscription model, which allows you to set a subscription duration and manage renewals automatically through the StoreKit framework.
However, Apple has placed some very strict rules around auto-renewable subscriptions, meaning their usage is (usually) exclusive to Newsstand apps.
So sadly, if you want to provide content or features for a limited duration, outside of Newsstand, then your only option is to use non-renewing subscriptions.
found that here: http://www.raywenderlich.com/36270/in-app-purchases-non-renewing-subscription-tutorial
An auto-renewable subscription is an iOS In-App Purchase category that allows an app to provide and charge for content or features over a set amount of time.
Hear is a very useful link!. It provides almost every details about auto renewable subscription
Auto-Renewable In-App purchases continues charging the user (weekly/monthly/yearly etc.) until they cancel it.
You can check if the subscription has expired using the a validated receipt. It contains subscription expiration date and time.
If you want to lock content if subscription has not renewed, you may want to check receipt info against current date/time, on applicationDidBecomeActive delegate. There are open source libraries that lets you verify receipts locally as well.
And any kind of app can have Auto-Renewable In-App purchases, not just newsstand apps.

iOS In-App purchase subscriptions integration with a third party system

I need to build an app for a system, which already has a subscription on its website. It looks like Apple doesn't allow to use any own subscriptions and forces to integrate any app with iOS in-app subscriptions.
Is it any way to integrate two subscription systems? The main problem is that users can manage iOS subscriptions via iTunes and I can't find whether it's possible to get information about this and to stop subscription in the existing system if it's stopped via iTunes.
So is it possible to get notifications about unsubscribed iTunes users?
Using third party subscriptions
First off, it is possible to support an existing subscription system in your app, but it must be in addition to the App Store subscriptions. Also you have to be very careful about the UI you use. You can't prompt users to bypass the App Store and purchase through your server, but you can offer existing subscribers the ability to sign in with credentials they may have previously obtained through your website.
That said, Apple can be fairly capricious in their rulings on what is and isn't allowed in the App Store. I have worked on apps that have done this sort of thing, but they have been for fairly well known magazine publications. There's no guarantee that they will allow it for everyone.
Detecting unsubscribed App Store subscriptions
As for using App Store subscriptions, when a user purchases a subscription in your app, they will receive a receipt in the SKPaymentTransaction object. This receipt should be posted to your backend server to make sure it is valid before you give the user access to anything. See the In-App Purchase Programming Guide for more details.
When you setup a subscription type, you specify how long that subscription lasts. So if you log the transaction date in the SKPaymentTransaction when you receive a receipt, you can determine exactly when that subscription should expire by adding the duration of the subscription to the transaction date.
If it's an auto-renewing subscription, you will receive a new receipt when the subscription is renewed. So once you have validated that with your backend server, you can update your expiry date based on the new transaction date. If you don't receive a new receipt before the first one expires, it's likely the user has cancelled their subscription.
On the backend, your server can also tell when a particular subscription will expire based on the response from the verification server. First there is the status code which will tell you whether the subscription has already expired, but there is also an expiry date returned in the decoded receipt which will tell you when it is expected to expire if it hasn't already.
For more details, see the Auto-Renewable Subscriptions documentation.
Testing auto-renewing subscriptions
It's worth noting that when you are testing auto-renewing subscriptions in the App Store sandbox environment, the length of the various subscription types is dramatically shortened to make it easier to test. For example a 1 week subscription lasts only 3 minutes in the sandbox environment. You can see the full list of times in the iTunes Connect Developer Guide.
So you want the people that have bought the service from the website to be able to use the app, exactly like if they had purchased it from in App Purchases and in App Purchases people to be able to join the service just like people that joined through the site? As far as I know, Apple doesn't allow you to pay through other services as you said, but let's say someone buys the service from the app. What should happen would be that the money will be transferred to the company. Then after the payment you should include some code doing what the site does after a new person has payed for the service, so create his account as a paid account. Then, the app should also have a login screen where the registered users (no matter where they registered from) will be able to login into the app and use the service. Now the problem is indeed that if the subscription is stopped through iTunes you would never know, though a way around this would be to make a check in the server of this company which should monitor the income coming from one account. Then if this user has stopped paying (or stopped the subscription) you would be able to stop the service from the app. And you should recheck the server for payment after the duration of the subscription has passed, let's say a weekly subscription should be checked every week. (Sorry I would do this a comment but I haven't got enough reputation for this)

Resources