Restore in-app purchase after a set of time - ios

I have created a consumable in-app purchase which enables some images, texts, sound etc. These things should only be available for the user for 4 hours. After that time the same purchase should be available for purchase as normal. My question is how to cancel or restore (or what it's called) the products they buy. Thanks in advance.

I am pretty sure that consumable in app purchase can't be restored. Once they are purchased they are "consumed". If you want to let the user restore purchases for 4 hours after purchase you will need to manually do that yourself. I do something similar to this using Parse (parse.com). When a user makes a purchase it is easy to record that purchase on parse and then I can easily query parse for all purchases a user has made.

Related

iOS IAP for limited purchase count of an item. Consumable or not?

If we provide a limited purchasable item to a user, ie 'you can purchase the limited jewel only 3 times', which one is more Apple IAP guideline friendly?
register one Consumable item ('limited jewel': $0.99) and check transaction counts.
register three Non-consumable items (limited jewel 1/2/3) and provide the next purchasable item for each purchase.
or, either looks fine?
Depends on what the user can do with those jewels. If an item can be used once and then it is gone, it is a consumable. If it can be reused over and over, it is a non-consumable.
Consumable
Users can purchase different types of consumables, such as lives or gems in a game, to further their progress through an app. Consumable in-app purchases are used once, are depleted, and can be purchased again.
Non-Consumable
Users can purchase non-consumable, premium features within an app. Non-consumables are purchased once and do not expire, such as additional filters in a photo app.
Source
I suggest you should use the "Consumable" type IAP, it complies with Apple Guideline because it will buy many times. The Non-consumable just use for one time.
After it reaches the third time, you can hide this feature, or prevent the user continue buying.

State of in-app purchases in ios

I have a bunch of non-consumable and auto-renewable in-app purchases in my app. I want to know if the user has already purchased the app when I visit the in-app purchases. Is there a way to know this?
You might want to implement a solution for this problem by storing the purchases of a user and their purchase receipts on your server.
So before showing products to a user, you can ask your server about which products user has purchased. And accordingly handle the interaction from there on.
P.S. :- Ideally you would not want to hide the already purchased products from a user as he might upgrade and then if he would want to downgrade back to same product then that won't be visible or vice versa.

iOS: Can i create my own store with consumable in-app purchase?

i want to build the app and it has consumable in-app purchase feature.
Users can buy coins (consumable in-app purchase), and spend their coins to buy some virtual goods.
The question is, can i build my own store for them to spend their coins?
Every item has each price, users tap on it to buy and pay with coin. All those items on this store can be remote updated online by me, i can change the price, data, add new item every time i want.
So will it fit with Apple policies? Or each item on my store have to be approved by Apple?
And if it works, when user switch the device (change their phone) , how can i do the restore purchase feature?
AS long as your user buy coins, what he does with it is not the matter of Apple. A good example is Free-2-Play games like "Clash of Clans". You only have to create an inApp for each pack of coins you want to sell.
In short, you have to store the coins credit of each user on server side and restore it when your user is authenticated.
If you need a simple solution without any server of yours, I recently used Parse (parse.com) that let you have a database without having your own server.

How to guarantee that a consumable in-app purchase will be completed?

I have been working with non-consumable in-app purchases until now and I'm going to use consumables in my next app.
In this new app, I have a lot of items, costing the same price, so, when the user buy one of them, I will use the same in app purchase, and save what item was bought on my server.
Here is the "problem", how can I guarantee that the transaction gonna be completed, no only in my case, but in any in-app purchase, if I have no "restore" option for this kind of IAP?
e.g: The user buys something, and right before my "unlockFeature" method the app crashes. How can I have sure that my user gonna get what he bought?

iOS InApp Purchase

I just wonder if there is anyway to check if a user(email) already buy an in app purchase item in my application.
For example I buy an item on my iPhone, then I log in on my iPad with same itune account. the application will know that this user did buy the item.
Thanks,
Huy
The same thing is happening when you use the restore purchased option in many applications.
SKPaymentTransactionStateRestored
is the constant retrieved from server when you tries to purchase an already purchased item.
Please check this nice tutorial about inApp purchase : inApp purchases
From the In-App Purchase Programming Guide:
Store Kit provides built-in functionality to restore transactions for
non-consumable products, auto-renewable subscriptions and free
subscriptions.
You can restore purchases with the StoreKit framework by calling the restoreCompletedTransactions method of the SKPaymentQueue. Your app will then receive a transaction for each product the user has previously purchased. Simply handle these transaction and unlock the features and/or download content on the new device.
If your product is a consumable (gold coins for your game, health packs etc.) this would not apply and you have to keep track of the purchases on your own.
You will need to set up a server that will keep track of each transaction. And you need to implement a method to authenticate the user across devices (signup via e-mail, Facebook login etc.). Once the user logs in on a new device, your server can tell the app what it should unlock/download.

Resources