苹果内购验证

苹果审核时,也是在sandbox环境购买,其产生的购买凭证,也只能连接苹果的测试验证服务器,所以我们可以先发到苹果的正式服务器验证,如果苹果返回21007,则再一次连接测试服务器进行验证。

验证地址(POST请求)

沙盒:https://sandbox.itunes.apple.com/verifyReceipt
生产:https://buy.itunes.apple.com/verifyReceipt

[REQUEST BODY] :

{
    "receipt-data": "receipt....",
    "password" : "App 专用共享密钥" //自动续期订阅 需要用到
}

[RESPONSE] :

{
    "status": 0,
    "environment": "Sandbox",
    "receipt": {
        "receipt_type": "ProductionSandbox",
        "adam_id": 0,
        "app_item_id": 0,
        "bundle_id": "",
        "application_version": "2",
        "download_id": 0,
        "version_external_identifier": 0,
        "receipt_creation_date": "2020-06-12 07:03:00 Etc/GMT",
        "receipt_creation_date_ms": "1591945380000",
        "receipt_creation_date_pst": "2020-06-12 00:03:00 America/Los_Angeles",
        "request_date": "2020-06-12 07:13:25 Etc/GMT",
        "request_date_ms": "1591946005532",
        "request_date_pst": "2020-06-12 00:13:25 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": "",
                "transaction_id": "1000000678326907",
                "original_transaction_id": "1000000678326907",
                "purchase_date": "2020-06-12 04:01:04 Etc/GMT",
                "purchase_date_ms": "1591934464000",
                "purchase_date_pst": "2020-06-11 21:01:04 America/Los_Angeles",
                "original_purchase_date": "2020-06-12 04:01:04 Etc/GMT",
                "original_purchase_date_ms": "1591934464000",
                "original_purchase_date_pst": "2020-06-11 21:01:04 America/Los_Angeles",
                "is_trial_period": "false"
            },
            {
                "quantity": "1",
                "product_id": "",
                "transaction_id": "1000000678384827",
                "original_transaction_id": "1000000678384827",
                "purchase_date": "2020-06-12 07:02:58 Etc/GMT",
                "purchase_date_ms": "1591945378000",
                "purchase_date_pst": "2020-06-12 00:02:58 America/Los_Angeles",
                "original_purchase_date": "2020-06-12 07:03:00 Etc/GMT",
                "original_purchase_date_ms": "1591945380000",
                "original_purchase_date_pst": "2020-06-12 00:03:00 America/Los_Angeles",
                "expires_date": "2020-06-12 07:05:58 Etc/GMT",
                "expires_date_ms": "1591945558000",
                "expires_date_pst": "2020-06-12 00:05:58 America/Los_Angeles",
                "web_order_line_item_id": "1000000053232155",
                "is_trial_period": "true",
                "is_in_intro_offer_period": "false"
            }
        ]
    },
    "latest_receipt_info": [
        
        {
            "quantity": "1",
            "product_id": "",
            "transaction_id": "1000000678359627",
            "original_transaction_id": "1000000678359627",
            "purchase_date": "2020-06-12 06:10:44 Etc/GMT",
            "purchase_date_ms": "1591942244000",
            "purchase_date_pst": "2020-06-11 23:10:44 America/Los_Angeles",
            "original_purchase_date": "2020-06-12 06:10:44 Etc/GMT",
            "original_purchase_date_ms": "1591942244000",
            "original_purchase_date_pst": "2020-06-11 23:10:44 America/Los_Angeles",
            "is_trial_period": "false"
        },
        {
            "quantity": "1",
            "product_id": "",
            "transaction_id": "1000000678384827",
            "original_transaction_id": "1000000678384827",
            "purchase_date": "2020-06-12 07:02:58 Etc/GMT",
            "purchase_date_ms": "1591945378000",
            "purchase_date_pst": "2020-06-12 00:02:58 America/Los_Angeles",
            "original_purchase_date": "2020-06-12 07:03:00 Etc/GMT",
            "original_purchase_date_ms": "1591945380000",
            "original_purchase_date_pst": "2020-06-12 00:03:00 America/Los_Angeles",
            "expires_date": "2020-06-12 07:05:58 Etc/GMT",
            "expires_date_ms": "1591945558000",
            "expires_date_pst": "2020-06-12 00:05:58 America/Los_Angeles",
            "web_order_line_item_id": "1000000053232155",
            "is_trial_period": "true",
            "is_in_intro_offer_period": "false",
            "subscription_group_identifier": "20647007"
        },
        
    ],
    "latest_receipt": "",
    "pending_renewal_info": [
        {
            "auto_renew_product_id": "auto_renew_product_id",
            "original_transaction_id": "1000000678384827",
            "is_in_billing_retry_period": "1",
            "product_id": "product_id",
            "auto_renew_status": "1"
        }
    ]

你可能感兴趣的:(苹果内购验证)