Closed vincentwyshan closed 7 years ago
There is latest_receipt
attribute in the response. (response.latest_receipt
)
You also can access to the original value using response._latest_receipt_info
@youknowone
latest_receipt
and latest_receipt_info
are two different things. latest_receipt
is the base64 encoded raw receipt data. latest_receipt_info
is a JSON array of transactions (the interesting stuff).
Also, the in_app
array and the resulting last_in_app
field seem to be useless, since it currently only contains the first (original) transaction.
For the most recent transaction (e.g. for auto renewal validation), you need to get the last item of the latest_receipt_info
array.
Another thing: when accessing the original value via response._latest_receipt_info
, as you suggested, the following warning is emitted:
Given key `latest_receipt_info` is not in __WHITELIST__. It maybe a wrong key.
Check raw data `_` for real receipt data.
I'm sorry, you are right. I want to suggest a proper encapsulation of the data and remove the warning. But becasue I haven't develop any IAP related code for recent days, I have no idea how to treat the field.
Would you mind to help me by one of the following ways?
latest_receipt_info
field. Fully masked data is ok. I need only keys to run tests. (This will be the best way because I need to add test code for future regression)@youknowone Thanks! I'm not sure if #42 does fix the issue. I think you changed the behaviour of Response.latest_receipt
. I would suggest to add latest_receipt_info
as an additional property.
Also, the old Response.latest_receipt
did not return a proper value in first place, I think. As I wrote it's a base64 encoded string, but you wrap it in a Receipt object.
The latest_receipt_info
would be an array of InApp objects, just like the in_app
array.
Here is a stripped down response from the itunes API:
{
"status": 0,
"environment": "Sandbox",
"receipt": {
"in_app": [
...
]
},
"latest_receipt_info": [
...
],
"latest_receipt": "..."
}
I'll also send you a complete json response via email.
Thanks, I received your email. I will make a test based on it.
@jox I recreated PR42 and you can check the user interface in test file.
https://github.com/youknowone/itunes-iap/pull/42/files#diff-646101d2b0ebe1547f26765ac5626f8bR34
A new version is released with fix. Thank you all!
Following the Official Document: https://developer.apple.com/library/content/releasenotes/General/ValidateAppStoreReceipt/Chapters/ReceiptFields.html#//apple_ref/doc/uid/TP40010573-CH106-SW1
There should be a latest_receipt_info data in response, but we can't directly get this attribute from the response