苹果支付最新变化:苹果普通内购支付和会员订阅支付凭证数据混合返了

今天发现线上简影APP购买金币的功能在用户支付成功后未充金币成功,查看日志发现苹果把普通内购数据和会员订阅数据凭证放在一起返回了,导致存储凭证的字段长度超过设计长度,存储失败。印象中原先普通内购的凭证解密后in_app中只有一条记录,直接取第一条处理就行;订阅的凭证解密后in_app一般会有多条记录(包括历次购买的),一般只会取最新的一条处理。

原先金币购买的凭证解密后是这样的:

{
    "receipt":{
        "receipt_type":"ProductionSandbox",
        "adam_id":0,
        "app_item_id":0,
        "bundle_id":"com.jyys.jianmovie",
        "application_version":"3.53",
        "download_id":0,
        "version_external_identifier":0,
        "receipt_creation_date":"2019-12-25 04:00:41 Etc/GMT",
        "receipt_creation_date_ms":"1577246441000",
        "receipt_creation_date_pst":"2019-12-24 20:00:41 America/Los_Angeles",
        "request_date":"2019-12-25 04:00:44 Etc/GMT",
        "request_date_ms":"1577246444512",
        "request_date_pst":"2019-12-24 20:00:44 America/Los_Angeles",
        "original_purchase_date":"2013-08-01 07:00:00 Etc/GMT",
        "original_purchase_date_ms":"1375340400000",
        "original_purchase_date_pst":"2013-08-01 00:00:00 America/Los_Angeles",
        "original_application_version":"1.0",
        "in_app":[
            {
                "quantity":"1",
                "product_id":"com.jyys.jianmovie.35gold",
                "transaction_id":"1000000608708592",
                "original_transaction_id":"1000000608708592",
                "purchase_date":"2019-12-25 04:00:41 Etc/GMT",
                "purchase_date_ms":"1577246441000",
                "purchase_date_pst":"2019-12-24 20:00:41 America/Los_Angeles",
                "original_purchase_date":"2019-12-25 04:00:41 Etc/GMT",
                "original_purchase_date_ms":"1577246441000",
                "original_purchase_date_pst":"2019-12-24 20:00:41 America/Los_Angeles",
                "is_trial_period":"false"
            }
        ]
    },
    "status":0,
    "environment":"Sandbox",
    "sandbox":"1"
}

现在普通内购凭证解密后变成这样的了:

