I am working on adding subscription to my iOS app and I came across some very annoying inconsistencies:
My server is listening for the DID_CHANGE_RENEWAL_STATUS
notification from Apple:
{
"auto_renew_status_change_date": "2019-06-05 13:42:43 Etc/GMT",
"environment": "Sandbox",
"auto_renew_status": "false",
"auto_renew_status_change_date_pst": "2019-06-05 06:42:43 America/Los_Angeles",
"latest_expired_receipt": "ewoJIn...",
"latest_expired_receipt_info": ⊖{
"original_transaction_id": "10000001010101010",
"expires_date_formatted": "2019-06-05 13:43:13 Etc/GMT",
...
},
"password": "xxxxxxxxx",
"auto_renew_status_change_date_ms": "1559742163000",
"auto_renew_product_id": "com.my.product",
"notification_type": "DID_CHANGE_RENEWAL_STATUS"
}
During my tests the notification contained in almost all cases a latest_expired_receipt
and a latest_expired_receipt_info
.
BUT some message contained latest_receipt
and a latest_receipt_info
instead. Beside this difference the structure of the messages was identical ("auto_renew_status": "false"
, auto_renew_status_change_date
before the expires_date_formatted
, etc.)
Does Apple change the structure randomly to make implementing subscription even more enjoyable or is there any logic on when which structure is used?
Of course I can simply adapt my server code to check if latest_receipt
OR latest_expired_receipt
is available but this would be a quick and dirty solution. I would prefer to understand when to expect which content/structure...