Multiple Non Renewable Subscription - ios

Sorry but I am bit confuse on implementing non renewable subscriptions.
Basic concept of app is user can post item to sell within the app. For each item to post he has to pay $.99. This item will remains there for 20 days.
As per apple documentation this kind of In App Purchase should be non renewable subscription with expiration logic to be implemented on Server side. I am done with everything like creating non-renewable IAP and integrating with app. Server maintains the expiration for each item.
Now my query is since user can post as many item he wants, how should the IAP ids should be maintain.
User Case #1:
- User A posted one item after he pay $.99 for that. So far so good.
- When he try to post next item, he is shown with the message "You have already purchase this, tap to renew or extend it" instead it should be something "Do you want to buy one xxx for $0.99"
Am I missing something here?
Use Case #2: Now say item is expired (after 20 days), For renewing shall I use the same IAP id (Product ID in IAP) to renew? or I need to create different IAP id?
Please guide me on this so that Apple shall not reject the app.
Thanks in advance!!

OK I used following:
non renewable subscription with expiration logic implemented on Server side.
Same Product ID works for me for Buying for first time and renewing after 20 days expiration.
And application got approved!

What I would suggest to you would be using Consummable in-app purchases.
Once the user owns the purchase, manage on your side how long should the registration last (server-side if the user has an account or NSUserDefaults if everything is local).
Once the subscription time is Over, just lock the functionality. During the subscription time, you can either disable the purchase button, or let them own new ones and stack the durations :)

As stated above, I would like to recommend consumable in-app. You have to maintain a database based on post id and date of purchase when user purchases a post.
You'll have to maintain this database such that it can be restorable for example if still 5 days are remaining. So user will be happy.
To maintain this data you can use your server if you have, or else you can use iCloud, any way this is a simple data sheet. Or you can use any third party library which gives free cloud storage.
Last but not least you can save locally, but I would recommend server, iCloud method. So users can restore their purchases.
So this way you can handle multiple subscription logically.

Related

iOS auto-renewable subscriptions and restoreCompletedTransactions(): is the transaction removed from the queue after expiration or cancellation?

After a long search for an answer, I want to ask a very simple question here. Are transactions associated with a auto-renewable subscription removed after the expiration date from the list of transactions that can be obtained using the restoreCompletedTransactions() method?
In its simplest implementation, is it possible to manage application content associated with a auto-renewable subscription without using Validating Receipts? And using only the result of the restoreCompletedTransactions() method?
You have two questions here.
1) Are transactions associated with a auto-renewable subscription removed after the expiration date from the list of transactions that can be obtained using the restoreCompletedTransactions() method?
Answer:
No. Those entries will always remain there and when you validate the receipt, you will get it back in response. By Doing the Restore purchase won't delete the existing entries from receipt. When you testing the In app purchase with Sandbox account then you will have 35 mins to use that account within 8 Hours. You can do whatever you want. You can do subscription again(In this case system will say us that your subscription is still running). After 35 mins of first purchased, Plan will be considered as Cancel and you need to do Subscription again(Only in Sandbox mode, Well In production mode May be it will not ask to do subscription again? I am not sure here.)
2) Is it possible to manage application content associated with a auto-renewable subscription without using Validating Receipts
Answer: No. Its good to use the receipt validation for locking/unlocking content of your application.

iOS In App Purchase for expiring ecards

