StatusUpdateNotification expiration_date discrepancy

Ok, so according to the official documentation the 'expires_date' receipt field is: "string, interpreted as an RFC 3339 date"

So, for example:

2019-03-12 04:25:03 Etc/GMT


In addition to this field, there is also an 'expires_date_ms' that conveniently contains the time as an epoch milli. Most of the time this works as expected.


However, when apple sends a StatusUpdateNotification, the 'expires_date' comes with the epoch milli, instead of the RFC date string. Here's an example:


{
  "latest_receipt": "<scrubbed-for-security>"
  "auto_renew_status_change_date": "2019-03-12 04:29:07 Etc/GMT",
  "environment": "Sandbox",
  "auto_renew_status": "false",
  "auto_renew_status_change_date_pst": "2019-03-11 21:29:07 America/Los_Angeles",
  "latest_receipt_info": {
    "original_purchase_date_pst": "2018-12-03 22:19:20 America/Los_Angeles",
    "quantity": "1",
    "unique_vendor_identifier": "AD9CD1B4-4015-4B36-AD0E-D053494B2821",
    "original_purchase_date_ms": "1543904360000",
    "expires_date_formatted": "2019-03-12 04:30:03 Etc/GMT",
    "is_in_intro_offer_period": "false",
    "purchase_date_ms": "1552364703000",
    "expires_date_formatted_pst": "2019-03-11 21:30:03 America/Los_Angeles",
    "is_trial_period": "false",
    "item_id": "1420610059",
    "unique_identifier": "519b03033933e6bd29fc9e4cbdef384311cc31f8",
    "original_transaction_id": "1000000481713552",
    "expires_date": "1552365003000",
    "transaction_id": "1000000509444546",
    "bvrs": "73",
    "web_order_line_item_id": "1000000043177104",
    "version_external_identifier": "0",
    "bid": "love.censio.Censio",
    "product_id": "love.censio.censio.censioplus.subscription.OneMonth",
    "purchase_date": "2019-03-12 04:25:03 Etc/GMT",
    "purchase_date_pst": "2019-03-11 21:25:03 America/Los_Angeles",
    "original_purchase_date": "2018-12-04 06:19:20 Etc/GMT"
  },
  "auto_renew_status_change_date_ms": "1552364947000",
  "auto_renew_product_id": "love.censio.censio.censioplus.subscription.OneMonth",
  "notification_type": "DID_CHANGE_RENEWAL_STATUS"
}


As you can see the expires_date now has the epoch. This make it really hard to reason with Apples payment systems.


Any ideas?

Replies

I believe you are looking at an error in the documentation or a different understanding of RFC 3339. All other references to "RFC 3339" do not also have the other, seemingly inconsistent phrase: "expressed as the number of milliseconds since..."


Here is the documentation:


Subscription Expiration Date

The expiration date for the subscription, expressed as the number of milliseconds since January 1, 1970, 00:00:00 GMT. ........

JSON Field Name expires_date JSON Field Value string, interpreted as an RFC 3339 date

Recommend you file a bug against the docs and another against the notification and see what comes back, adding your report #s to this thread for reference, thanks and good luck.

I found the exact same issue and I had to implement our own logic to address this inconsistent. So you can live with it, but it is not something unfixable.