I'm digging into iOS in-app purchase validation (server side) and I got pretty much confused about the receipt fields returned by apple's validation server. The documentation available here is not really clear (at least for me)
So here is a real (obfuscated) in-app purchase receipt returned by Apple's validation server
{
"receipt": {
"receipt_type": "Production",
"adam_id": XXXXXXX,
"app_item_id": XXXXXXXXX,
"bundle_id": "com.XXXXX.XXXXX",
"application_version": "XXXXXXXXX",
"download_id": XXXXXXXXXXXX,
"version_external_identifier": XXXXXXXXXXX,
"receipt_creation_date": "2019-10-15 14:01:41 Etc/GMT",
"receipt_creation_date_ms": "1571148101000",
"receipt_creation_date_pst": "2019-10-15 07:01:41 America/Los_Angeles",
"request_date": "2019-10-15 14:04:20 Etc/GMT",
"request_date_ms": "1571148260390",
"request_date_pst": "2019-10-15 07:04:20 America/Los_Angeles",
"original_purchase_date": "2018-11-27 18:28:48 Etc/GMT",
"original_purchase_date_ms": "1543343328000",
"original_purchase_date_pst": "2018-11-27 10:28:48 America/Los_Angeles",
"original_application_version": "XXXXXXXXX",
"in_app": [
{
"quantity": "1",
"product_id": "com.XXXXXXXXXX.XXXXX.XXXXXX",
"transaction_id": "XXXXXXXXXXX",
"original_transaction_id": "XXXXXXXXXX",
"purchase_date": "2019-10-15 14:01:41 Etc/GMT",
"purchase_date_ms": "1571148101000",
"purchase_date_pst": "2019-10-15 07:01:41 America/Los_Angeles",
"original_purchase_date": "2019-10-15 14:01:41 Etc/GMT",
"original_purchase_date_ms": "1571148101000",
"original_purchase_date_pst": "2019-10-15 07:01:41 America/Los_Angeles",
"is_trial_period": "false"
}
]
},
"status": 0,
"environment": "Production"
}
So my questions are:
- The fields starting with "original_purchase_date" represent a datetime but why they have a different value in the 2 parts of the receipt ?
- In the in_app part of the receipt, can the values of the fields starting with "purchase_date" and the values of the fields starting with "original_purchase_date" be different ? And if yes, in which case ?
- Is the "application_version" field contains the value of the current build version published of the app since the "original_application_version" field, according to the documentation, represent the build version of the app the user used to make the purchase ?
Thanks a lot for your help and answers.