iOS In App Purchase Model - ios

I am having a problem trying to get the business model of my client to work with iOS in app purchases. We are using Parse.com as a backend for this app.
There are two type of users for this application consumers and posters. Posters are able to post an add for a business and the consumers are able to view those ads. The information for the ads are being stored in the Parse backend.
The problem that I am having is this.
The client wants to have 4 different durations for each ad 1 month 3 month 6 month and 1 year. I have set these up on the iTunes connect account as consumables because the duration it stored in Parse.
I can make the purchase the product just fine but the problem is that I have no way of tying a transaction to a specific add I can only determine which of the products (1 month, 3 month, etc that they bought) and the user can have multiple ads.
I also have the problem of since the ad information is stored on Parse I cannot invalidate it unless the user opens their device.

One way to solve this by making your in-app purchase an intermediate "currency" such as "credits" - The user then purchases a number of credits and when they post an ad it consumes the appropriate number of credits from their balance.
This way you do not need to associate a particular ad with a particular purchase - you simply verify the balance is sufficient for, say, a 3 month posting, deduct the credits from the balance and put the ad in the database with the appropriate duration field.

Related

For "Auto-Renewable Subscription", if I want to have more than one subscription in my product, how can I set things up?

Say I am developing a game.
I want to offer two different subscription memberships.
$5 monthly, VIP Basic: Can get 100 gems per day.
$9 monthly, VIP Advanced: Can get 300 gems per day.
Can I set up two subscription memberships?
What if the user purchase VIP Basic for 3 days and want to upgrade to VIP Advanced, does he/she have an option to upgrade or he/she has to wait for the first subscription to expire?
Thanks,
You can have multiple subscription options and your users can change their subscription preferences whenever they'd like. Although there are many different tutorials on the internet some things are recommended by almost everyone:
First things first you'll need to verify the subscriptions of your users by sending a receipt data to Apple's iTunes servers. Do NOT do it on the phone or locally. Do it on a web server of your own, preferably having HTTPS certificate.
Remember to store a user's subscription either locally or on a web server since Apple Review documents requires your users to have the edit option available to them in your app.
Users should have the restore option available to them as well. So don't forget to add that to your subscription integration.
When displaying your subscription prices and details do it by fetching their info from Apple. Don't add static texts or prices since review team will reject your app because of this.
Subscription prices can be changed for each country from Appstore Connect panel. Remember to adjust the prices based on certain countries economic state.
You can't test real subscription options on development environment thus you'll need to use some sandbox environment parameters. Don't forget to remove them when you are sending an update.
Lastly here is a good tutorial with example codes on how to add auto-renewable subscriptions to an app.

In app purchase Type to be used for below requirement

I am using In-app purchases in my app. After a user pays for a video, they can view it.
The problem is that I will have a huge list of videos on my server and price will vary for each video. So, every time when I post a video, do I need to add the video in iTunes Connect or is there an easier way?
A user can watch a video only a limited number of times (say 5 times) then the user needs to pay for the video again. How do I achieve this functionality? Use consumable and restore it after 5 times? Or, is there an approach for this?
Yes, you will have to create one product per consumable that you want to sell. After the user purchases the product, send the receipt to your backend and verify and store the purchase. Then notify your client and finish the transaction. You need to make sure you keep track of the consumables that your user purchased, this might be easier if you have a login system, otherwise, things get more complicated and you might need to create a restore and alias system with random user IDs. You can read more about how the system works here
Every time you start the app you would ask your server for the purchases that the specific user has made. That way you can programmatically figure out if the user can buy to watch the same video again and let it purchase another view.
It looks to me that what you are trying to achieve is not really scalable with the way the App Store IAPs are structured right now and I would really consider a subscription model rather than a consumable based app.
There's four types of In-App purchases and only Consumable fits your requirements.
You'd have to implement the logic to keep track of how many times a user can watch a given video and update this data whenever a user makes a purchase or watches a video. Ideally, you'd use a database (local or remote) to keep track of this data.
With this implementation, you would only need to register a new SKU when you want a new combination of price and number of views.
Here's an example of possible SKUs:
com.yourorganization.5dollars5views which lets a user view the selected video 5 times for $5
com.yourorganization.5dollars10views which lets a user view the selected video 10 times for $5
com.yourorganization.10dollars5views which lets a user view the selected video 5 times for $10

