I am up to build my first in-app purchase app. I would like to know whether there is a way to verify purchase on your server.
I have to build the whole user management, and I would like to know for all registered user what they already bought on their iOS devices, so that they get web app for free, or something like that. So, is there a way for me to check on Apple store side, if this user has already buy some product?
EDIT:
Scenario is like this:
User A buy app B on mobile device. After this I would like to check on my server (on my web page,...) if user A is bought app B, or (similar) which app was bought by user A.
I don't want to send message from mobile device to my server that user A buy app B, because users can reproduce this call on server even if they didn't buy app B.
I would check on server side whit app Store if user A bought app B.
I just released a simple Python/Django web app (In-App Purchase Receipt Verifier) that automatically handles the annoying part of this process (i.e., verifying the receipt on your server while maintaining cryptographic integrity). The code itself is relatively simple, but I figured others would appreciate not having to do the grunt-work here.
To use it, just make sure you have your app-specific shared secret ready to go, then go here and click "Deploy to Heroku". Your app will be up and running within a minute.
I've also included some sample code for how to use this web app to validate your receipts within your app. Using Swift 4:
Note: There are other solutions floating around on StackOverflow that suggest to do the validation completely within the app itself, but I'd highly recommend against that. From Apple's documentation in Receipt Validation Programming Guide:
Further improvements could probably be made to add some sort of cryptographic signature within the response header so that your app can check whether the response is safe, but I'll probably add that in a future release.Done :)For this you can use following things: 1. Make entries of users on your server along with purchase status. 2. Also you can use payment recipt provided by apple using store kit.
Also if you are using non-consumable product, then you just need a restore button for this. Please go through the apple's document for this. https://developer.apple.com/in-app-purchase/
Fetch the app's receipt (from the file at
[[NSBundle mainBundle] appStoreReceiptURL]
) and send it to your server. Then either…Parse the receipt and check its signature against Apple's certificate as described here (on your server, not in the app). Or,
Send the receipt (again, from your server) to the app store for validation as described here.
Server can verify receipt with App Store by Http Post. Please refer to https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html