IPHONE in-app purchase: can I verify receipt without using an external server?

I have a registered transaction receipt saved by the application when the transaction was completed, and I would like to ask Apple servers if this receipt is valid.

Is there any way to do this without using an external server ?

+4
source share
4 answers

this case is resolved. This can be done using only iphone.

+1
source

I would like to ask Apple servers if this receipt is valid.

Is there any way to do this without using an external server?

Perhaps this is just me, but it looks like you are asking to contact the server without accessing the server, which is completely impossible, I'm afraid.

+6
source

As far as I know, Apple has several json services:

One for the Sandbox In App (before serving):
https://sandbox.itunes.apple.com/verifyReceipt

One for the App Store version:
https://buy.itunes.apple.com/verifyReceipt

You can call them by sending a receipt:

{ "receipt-data" : "(actual receipt bytes here)" } 

And he returns the answer:

 { "status" : 0, "receipt" : { ... } } 

I assume that you can make a direct call to the service in your iPhone application or you can call your own script server, which acts as a proxy for the Apple service. It depends on your application logic. If you need to check the receipt on your server (IE., To allow the download), you must call your server script, otherwise you can check the receipt directly from the application.

Link to the document: http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/StoreKitGuide/VerifyingStoreReceipts/VerifyingStoreReceipts.html

+2
source

To clarify:

  • Only Apple server can provide information about the validity of the transaction receipt. Indeed, you need to contact this server even just to find out if the product continues to remain active (or if the user has unsubscribed).
  • On the Internet, it seems that this is not at all, or at least not safe, perhaps contact this Apple server simply through HTTP-POST from your application. Everyone seems to be convinced that you need a web server that communicates with your application and that you should only access the Apple server from your web server.

However, Apple even provides an implementation code (I would like it to be found earlier) on how to safely contact the verification server without another web server: http://developer.apple.com/library/ios/#releasenotes/StoreKit/ IAP_ReceiptValidation / _index.html This implementation is similar to what Lomanf talked about, in more detail and with all the security needed to work with iOS 5.x. So the answer is definitely: Yes.

+1
source

All Articles