{
    "receipt":{
        "receipt_type":"Production",
        "adam_id":1326705989,
        "app_item_id":1326705989,
        "bundle_id":"com.jyys.jianmovie",
        "application_version":"3.46",
        "download_id":30042550032613,
        "version_external_identifier":833263004,
        "receipt_creation_date":"2019-12-09 03:44:34 Etc/GMT",
        "receipt_creation_date_ms":"1575863074000",
        "receipt_creation_date_pst":"2019-12-08 19:44:34 America/Los_Angeles",
        "request_date":"2019-12-25 04:04:21 Etc/GMT",
        "request_date_ms":"1577246661522",
        "request_date_pst":"2019-12-24 20:04:21 America/Los_Angeles",
        "original_purchase_date":"2018-07-10 17:23:18 Etc/GMT",
        "original_purchase_date_ms":"1531243398000",
        "original_purchase_date_pst":"2018-07-10 10:23:18 America/Los_Angeles",
        "original_application_version":"1.7",
        "in_app":[
            {
                "quantity":"1",
                "product_id":"com.jyys.jianmovie.35gold",
                "transaction_id":"100000613965493",
                "original_transaction_id":"100000613965493",
                "purchase_date":"2019-11-23 16:05:20 Etc/GMT",
                "purchase_date_ms":"1574525120000",
                "purchase_date_pst":"2019-11-23 08:05:20 America/Los_Angeles",
                "original_purchase_date":"2019-11-23 16:05:20 Etc/GMT",
                "original_purchase_date_ms":"1574525120000",
                "original_purchase_date_pst":"2019-11-23 08:05:20 America/Los_Angeles",
                "is_trial_period":"false"
            },
            {
                "quantity":"1",
                "product_id":"com.jyys.jianmovie.monthvipsubscription",
                "transaction_id":"100000517858316",
                "original_transaction_id":"100000517858316",
                "purchase_date":"2019-02-03 23:33:02 Etc/GMT",
                "purchase_date_ms":"1549236782000",
                "purchase_date_pst":"2019-02-03 15:33:02 America/Los_Angeles",
                "original_purchase_date":"2019-02-03 23:33:02 Etc/GMT",
                "original_purchase_date_ms":"1549236782000",
                "original_purchase_date_pst":"2019-02-03 15:33:02 America/Los_Angeles",
                "is_trial_period":"false"
            },
            {
                "quantity":"1",
                "product_id":"com.jyys.jianmovie.monthvipsubscription",
                "transaction_id":"100000527487209",
                "original_transaction_id":"100000527487209",
                "purchase_date":"2019-03-05 23:41:20 Etc/GMT",
                "purchase_date_ms":"1551829280000",
                "purchase_date_pst":"2019-03-05 15:41:20 America/Los_Angeles",
                "original_purchase_date":"2019-03-05 23:41:20 Etc/GMT",
                "original_purchase_date_ms":"1551829280000",
                "original_purchase_date_pst":"2019-03-05 15:41:20 America/Los_Angeles",
                "is_trial_period":"false"
            },
            {
                "quantity":"1",
                "product_id":"com.jyys.jianmovie.monthvipsubscription",
                "transaction_id":"100000540745048",
                "original_transaction_id":"100000540745048",
                "purchase_date":"2019-04-17 04:08:21 Etc/GMT",
                "purchase_date_ms":"1555474101000",
                "purchase_date_pst":"2019-04-16 21:08:21 America/Los_Angeles",
                "original_purchase_date":"2019-04-17 04:08:21 Etc/GMT",
                "original_purchase_date_ms":"1555474101000",
                "original_purchase_date_pst":"2019-04-16 21:08:21 America/Los_Angeles",
                "is_trial_period":"false"
            },
            {
                "quantity":"1",
                "product_id":"com.jyys.jianmovie.monthvipsubscription",
                "transaction_id":"100000550562750",
                "original_transaction_id":"100000550562750",
                "purchase_date":"2019-05-17 13:25:22 Etc/GMT",
                "purchase_date_ms":"1558099522000",
                "purchase_date_pst":"2019-05-17 06:25:22 America/Los_Angeles",
                "original_purchase_date":"2019-05-17 13:25:22 Etc/GMT",
                "original_purchase_date_ms":"1558099522000",
                "original_purchase_date_pst":"2019-05-17 06:25:22 America/Los_Angeles",
                "is_trial_period":"false"
            },
            {
                "quantity":"1",
                "product_id":"com.jyys.jianmovie.monthvipsubscription",
                "transaction_id":"100000560413882",
                "original_transaction_id":"100000560413882",
                "purchase_date":"2019-06-17 10:40:47 Etc/GMT",
                "purchase_date_ms":"1560768047000",
                "purchase_date_pst":"2019-06-17 03:40:47 America/Los_Angeles",
                "original_purchase_date":"2019-06-17 10:40:47 Etc/GMT",
                "original_purchase_date_ms":"1560768047000",
                "original_purchase_date_pst":"2019-06-17 03:40:47 America/Los_Angeles",
                "is_trial_period":"false"
            },
            {
                "quantity":"1",
                "product_id":"com.jyys.jianmovie.monthvipsubscription",
                "transaction_id":"100000571824950",
                "original_transaction_id":"100000571824950",
                "purchase_date":"2019-07-21 17:26:17 Etc/GMT",
                "purchase_date_ms":"1563729977000",
                "purchase_date_pst":"2019-07-21 10:26:17 America/Los_Angeles",
                "original_purchase_date":"2019-07-21 17:26:17 Etc/GMT",
                "original_purchase_date_ms":"1563729977000",
                "original_purchase_date_pst":"2019-07-21 10:26:17 America/Los_Angeles",
                "is_trial_period":"false"
            },
            {
                "quantity":"1",
                "product_id":"com.jyys.jianmovie.monthvipsubscription",
                "transaction_id":"100000582063905",
                "original_transaction_id":"100000582063905",
                "purchase_date":"2019-08-21 05:50:22 Etc/GMT",
                "purchase_date_ms":"1566366622000",
                "purchase_date_pst":"2019-08-20 22:50:22 America/Los_Angeles",
                "original_purchase_date":"2019-08-21 05:50:22 Etc/GMT",
                "original_purchase_date_ms":"1566366622000",
                "original_purchase_date_pst":"2019-08-20 22:50:22 America/Los_Angeles",
                "is_trial_period":"false"
            },
            {
                "quantity":"1",
                "product_id":"com.jyys.jianmovie.monthvipsubscription",
                "transaction_id":"100000600660696",
                "original_transaction_id":"100000600660696",
                "purchase_date":"2019-10-15 18:39:33 Etc/GMT",
                "purchase_date_ms":"1571164773000",
                "purchase_date_pst":"2019-10-15 11:39:33 America/Los_Angeles",
                "original_purchase_date":"2019-10-15 18:39:33 Etc/GMT",
                "original_purchase_date_ms":"1571164773000",
                "original_purchase_date_pst":"2019-10-15 11:39:33 America/Los_Angeles",
                "is_trial_period":"false"
            },
            {
                "quantity":"1",
                "product_id":"com.jyys.jianmovie.monthvipsubscription",
                "transaction_id":"100000617153151",
                "original_transaction_id":"100000617153151",
                "purchase_date":"2019-12-02 05:34:02 Etc/GMT",
                "purchase_date_ms":"1575264842000",
                "purchase_date_pst":"2019-12-01 21:34:02 America/Los_Angeles",
                "original_purchase_date":"2019-12-02 05:34:02 Etc/GMT",
                "original_purchase_date_ms":"1575264842000",
                "original_purchase_date_pst":"2019-12-01 21:34:02 America/Los_Angeles",
                "is_trial_period":"false"
            }
        ]
    },
    "status":0,
    "environment":"Production"
}