I have an application that has a requirement for a user to be able to purchase an e-card. This is a digital image. The user is then permitted to share this e-card as many times as they wish within a 48 hour period (So, the card is visible in a 'My Cards' menu) It then disappears.
I'm looking through the apple documentation for IAP, and cant figure out if this should be a consumable, or a non-renewing subscription. I currently handle all the persistence and expiry myself within the app.
The problem with the latter is that it seems every card would need its own ProductID (Rather than me just having a product for 'A Card' and the app being aware of which one it is. There's over 200 cards so this doesn't seem feasible, but the methods one must implement don't seem to work like this. For example, a user may have 10 cards, all purchased at different times.
Does anyone know the correct type of purchase this should be, and the best way to implement it?
This answer Floored by new rejection on non renewable subscription type in app purchases in iphone? , rather old (2012), claims that subscriptions must last for at least 7 days. Apart from that, iTunes Connect has no problem with 200 different products.
A non-renewing subscription might work but the 7 day issue is a problem for you. A non-renewing subscription can be purchased many times so there is no problem with duplicate cards - as long as you keep track of that.
A consumable would work except a consumable can't 'expire in time' it can only 'expire when used'. So if I purchase a card as a consumable I must be allowed to keep it on my device for a long time until I want to use it. You could let the user do that - they keep the card but can't use it. When they want to use it then it gets consumed and for the next 48 hours they can use it as often as they want. You may need to explain to App Review that this is a consumable that does not expire but that can be used for a continuous 48 hour period once it finally gets consumed.

in-app purchase for auto-renewal subscriptions notifications

I've been reading the various threads on in-app purchases auto-renewal subscriptions, and I think I've pieced together most of the information I need, but there are a few missing pieces. I'm hoping someone can help me.
The situation:
I have various subscription packages the user can subscribe to (e.g., package A for £1 a month, package B for £2 a month, etc.). I store the user's subscription information in my database. When the user logs in, I check which package he's on and if it's expired or not. My website, android and iOS all use the same database, hence this approach seems to make sense.
Subscribing users via in-app purchase seems straight forward enough. I check paymentQueue and once the payment is cleared, I can update my database.
My questions:
1) My understanding is the user can use iTunes to manage their subscription. Say, they go in to iTunes and cancel their subscription, how can I be notified so I can update my database? Do I need a daemon that checks expired subscriptions to see if the user renewed?
2) If the user wants to upgrade their subscription from Package A to Package B, how do I handle the pricing? Say on Jan 1st, they buy Package A, I charge them £1.00 and set the expiry date to Jan. 31st. On Jan. 15th, they want to upgrade to package B via in-app purchase. Ideally, I would charge them £2 for Package B minus £0.50 of credit they have for Package A and set the new expiry date to feb 14th. However, Apple forces me to associate each package with a tier price. How can I handle this? I don't want the user to wait until the end of the month to put them on a higher tier package...if they upgraded mid-month, it means they want the new content package B will deliver to them immediately.
Any help appreciated!
Thanks!
1) Yes you'll have to reverify your receipt check out the Receipt Validation Programming Guide in the documentation. They mention some important keys:
status - 0 if receipt is valid, or an error code
receipt - JSON response of the receipt
latest_receipt (auto-renewable only) - base 64 encoded receipt for the most recent renewal
latest_receipt_info - JSON version of latest_receipt
With this information, when a purchase is made, send the receipt to your backend for validation, the backend will keep the receipt in the DB and verify with status = 0 that it's a valid receipt. From there, every x days you can validate that receipt with a chron job, daemon, etc. and reverify. The response back each time will have latest_receipt_info that you now need to save to your DB so you have an up-to-date receipt for the next check in x days. This way you will always have the latest receipt. There is no instant notification for telling when a user cancels a subscription, but with this you'll know every x days if they have the subscription still.
2) Pricing like this unfortunately can't be handled. It was not intended for a user to "upgrade" with subscriptions - each subscription is access to it's own exclusive content as of this writing. However, if a customer emails in and complains about it, you could ask for their user name and figure out in your DB if this user has indeed upgraded mid-month and reimburse them appropriately. Very old-school and not feasible for a big user base, but hopefully you won't have that many and can keep them happy.
EDITED
For the second question, Apple's auto-renewable subscription system does not technically offer upgradeable plans between different products.
Every subscription is a stand alone product and it's up to the user to turn on/off subscriptions manually using the Subscription Manager in the iTunes Store.
However if package A and package B offer the exact same content only different duration than what ajay_nasa said is correct, you can create an single auto-subscription product with different duration options. If the user is on 1 month subscription and then the user tries to change to 2-months subscription they will get the following error message asking them go to the App Store's subscriptions manager
So basically the ONLY place the user can actually change the subscription's length is in the App Store. Whether Apple decide to pro-rate the amount left on the old subscription or just append it to the current one is really up to Apple. You need to make sure the user have access to the subscription as long as it's active by reading the Original Purchase Date and Subscription Expiration Date field from each receipt entry and determining the start and end dates of the subscription.
Answering question 1, you can verify subscription receipts in the same way as other IAP, but you'll need to check it periodically to see if the subscription has expired (the verification will tell you if it's expired).
There is more info on the Apple docs here:
http://developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/StoreKitGuide/RenewableSubscriptions/RenewableSubscriptions.html
Actually, Apple's auto-renewable subscription system does offer upgradeable plans.
To achieve this we simply should add duration in existing Auto-Renewable Subscription. Every Auto-Renewable Subscription could be family of Subscriptions so whenever developer wants to achieve upgradation in subscription he should add duration in existing Auto-Renewable Subscription with different productID.
Whenever, user upgrade his plan in between the month then his upgrade plan will be automatically works from next month.
Answering to your question #1
Recently Apple launched a feature to enable server notification whenever the subscription is renewed. However, the subscription should be in-app.
See the links given below for your reference:
https://help.apple.com/itunes-connect/developer/#/dev0067a330b
&
https://itunespartner.apple.com/en/apps/news/45333106?sc_cid=ITC-AP-ENREC
We Need to Check Cancellation-Date provided in Receipt.

