Verify consumable in-app purchase for Mac OS X on server side
Asked Answered
H

1

6

NOTE: This is for Mac OS X not iOS

I have a client app which will allow consumable in-app purchases. The receipts should be sent to the server where the server performs some operation when it gets an order. The operation the server performs costs me a bit of money so I need to be extra careful that the receipts are valid and only used once. I'm looking for the best way to design this.

It looks like I get the receipt from the storekit when the user completes the purchase. When I send that to my web server (running WCF) it will verify the receipt by posting the JSON to Apple. When Apple confirms the receipt it will do the operation that costs me a bit of money. During the verify receipt part my research tells me that a consumable receipt will always come up valid and is not actually "consumed". Am I supposed to just track every single receipt ever submitted to my server and make sure it hasn't been used? I will do everything I can to back up that list but I fear it getting lost at some point and am hoping for another way.

My other concern is that since consumable receipts are not recoverable via the storekit that if something happens like the user loses power right when the purchase is completed then the user won't get the product because there is no way of retrieving that receipt. Is that just a risk we have to take or am I overlooking something? It sounds like the only real difference between the consumable and non-consumable purchases is that you can't restore consumables.

Hard answered 20/2, 2012 at 18:13 Comment(1)
There is surprisingly little information on how to handle something like this. The best thing I can come up with is give the user some sort of "credits" when they buy consumable thing. The credits would need to be stored on the server side then to prevent tampering. If this is the way to do it I guess I would need to add some sort of user login/password unless there is a way to uniquely identify each installation (the base app is free so it has no receipt)Hard
H
1

I was able to talk to an Apple rep about this issue. They basically said there is no way to verify a consumable receipt on the server in the current version of their framework.

Hard answered 6/3, 2012 at 20:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.