How to implement auto renewal subscription for in app purchase?

I am completely new to In App Purchases and need to implement a subscription based IAP to grant user access to my app on login.
My app contains two types of users:
Regular user
Business user
In my business user table, I plan to have a column for subscriptionPaid which holds a boolean value and another column for the expDate.
At a high level, my plan is to update these two columns every time a user renews their subscription. Then, when a business user logs in, in addition to checking username and password, I need to check if the subscriptionPaid bool is true.
I had a quick look but I'm wondering if there are events which are triggered when renewals occur whereby I can call my own webservice to update the subscriptionPaid col and the expDate col in my business user table? Is this the best way of implementing such a process?
I know in Android, there is a method getPurchases which a programmer could potentially call on login to my app and then if there is an active one for my app, I will call my update script there to update the subscriptionPaid and expDate fields in my DB. I will be coding in swift, so would need some swift equivalent of the android getPurchases if this option is a better choice?
And finally, Apple can be very strict at times so I am wondering if anyone has any experience or opinion on whether or not what I have described thus far, would fit the following criteria:
Auto-renewable subscriptions. Episodic content. Like non-consumable products, auto-renewable subscriptions remain available to the user indefinitely on all of the user’s devices. Unlike non-consumable products, auto-renewable subscriptions have an expiration date. You deliver new content regularly, and users get access to content published during the time period their subscription is active. When an
auto-renewable subscription is about to expire, the system automatically renews it on the user’s behalf.
This is the type of product I need. See all options below:
https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnectInAppPurchase_Guide/Chapters/CreatingInAppPurchaseProducts.html

3 Month free only on first installation

I need to implement a system where when the user install my app for the first time, he has 3 month of free use.
After three month the app has to show in-app purchase options.
I need to avoid that if the user remove and reinstall app, he can again use three month of free use.
I thought to use InApp purchase (a free, Non-Consumable item) to achieve my goal.
Using 'Non-Consumable' I have that 'SKPaymentTransaction *originalTransaction' contains the date of original transaction, so I can know If 3 month are expired or not and if the user reinstall or install the app in other devices, he can restore the remaining days using the same iTunes account.
Unfortunatly Apple reject the app using this reasons:
"
11.7: Apps that use IAP to purchase items must assign the correct Purchasability type
11.7
We found that the Purchasability Type for one or more of your In App Purchase products was inappropriately set, which is not in compliance with the App Store Review Guidelines.
'3 mese' is set to Non-Consumable. However, based on product functionality, it would be more appropriate to use the Non-Renewable Subscription In App Purchase type because the service offered by your application requires the user to make an advance payment to access the content or receive the service.
"
They suggest me to use Non-Renewable Subscription, but I dont have free price in Non-Renewable Subscription, so its useless for me.
In wich way I can achive my goal ?
Should I use KeyChain to store some identifier ?
But in this way the user will have 3 month in each device and I will not able to identifier uniquely on my server and, in addition, formatting the iphone he will have another 3 months of free use
Maybe in the app could I force the user to create an account on my server (or unsing parse.com for example) to have 3 month free ? Anyway the user could create several fake accounts except if I ask for personal data as phone number...but I think that Apple could reject the App if I ask personal data
What is the best choice be adopted in these cases?
For this I would firstly, create a back-end system. Possibly using Parse.com. Then I would register the users UDID when they sign up to the app. This way its the device that they have registered not just the app. Then create a code that will allow them to access the app but perform a check in the database on parse to see whether or not they are allowed the free content. If not, then show the payment options.

Multiple Non Renewable Subscription

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.

Resources