Auto-renewable subscription and non-consumable IAPs

I have a magazine app, and I want to provide users a one year auto-renewable subscription, and for non-subscribed users, they can use non-consumable IAPs to pay for each issue and then download it. What is the best way to implement it?
For auto-renewable subscription I don't think it's a problem. I can follow the tutorial at http://www.viggiosoft.com/blog/blog/2011/10/29/at-newsstand-and-subscriptions/ to finish this part. But for the non-consumable IAP part, I'm not sure. Do I need to add all the non-consumable IAPs for future issues before I submit the app? If I do this, how could Apple review my IAPs, because the future issues are not prepared at the reviewing time. Or, can I add non-consumable IAPs after my app is published to the App store? For example, every time when a new issue is ready in our server, we add a new non-soncumable IAP in iTC, and also set the product id to the issue in the server. When the non-subscribed user click that issue, the purchase for the specified product id will start. Is it possible?
After some research I found that the best way to implement it is to set up a new non-consumable IAP at each time when you want to publish a new issue.
The only problem is that, each IAP needs to be submitted for review, and before it is approved, the users who try to buy the issue will get an error message: "Cannot connect to the iTunes store". I haven't figured out how to know that the IAP is in review, so I can popup a nicer message like "Issue is review, please wait" other than a confusing error message.
I have a magazine app, and I want to provide users a one year
auto-renewable subscription, and for non-subscribed users, they can
use non-consumable IAPs to pay for each issue and then download it.
What is the best way to implement it?
You should accept your solution, but here is another case, maybe it helps you or others:
The subscribers can have they magazines, which are not in at iTunes Server, but at your hosting. Those magazines not need to bypass the apple review.
It depends whether you want a user to be able to permanently have a record stored in their app receipt of the issues they have bought. You might want this, if you want a user to be able to delete the app, with all associated content, then later re-install the app, and be able to download the specific back issues they purchased previously—all without having any user account on your own server. The use of a non-consumable in-app purchase also enables you to give them access to these issues across multiple devices that are signed in to that Apple ID, again without having to run your own user account-server combination to track purchased issues.
If these features don't matter to you, then there is a solution you could consider that is much simpler where you don't have to keep creating new in-app purchase products. Have a consumable in-app purchase product that is called something like Purchase One Issue. When a person buys this product, they get one credit and they can use this to select the issue they wish to be given access to. Your app then gives them access to that issue. You could also of course reverse this process in the UX: they pick the issue, click buy, you send them into the purchase process for the Purchase One Issue product, and you automatically give them access to the selected issue since they already selected it.
Note: consumable in-app purchases are not stored in the app receipt, so a user couldn't use this approach to 'restore previous purchases'. In scenarios where this is acceptable however, this is a much less labour intensive approach once set up.

