先看苹果验证收据可能返回的错误码:
一个票据会有3中情况:
状态为0时的返回内容:
{
"auto_renew_status": 1,
"status": 0,
"auto_renew_product_id": "mango_star_vip10",
"receipt": { //当前票据的信息
"original_purchase_date_pst": "2019-08-14 01:28:54 America/Los_Angeles",
"quantity": "1",
"unique_vendor_identifier": "3873A4E2-FB10-4BA4-A24E-11C50E53BD4A",
"bvrs": "1014",
"expires_date_formatted": "2019-08-21 09:11:43 Etc/GMT",
"is_in_intro_offer_period": "false",
"purchase_date_ms": "1566378403000",
"expires_date_formatted_pst": "2019-08-21 02:11:43 America/Los_Angeles",
"is_trial_period": "false",
"item_id": "1476506027",
"unique_identifier": "7468f08dc6b0cb8fa02580c5f35ef943ff3ca6da",
"original_transaction_id": "1000000557452125",
"expires_date": "1566378703000",
"transaction_id": "1000000559740927",
"web_order_line_item_id": "1000000046388850",
"version_external_identifier": "0",
"bid": "mango.star.risingsun",
"product_id": "mango_star_vip10",
"purchase_date": "2019-08-21 09:06:43 Etc/GMT",
"original_purchase_date": "2019-08-14 08:28:54 Etc/GMT",
"purchase_date_pst": "2019-08-21 02:06:43 America/Los_Angeles",
"original_purchase_date_ms": "1565771334000"
},
"latest_receipt_info": { //最后一次购买的票据信息 主要处理这个结构体就可以了
"original_purchase_date_pst": "2019-08-14 01:28:54 America/Los_Angeles", 第一次购买时间
"unique_identifier": "81179dcc383d21f866ab314b1e57429d7cf86244",
"original_transaction_id": "1000000557452125", 第一次购买订单号
"expires_date": "1566378703000", // 当前最终的过期时间
"transaction_id": "1000000559740878", // 最后一次订阅订单号
"quantity": "1", //商品数量
"product_id": "mango_star_vip10", 商品名称, 跟后台一致
"bvrs": "1014",
"bid": "mango.star.risingsun",
"unique_vendor_identifier": "B4418824-55B0-4D6C-B072-5B1CACB8801D",
"web_order_line_item_id": "1000000046388850",
"original_purchase_date_ms": "1565771334000",
"expires_date_formatted": "2019-08-21 09:11:43 Etc/GMT",
"purchase_date": "2019-08-21 09:06:43 Etc/GMT",
"is_in_intro_offer_period": "false",
"purchase_date_ms": "1566378403000",
"expires_date_formatted_pst": "2019-08-21 02:11:43 America/Los_Angeles",
"is_trial_period": "false",
"purchase_date_pst": "2019-08-21 02:06:43 America/Los_Angeles",
"original_purchase_date": "2019-08-14 08:28:54 Etc/GMT",
"item_id": "1476506027"
},
"latest_receipt": "ewoxxxxx=="
}
状态为21006 的时候的返回内容:
{
"auto_renew_status": 1,
"latest_expired_receipt_info": { 最后一个过期的发票信息 如果之前续了 1月 2月 到了3月过期了,这里就是2月的信息
"original_purchase_date_pst": "2019-08-14 01:28:54 America/Los_Angeles",
"unique_identifier": "7468f08dc6b0cb8fa02580c5f35ef943ff3ca6da",
"original_transaction_id": "1000000557452125",
"expires_date": "1566377359000",
"transaction_id": "1000000559728292",
"quantity": "1",
"product_id": "mango_star_vip10",
"bvrs": "1014",
"bid": "mango.star.risingsun",
"unique_vendor_identifier": "412CFCEF-0DE0-458B-8743-BA78D7C3C183",
"web_order_line_item_id": "1000000046385938",
"original_purchase_date_ms": "1565771334000",
"expires_date_formatted": "2019-08-21 08:49:19 Etc/GMT",
"purchase_date": "2019-08-21 08:44:19 Etc/GMT",
"is_in_intro_offer_period": "false",
"purchase_date_ms": "1566377059000",
"expires_date_formatted_pst": "2019-08-21 01:49:19 America/Los_Angeles",
"is_trial_period": "false",
"purchase_date_pst": "2019-08-21 01:44:19 America/Los_Angeles",
"original_purchase_date": "2019-08-14 08:28:54 Etc/GMT",
"item_id": "1476506027"
},
"status": 21006,
"auto_renew_product_id": "mango_star_vip10",
"receipt": { 本发票的信息
"original_purchase_date_pst": "2019-08-14 01:28:54 America/Los_Angeles",
"quantity": "1",
"unique_vendor_identifier": "839FCCAF-5CF6-45CF-BFCA-2926D94B4DD6",
"bvrs": "1014",
"expires_date_formatted": "2019-08-21 08:49:19 Etc/GMT",
"is_in_intro_offer_period": "false",
"purchase_date_ms": "1566377059000",
"expires_date_formatted_pst": "2019-08-21 01:49:19 America/Los_Angeles",
"is_trial_period": "false",
"item_id": "1476506027",
"unique_identifier": "7468f08dc6b0cb8fa02580c5f35ef943ff3ca6da",
"original_transaction_id": "1000000557452125",
"expires_date": "1566377359000",
"transaction_id": "1000000559734983",
"web_order_line_item_id": "1000000046385938",
"version_external_identifier": "0",
"bid": "mango.star.risingsun",
"product_id": "mango_star_vip10",
"purchase_date": "2019-08-21 08:44:19 Etc/GMT",
"original_purchase_date": "2019-08-14 08:28:54 Etc/GMT",
"purchase_date_pst": "2019-08-21 01:44:19 America/Los_Angeles",
"original_purchase_date_ms": "1565771334000"
},
"is_in_billing_retry_period": "1"
}