Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the format of the cancellation_date field in Apple IAP receipt / status notifications

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?

like image 691
jmichas Avatar asked Oct 20 '25 18:10

jmichas


1 Answers

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" }

like image 79
siburb Avatar answered Oct 22 '25 10:10

siburb



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!