Process products outside app ( Play Billing ) - in-app-purchase

Can I process subscriptions and non-consumable products after purchase. I want process it outside my app?
Such as acknowledge of products or consume some product?
Because sometimes problems will happened inside app like lost connection or user not enter to the app even I can process purchases.

Google does not allow you to do it in most cases
https://support.google.com/googleplay/android-developer/answer/9858738?hl=en

Related

IOS Preventing Duplicate Purchases

Let's say I have an iOS app that allows users to upload photos. I want to offer an in-app purchase that will perform processing on the image and store an 'upgraded' version of it.
Both the original and upgraded image will be associated with the user in my database.
I want to prevent the following scenario:
user buys the upgrade via in-app purchase
image processing server is unavailable
confused user quits the app and tries to purchase again
user is double charged and still hasn't received their processed image
Is there any way to totally prevent a repeat purchase? It seems like I can't simply make the 'upgrade' product a non-consumable. I would quickly reach the 10,000 sku limit. If I raised an alert warning "your purchase is being processed", it seems like my users could just ignore it, close the app, and try the purchase again.

Can Apple tell me what purchases a user has?

I'm aware of the restore functionality and have implemented it in my apps before, but still has holes in it.
I'm trying to display customized screens based on what apps the user have. Without user interaction, I want to be able to ask apple to retrieve me the in-app purchases that belong to that user for this app?
Other posts mention that I should always keep track of that via calling methods like:
NSUserDefaults.StandardUserDefaults.BoolForKey
But at the same time considers it insecure.
I am currently storing the info in DB. That's easy, but consider the following scenario:
User downloads the app. My DB records that user has 0 in-app purchases. The user later purchases 1 in-app purchase. My DB records that too.
User deletes the app for whatever reason
After a while, he re-downloads the app. My DB at this point starts a fresh and records that the user 0 purchases.
the user sees the in-app purchase (he already bought) and clicks on purchase again.
Here, my execution flow stops and apple picks up... Apple alerts the user that he has already bought the in-app and offers to get it for free.
That message is for the benefit for the user only, and my app is unaware of that. I haven't been able to find a call to apple asking what purchases a user had made for my app? I too, wouldn't want the user to pay again, but be able to always know what purchases he has made in the past at any given point. Why is that information so sealed at apple side? They alrady know the user has may app and I am only asking about in-app purchases in that app.
I am using Xamarin.
You need to refresh the receipt file and then scan through it. It will list all purchases the user has made inside that app, whatever device it was on. This code will let you parse the file and see the purchases made: https://github.com/rmaddy/VerifyStoreReceiptiOS
You could simply make your database store account information the user creates when they want to purchase something from your in-app extras. So in order to make that purchase they have to create a username and password for your app, thus giving you a way to keep track of who owns what in app content without having to ask apple.

Is it possible to offer Apple's In App Purchases on an app that offers multiple user log-ins

We're designing an iPad app at the moment which offers in-app purchases for non-consumable items.
As the scope of the project has expanded, we want to allow the option to sign in to an account, and then sign out of that account and into another - similar to how one could on an app like the Facebook app.
My question is: is it possible to link Apple's in-app purchases to one of our system's user accounts, so that a User may sign in to a different device and access their purchases, but if another User signs in to my device, they cannot access my purchases (despite the device being signed in to my Apple ID)?
Any suggestions welcome
All completed in app purchases are tied to the Apple ID that was used at the time of the transaction. Since non-consumable in app purchases can only be purchased once, you can't use those. So, the only option would be to use consumable in app purchases and keep track of which system user account made the purchase. You need to store those purchase records on an external server somewhere though, since Apple will have no way of telling you which purchase went to which of your internal users. If you lose that purchase history your users will have to buy the item again, and probably not be very happy.

Purchase non-consumable in app feature multiple times

not sure if this pass as a Stackoverflow question (close if not).
The problem we're facing at the moment is we have an app that we want to allow user to pay to unlock additional content space so they can create more content but be able to purchase multiple copies of that item without being charged twice unless they've exceeded what they've initially purchased.
So a concrete example is this:
Think of a item bag in World of Warcraft that lets user carry more items. (Our app isn't a game but it's the same concept). Users can buy many copies of the bag and at the same time, it doesn't matter if the user log into the app from their home computer or another computer, the bags are still tied to their account.
I'm aware that I have two options really:
Non-Cosumable In App Purchase
User buys the in app purchase item once but does not buy another copy. In other words, they can only ever have 1 copy of that item, not 10 or 20 copies (which our business logic requires in this case).
Consumable In App Purchase
Allows purchasing multiple copies of the item BUT they are non-transferable purchases. This would mean users would need to pay for the same item again even if they bought a new iPad, they can't transfer those "bags" to the new iPad or if they delete the app and reinstall the app, they would still need to pay for those items again.
Subscription based in app purchase doesn't exactly fit our model.
So is there a special type of non-consumable in app purchase but allows the user to buy multiple copies of that item/feature?
Additional Considerations
We do not have a third party server to track users and the number of copies of that item/feature they unlocked.
It also doesn't make sense to make a hundred copies of the in app purchase in iTunes Connect manually.
I think only making a consumable in app purchase is our only option. We're reluctant to force to user to have to pay for unlocking the same content twice but at the same time don't want users to be able to keep creating additional "bags" for free.
If user purchases a non-consumable purchase twice, I am sure Apple store has mechanism to prevent the purchase.
Instead, it would simply say: You have already purchased this product. It will be downloaded again. You will get all the delegates being called normally, and content delivery will happen as per what you have coded, but the customer will not be charged.
To avoid the payment flow, you can store the purchased item under itunes user's keychain, too.

How to detect if user has made any in-app purchases?

My iOS app has in-app purchases (consumable) and shows ads periodically. The idea is to remove ads after user has purchased anything. But in-app items are consumable, so after user re-installs the app, I would be unable to determine if he has purchased anything using [[SKPaymentQueue defaultQueue] restoreCompletedTransactions];, right? And I would bomb him with ads again...
What would you suggest to find out that the user has purchased anything already?
Well when a user re-installs your app (i.e. delete it and install it again) there is no immediate way of knowing what purchases did he made. That's why Apple requires your app to provide a way to restore previous purchases so that when the user performs this operation he restores these purchases for free.
For consumable items you might need to use a server for managing the purchases such that when the app loads it checks with the server which purchases the user has made and immediately enable the relevant content.
I do not know if mandatory but "Remove Ads" IAP should be non-consumable so the user will only need to purchase it once (Otherwise I believe users will complain or just won't buy it).
Some creative ways can be found here : iPhone - in-App purchase consumable correct approach
As an improvement on the situation, you could store the fact that a purchase was made in NSUserDefaults. That won't survive if the user uninstalls and reinstalls the app, but at least it survives if the user buys a new phone and restores a backup to transfer everything to the new phone.
You could have a look at Cloud Kit as well, which would store information per AppleId. It's a bit overkill for the problem, but it means you can use Apple's servers instead of your own for free. There would be a difference that if a user installs your app on six devices, makes a consumable purchase on one device, ads will stop on all of them.

Resources