3 Replies
      Latest reply on Mar 17, 2019 8:41 AM by jackywxd
      wellington-censio Level 1 Level 1 (0 points)

        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?