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.
Related
I want to get purchase or purchases made by the user even if purchased from other devices.
When an in-app purchase is purchased on one device, it is marked as a purchase by the user. So, a non-consumable purchase is available on all devices owned by the user after a single purchase.
If you create a consumable purchase and handle it using the login of your app, you should be able to do this. Of course, Apple's review process will check whether this is fair by the user.
Right now i'm allowing multiple in app purchases. 3 month subscription, etc. But i cannot get a renewable purchase because apple wont allow it. So currently when a user goes to buy another 3 month subscription it gives the message that they've already purchases this item and wont allow them to purchase it again. I figure this has something to do with the product id? Is there a way to allow this not to happen and purchase the same product with the same product id multiple times? Thanks for the help!
Your product is not a non consumable product it is Non-Renewing Subscriptions instead. For further detail check check this link and go to Types of In-App Purchases this section.
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.
I am working with InApp purchase, so I have implemented a working model,I have referred this
link http://xcodenoobies.blogspot.in/2012/04/implementing-inapp-purchase-in-xcode.html.
Here when the user purchases an item I store some value in KeyChain and I cross check with this value to confirm that the user has purchased the item and if not I will ask the user to purchase the item.
This works, but I have 4 products available for purchase, which can be purchased individually, So I thought of creating different instances of KeyChain and storing different passwords for these 4 products and cross check, but keyChain can only save one username and password.
So I want to know what can be the alternative for this.Also NSUserdefaults will not work, because it is tied to the App bundle and whenever user deletes the app, the data is lost and so he will be asked to purchase again.
Regards
Ranjit
If you're adding a restorable in-app purchase (non-renewable subscription, free subscription or non-consumable product), then the Store Kit API already provides the "restore transaction" functionality for you: http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/StoreKitGuide/MakingaPurchase/MakingaPurchase.html
In your UI, you need add a "Restore purchases" button to your product screen that calls the restoreCompletedTransactions method. This is important because Apple might reject your app if you don't provide this button.
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.