IAP de renovación automática: campo last_receipt

When a user purchases a subscription, I store the receipt on completed transaction on the server alongside a key to identify the user the receipt belongs to. When the app needs to check if the subscription is still active, it queries the server, the server validates the receipt with Apple and returns info to my app wether the subscription is expired or not.

Ahora la pregunta es:

When the response returns a latest_receipt/_info field, the server should take that receipt and replace the old receipt for future verifications. What happens if there is a gap in the subscription period (e.g. the user subscribed for 1 month, then cancelled, then subscribed again) or the user changed the subscription type (e.g. from 1 month to 3 moths)?

Will the original receipt still validate, and return a latest_receipt/_info field, or do I need to store a new receipt from the new transaction?

I'm really confused on this auto-renewal thing right now, so I'm not even sure if my validation process is right.

preguntado el 03 de mayo de 12 a las 16:05

Im having even worse problems. Right now I am comparing the string the phone sent, with latest_receipt which i get back from apple.. and they are different. Furthermore, the phone always sends the same string, apple's latest_receipt is always different. Im really confused on how this process works :( -

1 Respuestas

I'm not sure about all possibilities you have to verify receipts and maybe it works your way, but we did slightly different and by that don't face your problem.

We store all the receipts on device-side (note that auto-renews result in new receipts as well). Whenever verification is necessary we post the latest device-stored receipt to server where it is verified by calling iTunes. After that the server responds to device about user's rights.

I think that's the way Apple recommends it (or at least this is how I understood Documentos de Apple).

contestado el 03 de mayo de 12 a las 17:05

Just to clarify: If you got a renewal receipt, or the user restores the subscription you take the transaction with the latest transactionDate, and only send that to the server to verify? - Era

No, we store just the latest and delete the older (as far as I remember, will have a look at my old code tomorrow) - Kai Huppmann

guys, im having horrible experience with iap. the receipt i get from the phone, and the latest_receipt coming back from apple are different in sandbox. why? - Cmag

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.