Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IPHONE in-app purchase: is it possible to verify a receipt without using an external server?

I have a receipt of a recorded transaction stored by the application when the transaction was done and I would like to ask apple's servers if this receipt is valid.

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

like image 444
Duck Avatar asked Dec 30 '22 14:12

Duck


2 Answers

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

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

Perhaps it's just me, but it seems like you are asking to contact a server without contacting a server, which is quite impossible I'm afraid.

like image 178
Matthew Scharley Avatar answered Jan 01 '23 04:01

Matthew Scharley


As far as I know, there are few json service provided by Apple:

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

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

You can call them sending your receipt:

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

And it returns the answer:

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

I assume you can make a direct call to the service within your iPhone app OR you can call your own server script that work as a proxy to the Apple service. It depends on your app logic. If you need to check the receipt on your server (IE. to authorize a download) you should call your server script otherwise you can verify the receipt directly from the app.

Doc reference: http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/StoreKitGuide/VerifyingStoreReceipts/VerifyingStoreReceipts.html

like image 28
lomanf Avatar answered Jan 01 '23 03:01

lomanf