最后又顺便检查了下订阅支付的凭证并无变化,附一条解密后的订阅支付的凭证样例:

{
    "receipt":{
        "receipt_type":"Production",
        "adam_id":1326705989,
        "app_item_id":1326705989,
        "bundle_id":"com.jyys.jianmovie",
        "application_version":"3.53",
        "download_id":30055199738257,
        "version_external_identifier":833862787,
        "receipt_creation_date":"2019-12-25 04:48:05 Etc/GMT",
        "receipt_creation_date_ms":"1577249285000",
        "receipt_creation_date_pst":"2019-12-24 20:48:05 America/Los_Angeles",
        "request_date":"2019-12-25 04:48:11 Etc/GMT",
        "request_date_ms":"1577249291367",
        "request_date_pst":"2019-12-24 20:48:11 America/Los_Angeles",
        "original_purchase_date":"2019-09-01 14:13:31 Etc/GMT",
        "original_purchase_date_ms":"1567347211000",
        "original_purchase_date_pst":"2019-09-01 07:13:31 America/Los_Angeles",
        "original_application_version":"2.91",
        "in_app":[
            {
                "quantity":"1",
                "product_id":"com.jyys.jianmovie.monthvipsubscription",
                "transaction_id":"100000585820396",
                "original_transaction_id":"100000585820396",
                "purchase_date":"2019-09-01 14:24:33 Etc/GMT",
                "purchase_date_ms":"1567347873000",
                "purchase_date_pst":"2019-09-01 07:24:33 America/Los_Angeles",
                "original_purchase_date":"2019-09-01 14:24:33 Etc/GMT",
                "original_purchase_date_ms":"1567347873000",
                "original_purchase_date_pst":"2019-09-01 07:24:33 America/Los_Angeles",
                "is_trial_period":"false"
            },
            {
                "quantity":"1",
                "product_id":"com.jyys.jianmovie.monthvipsubscription",
                "transaction_id":"100000597786700",
                "original_transaction_id":"100000597786700",
                "purchase_date":"2019-10-07 00:43:52 Etc/GMT",
                "purchase_date_ms":"1570409032000",
                "purchase_date_pst":"2019-10-06 17:43:52 America/Los_Angeles",
                "original_purchase_date":"2019-10-07 00:43:52 Etc/GMT",
                "original_purchase_date_ms":"1570409032000",
                "original_purchase_date_pst":"2019-10-06 17:43:52 America/Los_Angeles",
                "is_trial_period":"false"
            },
            {
                "quantity":"1",
                "product_id":"com.jyys.jianmovie.monthvipsubscription",
                "transaction_id":"100000625254929",
                "original_transaction_id":"100000625254929",
                "purchase_date":"2019-12-25 04:48:05 Etc/GMT",
                "purchase_date_ms":"1577249285000",
                "purchase_date_pst":"2019-12-24 20:48:05 America/Los_Angeles",
                "original_purchase_date":"2019-12-25 04:48:05 Etc/GMT",
                "original_purchase_date_ms":"1577249285000",
                "original_purchase_date_pst":"2019-12-24 20:48:05 America/Los_Angeles",
                "is_trial_period":"false"
            }
        ]
    },
    "status":0,
    "environment":"Production"
}

如果有APP同时接普通内购(代表类型为充币)和订阅(代表类型为会员支付)的,要检查下其代码的兼容性了。

你可能感兴趣的:(职场生活)