Differentiating between initial buy and free "re-buy" in StoreKit/In-App Purchase

From the StoreKit guide:
If the user attempts to purchase a nonconsumable product or a renewable subscription they have already purchased, your application receives a regular transaction for that item, not a restore transaction. However, the user is not charged again for that product. Your application should treat these transactions identically to those of the original transaction.
This presents a huge problem in an app I am working on. We have licensed a large body of content from a publisher for sale through in-app purchase. They require that every time we sell a piece of this content (i.e. user pays us), our server calls an API on their servers to report the transaction. This is for accounting purposes and ultimately used to determine how much we pay them at the end of the month, per our agreement with them.
I have read several suggestions on SO and elsewhere about calling restoreCompletedTransactions rather frequently and maintaining a local understanding, on the device, of what the user has already purchased so they cannot be allowed to purchase it again. This to me seems like something that should be able to be implemented on the server side. However, the receipts that we are getting back from the Apple servers are exactly the same for a buy and a re-buy, as promised by the StoreKit guide.
If payment callbacks from StoreKit cannot be trusted as a valid accounting mechanism in this kind of situation ("you got paid" vs. "you didn't get paid"), what other real-time insights into transaction traffic are available? I don't think the publisher we are working with is going to be happy if we tell them we have to wait 45 days after the end of the month to get the REAL paid dollar amount out of iTunes Connect.
I have recently looked into the same problem. In my case, I wanted to implement accurate revenue tracking using Mobile App Tracking to track revenue generated from different customer acquisition campaigns.
Fortunately enough, there is a way to do it. It should be noted that SKPaymentTransactionStatePurchased vs. SKPaymentTransactionStateRestored solely depends on the initating action, e.g. whether you initiated a restore or a (re-)purchase, so that doesn't work.
What does work instead is checking for SKPaymentTransaction.originalTransaction which will be != nil for restores and re-purchases. The latter is unfortunately undefined behavior (docs). I'd consider a null check fair enough though.
Another option is to validate the transaction-receipt of transactions with SKPaymentTransactionStatePurchased and check that the original_transaction_id property in the returned, validated receipt matches the transaction_id.
The bad news is: In the current iOS version (4.3.x) there's no way to distinguish between a buy and a re-buy of non-consumable products.
To ease the situation I would recommend two things:
First
After a successful purchase, store the product identifier of the purchased product in the NSUserDefaults on the device. You can then hide the already purchased products from the user and thus handle a re-buy situation.
The NSUserDefaults are backed up by iTunes when the user synchronizes his device. So your stored purchase information is not lost when the user gets a new device.
Second
Store the receipt data together with the device ID on your server. Analyze the receipt's product identifier and the device ID.
If you receive another receipt with the same product identifier and device ID combination, then assume a re-buy. At least this would allow you to cover most of the re-buy cases.
Assuming that an ordinary iPhone user switches his device every 1-2 years, you will at least cover most of the re-buy cases and maybe apple will fix this in the future.
I have one solution,
Configure the product as consumable.
this will solve the problem - (They require that every time we sell a piece of this content (i.e. user pays us)).
Next you need to implement a logic in product buy option. It is in a way that once the user purchase a product the buy option need to remove otherwise the user may happendly go purchase and lost is cash once again for same product in same device.
you can use NSUserdefaults for this purpose.
thanks,

Resources