The Apple documentation for server to server notifications does not specify what data format will come in the cancellation_date field. I'm trying to setup some unit tests for my notification handler but I'm not sure what data to put in my mock response.
I would assume that it is milliseconds since epoch but where other fields are noted in the documentation as being that, the cancellation_date field just reads, "The time and date that a transaction was cancelled by Apple customer support."
Can anyone confirm the date format that is in the cancellation_date field?
I did find this today:
if the receipt status is 21006 and there is a key named cancellation_date, then it’s a cancellation, you can find the new expiration date in that key but it’s a formatted date, if you need a better value to parse check for receipt['latest_expired_receipt_info']['cancellation_date_ms'] same as expires_date
Notification of cancellation of auto-renewal for an in-app purchase
I've also now confirmed this in production. There's a cancellation_date_ms
property of latest_expired_receipt_info
and also in the root of the notification itself. cancellation_date
is a formatted date string.
Here's a partial production notification:
{
"environment": "PROD",
"auto_renew_status": "false",
"latest_expired_receipt_info": {
"original_purchase_date_pst": "2018-01-25 11:59:25 America/Los_Angeles",
"cancellation_date_ms": "1517150504000",
"cancellation_reason": "0",
"original_purchase_date_ms": "1516910365000",
"expires_date_formatted": "2019-01-25 19:59:23 Etc/GMT",
"is_in_intro_offer_period": "false",
"purchase_date_ms": "1516910363000",
"expires_date_formatted_pst": "2019-01-25 11:59:23 America/Los_Angeles",
"is_trial_period": "false",
"expires_date": "1548446363000",
"cancellation_date": "2018-01-28 14:41:44 Etc/GMT",
"purchase_date": "2018-01-25 19:59:23 Etc/GMT",
"cancellation_date_pst": "2018-01-28 06:41:44 America/Los_Angeles",
"purchase_date_pst": "2018-01-25 11:59:23 America/Los_Angeles",
"original_purchase_date": "2018-01-25 19:59:25 Etc/GMT"
},
"cancellation_date_ms": "1517150504000"
}