将receipt_data发送到App Store获得app内商品的ios收据详情
请求方式:向appstore发送HTTP POST请求
在测试环境中,URL为 https://sandbox.itunes.apple.com/verifyReceipt 在生产中,URL为 https://buy.itunes.apple.com/verifyReceipt
国内访问苹果服务器域名速度比较慢,可以使用代理转发
配置代理,先转发到香港再转发到苹果服务器
POST请求携带数据
key | Value |
---|
receipt-data | base64编码的receipt_data。 | password | 应用程序请求Appstore数据的密钥(十六进制字符串)。 | exclude-old-transactions | 仅用于包含自动续订或非续订订阅的iOS7样式的应用收据。如果值为true,则响应仅包括任何订阅的最新续订交易 |
返回相应结构体
key | meaning |
---|
status | 相应状态码 | receipt | 发送用于验证的收据的JSON表示形式。有关在收据中找到的密钥的信息(ios7.0) | latest_receipt | 仅针对包含自动续订的收据返回。对于iOS 6样式的交易收据,这是最新续订的以64为基数编码的收据。对于iOS 7风格的应用收据,这是最新的base-64编码的应用收据。 | latest_receipt_info | 仅针对包含自动续订的收据返回。对于iOS 6样式的交易收据,这是最新续签的收据的JSON表示形式。对于iOS 7风格的应用收据,此键的值是一个包含所有应用内购买交易的数组。这不包括已被您的应用标记为已完成的消耗品交易 | latest_expired_receipt_info | 仅针对iOS 6样式的交易收据返回,用于自动续订。过期订阅的收据的JSON表示形式(ios7.0) | pending_renewal_info | 仅针对包含自动续订的iOS 7样式的应用收据返回。在JSON文件中,此键的值是一个数组,其中每个元素都包含由标识的每个自动可续订订阅的待处理续订信息Product Identifier。待定的续订可能是指将来计划的续订,或者是由于某种原因在过去失败的续订。(ios7.0) | is-retryable | 重试对此收据进行验证。仅适用于状态码21100-21199 |
收据详细字段
key | meaning |
---|
bundle_id | 捆绑包标识符(ios6.0) | application_version | 应用程式版本(ios7.0) | original_application_version | 最初购买的应用程序的版本(ios7.0) | receipt_creation_date | 应用收据的创建日期(ios7.0) | expiration_date | 应用收据到期的日期(ios7.0) | product_id | 购买的商品的产品标识符 | transaction_id | 购买物品的交易标识符(注意最好不要用这个来映设用户是否使用使用) | original_transaction_id | 对于恢复先前交易的原始交易标识符 | purchase_date | 购买该商品的日期和时间 | expires_date | 订阅的到期日期,表示为格林尼治标准时间1970年1月1日00:00:00以来的毫秒数(ios7.0) | expiration_intent | 对于过期的订阅,订阅到期的原因(ios7.0) | is_in_billing_retry_period | 对于过期的订阅,Apple是否仍在尝试自动续订(ios7.0) | is_trial_period | 当过去收据中is_trial_period或者is_in_intro_offer_period为true的时候,用户不再有享受优惠的权益,即只能享受一次优惠。(ios7.0) | is_in_intro_offer_period | 是否在享受折扣价(ios7.0) | cancellation_date | 对于Apple客户支持取消的交易,取消的时间和日期 | cancellation_reason | 对于已取消的交易,取消的原因 | app_item_id | App Store用于唯一标识创建事务的应用程序的字符串 | version_external_identifier | 唯一标识应用程序修订版的任意数字。 | web_order_line_item_id | 标识订阅购买的主键。 | auto_renew_status | 自动续订订阅的当前续订状态。 “ 1”-订阅将在当前订阅期结束时续订。“ 0”-客户已关闭其订阅的自动续订。 | auto_renew_product_id | 自动续订订阅的当前续订首选项 | price_consent_status | 用户是否同意了订阅涨价并自动订阅 |
status 状态码
状态码 | 描述 |
---|
21000 | App Store无法读取您提供的JSON对象 | 21002 | receipt-data属性中的数据格式错误或丢失 | 21003 | 收据无法认证。(一般都是因为共享秘钥有问题才产生的错误) | 21004 | 您提供的共享密码与您帐户的文件共享密码不匹配 | 21005 | 收据服务器当前不可用 | 21006 | 该收据有效,但订阅已过期。当此状态代码返回到您的服务器时,收据数据也会被解码并作为响应的一部分返回。仅针对自动续订的iOS 6样式交易收据返回 | 21007 | 该收据来自测试环境,但已发送到生产环境以进行验证。而是将其发送到测试环境 | 21008 | 该收据来自生产环境,但是已发送到测试环境以进行验证。而是将其发送到生产环境 | 21010 | 此收据无法授权。就像从未进行过购买一样对待 | 21100-21199 | 内部数据访问错误 |
exclude-old-transactions 参数等于true时
数据通过json_decode()转换后
首次订阅支付通过票据进行验单的返回结构体
Array
(
[status] => 0
[environment] => Sandbox
[receipt] => Array
(
[receipt_type] => ProductionSandbox
[adam_id] => 0
[app_item_id] => 0
[bundle_id] => com.yiku.ppickup
[application_version] => 1.1.7
[download_id] => 0
[version_external_identifier] => 0
[receipt_creation_date] => 2019-12-09 03:19:01 Etc/GMT
[receipt_creation_date_ms] => 1575861541000
[receipt_creation_date_pst] => 2019-12-08 19:19:01 America/Los_Angeles
[request_date] => 2019-12-09 03:30:17 Etc/GMT
[request_date_ms] => 1575862217687
[request_date_pst] => 2019-12-08 19:30:17 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] => Array
(
[0] => Array
(
[quantity] => 1
[product_id] => A0002
[transaction_id] => 1000000602395588
[original_transaction_id] => 1000000601811360
[purchase_date] => 2019-12-09 03:17:20 Etc/GMT
[purchase_date_ms] => 1575861440000
[purchase_date_pst] => 2019-12-08 19:17:20 America/Los_Angeles
[original_purchase_date] => 2019-12-06 09:48:53 Etc/GMT
[original_purchase_date_ms] => 1575625733000
[original_purchase_date_pst] => 2019-12-06 01:48:53 America/Los_Angeles
[expires_date] => 2019-12-09 03:22:20 Etc/GMT
[expires_date_ms] => 1575861740000
[expires_date_pst] => 2019-12-08 19:22:20 America/Los_Angeles
[web_order_line_item_id] => 1000000048833449
[is_trial_period] => false
[is_in_intro_offer_period] => false
)
)
)
[latest_receipt_info] => Array
(
[0] => Array
(
[quantity] => 1
[product_id] => A0002
[transaction_id] => 1000000602398380
[original_transaction_id] => 1000000601811360
[purchase_date] => 2019-12-09 03:27:20 Etc/GMT
[purchase_date_ms] => 1575862040000
[purchase_date_pst] => 2019-12-08 19:27:20 America/Los_Angeles
[original_purchase_date] => 2019-12-06 09:48:53 Etc/GMT
[original_purchase_date_ms] => 1575625733000
[original_purchase_date_pst] => 2019-12-06 01:48:53 America/Los_Angeles
[expires_date] => 2019-12-09 03:32:20 Etc/GMT
[expires_date_ms] => 1575862340000
[expires_date_pst] => 2019-12-08 19:32:20 America/Los_Angeles
[web_order_line_item_id] => 1000000048833591
[is_trial_period] => false
[is_in_intro_offer_period] => false
[subscription_group_identifier] => 20575137
)
)
[latest_receipt] => "新的票据。。。。"
[pending_renewal_info] => Array
(
[0] => Array
(
[auto_renew_product_id] => A0002
[original_transaction_id] => 1000000601811360
[product_id] => A0002
[auto_renew_status] => 1
)
)
)
订阅回调接收到票据,使用本票据去appstore校验验单据返回结构体
status:0状态返回:
Array
(
[auto_renew_status] => 1
[status] => 0
[auto_renew_product_id] => A0002
[receipt] => Array
(
[original_purchase_date_pst] => 2019-12-06 01:48:53 America/Los_Angeles
[quantity] => 1
[unique_vendor_identifier] => DDD057B0-8BDA-465E-826E-EAD2C4F5D30E
[bvrs] => 1.1.7
[expires_date_formatted] => 2019-12-09 03:17:20 Etc/GMT
[is_in_intro_offer_period] => false
[purchase_date_ms] => 1575861140000
[expires_date_formatted_pst] => 2019-12-08 19:17:20 America/Los_Angeles
[is_trial_period] => false
[item_id] => 1488302463
[unique_identifier] => 5e3d27716ff2fb2bf10e020fdb27d076f165f1e9
[original_transaction_id] => 1000000601811360
[subscription_group_identifier] => 20575137
[transaction_id] => 1000000602394302
[web_order_line_item_id] => 1000000048795136
[version_external_identifier] => 0
[purchase_date] => 2019-12-09 03:12:20 Etc/GMT
[product_id] => A0002
[expires_date] => 1575861440000
[original_purchase_date] => 2019-12-06 09:48:53 Etc/GMT
[purchase_date_pst] => 2019-12-08 19:12:20 America/Los_Angeles
[bid] => com.yiku.ppickup
[original_purchase_date_ms] => 1575625733000
)
[latest_receipt_info] => Array
(
[original_purchase_date_pst] => 2019-12-06 01:48:53 America/Los_Angeles
[quantity] => 1
[unique_vendor_identifier] => DDD057B0-8BDA-465E-826E-EAD2C4F5D30E
[bvrs] => 1.1.7
[expires_date_formatted] => 2019-12-09 03:37:20 Etc/GMT
[is_in_intro_offer_period] => false
[purchase_date_ms] => 1575862340000
[expires_date_formatted_pst] => 2019-12-08 19:37:20 America/Los_Angeles
[is_trial_period] => false
[item_id] => 1488302463
[unique_identifier] => 5e3d27716ff2fb2bf10e020fdb27d076f165f1e9
[original_transaction_id] => 1000000601811360
[subscription_group_identifier] => 20575137
[transaction_id] => 1000000602399011
[bid] => com.yiku.ppickup
[web_order_line_item_id] => 1000000048833663
[purchase_date] => 2019-12-09 03:32:20 Etc/GMT
[product_id] => A0002
[expires_date] => 1575862640000
[original_purchase_date] => 2019-12-06 09:48:53 Etc/GMT
[purchase_date_pst] => 2019-12-08 19:32:20 America/Los_Angeles
[original_purchase_date_ms] => 1575625733000
)
[latest_receipt] => 返回的新票据。。。
)
status:21006状态返回:
Array
(
[auto_renew_status] => 0
[latest_expired_receipt_info] => Array
(
[original_purchase_date_pst] => 2019-11-25 23:47:59 America/Los_Angeles
[quantity] => 1
[unique_vendor_identifier] => 1D6EE791-1F81-4A12-8F87-A9744F54A6EB
[bvrs] => 1.0.10
[expires_date_formatted] => 2019-11-27 08:31:12 Etc/GMT
[is_in_intro_offer_period] => false
[purchase_date_ms] => 1574843172000
[expires_date_formatted_pst] => 2019-11-27 00:31:12 America/Los_Angeles
[is_trial_period] => false
[item_id] => 1488302463
[unique_identifier] => 993a262648cc5463578cbafe48519e04411d9d7f
[original_transaction_id] => 1000000597340067
[subscription_group_identifier] => 20575137
[transaction_id] => 1000000597994138
[bid] => com.yiku.ppickup
[web_order_line_item_id] => 1000000048563112
[purchase_date] => 2019-11-27 08:26:12 Etc/GMT
[product_id] => A0002
[expires_date] => 1574843472000
[original_purchase_date] => 2019-11-26 07:47:59 Etc/GMT
[purchase_date_pst] => 2019-11-27 00:26:12 America/Los_Angeles
[original_purchase_date_ms] => 1574754479000
)
[status] => 21006
[auto_renew_product_id] => A0002
[receipt] => Array
(
[original_purchase_date_pst] => 2019-11-25 23:47:59 America/Los_Angeles
[quantity] => 1
[unique_vendor_identifier] => 1D6EE791-1F81-4A12-8F87-A9744F54A6EB
[bvrs] => 1.0.10
[expires_date_formatted] => 2019-11-27 08:31:12 Etc/GMT
[is_in_intro_offer_period] => false
[purchase_date_ms] => 1574843172000
[expires_date_formatted_pst] => 2019-11-27 00:31:12 America/Los_Angeles
[is_trial_period] => false
[item_id] => 1488302463
[unique_identifier] => 993a262648cc5463578cbafe48519e04411d9d7f
[original_transaction_id] => 1000000597340067
[subscription_group_identifier] => 20575137
[transaction_id] => 1000000597994138
[web_order_line_item_id] => 1000000048563112
[version_external_identifier] => 0
[purchase_date] => 2019-11-27 08:26:12 Etc/GMT
[product_id] => A0002
[expires_date] => 1574843472000
[original_purchase_date] => 2019-11-26 07:47:59 Etc/GMT
[purchase_date_pst] => 2019-11-27 00:26:12 America/Los_Angeles
[bid] => com.yiku.ppickup
[original_purchase_date_ms] => 1574754479000
)
[expiration_intent] => 1
[is_in_billing_retry_period] => 0
)
apple回调的数据体
-X POST -d '{"auto_renew_status_change_date":"2019-11-29 04:05:08 Etc/GMT", "environment":"Sandbox", "auto_renew_status":"false", "auto_renew_status_change_date_pst":"2019-11-28 20:05:08 America/Los_Angeles",
"latest_expired_receipt":"票据ExXbDBaVzB0YVdRaUlEMGdJakV3TURBd01EQXdORGcyTVRnM05USWlPd29KSW5abGNuTnBiMjR0WlhoMFpYSnVZV3d0YVdSbGJuUnBabWxsY2lJZ1BTQWlNQ0k3Q2draVltbGtJaUE5SUNKamIyMHVlV2xyZFM1d2NHbGphM1Z3SWpzS0NTSndjbTlrZFdOMExXbGtJaUE5SUNKQk1EQXdNaUk3Q2draWNIVnlZMmhoYzJVdFpHRjBaU0lnUFNBaU1qQXhPUzB4TVMweU9TQXdORG93TURveU15QkZkR012UjAxVUlqc0tDU0p3ZFhKamFHRnpaUzFrWVhSbExYQnpkQ0lnUFNBaU1qQXhPUzB4TVMweU9DQXlNRG93TURveU15QkJiV1Z5YVdOaEwweHZjMTlCYm1kbGJHVnpJanNLQ1NKdmNtbG5hVzVoYkMxd2RYSmphR0Z6WlMxa1lYUmxJaUE5SUNJeU1ERTVMVEV4TFRJMklEQTNPalEzT2pVNUlFVjBZeTlIVFZRaU93cDkiOwoJImVudmlyb25tZW50IiA9ICJTYW5kYm94IjsKCSJwb2QiID0gIjEwMCI7Cgkic2lnbmluZy1zdGF0dXMiID0gIjAiOwp9",
"latest_expired_receipt_info":{"original_purchase_date_pst":"2019-11-25 23:47:59 America/Los_Angeles", "quantity":"1", "subscription_group_identifier":"20575137", "unique_vendor_identifier":"1D6EE791-1F81-4A12-8F87-A9744F54A6EB", "original_purchase_date_ms":"1574754479000", "expires_date_formatted":"2019-11-29 04:05:23 Etc/GMT", "is_in_intro_offer_period":"false", "purchase_date_ms":"1575000023000", "expires_date_formatted_pst":"2019-11-28 20:05:23 America/Los_Angeles", "is_trial_period":"false", "item_id":"1488302463", "unique_identifier":"993a262648cc5463578cbafe48519e04411d9d7f", "original_transaction_id":"1000000597340067", "expires_date":"1575000323000", "transaction_id":"1000000598931960", "bvrs":"1.1.5", "web_order_line_item_id":"1000000048618752", "version_external_identifier":"0", "bid":"com.yiku.ppickup", "product_id":"A0002", "purchase_date":"2019-11-29 04:00:23 Etc/GMT", "purchase_date_pst":"2019-11-28 20:00:23 America/Los_Angeles", "original_purchase_date":"2019-11-26 07:47:59 Etc/GMT"}, "password":"ebfbfc92ae59469eb3abb44068fd804e", "auto_renew_status_change_date_ms":"1575000308000", "auto_renew_product_id":"A0002", "notification_type":"DID_CHANGE_RENEWAL_STATUS"}'
普通下单通过票据验单返回:(appleID订阅过商品的)
Array
(
[status] => 0
[environment] => Sandbox
[receipt] => Array
(
[receipt_type] => ProductionSandbox
[adam_id] => 0
[app_item_id] => 0
[bundle_id] => com.yiku.ppickup
[application_version] => 1.1.5
[download_id] => 0
[version_external_identifier] => 0
[receipt_creation_date] => 2019-12-02 02:14:42 Etc/GMT
[receipt_creation_date_ms] => 1575252882000
[receipt_creation_date_pst] => 2019-12-01 18:14:42 America/Los_Angeles
[request_date] => 2019-12-02 02:22:40 Etc/GMT
[request_date_ms] => 1575253360821
[request_date_pst] => 2019-12-01 18:22:40 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] => Array
(
[0] => Array
(
[quantity] => 1
[product_id] => diamond1802
[transaction_id] => 1000000599541897
[original_transaction_id] => 1000000599541897
[purchase_date] => 2019-12-02 02:14:41 Etc/GMT
[purchase_date_ms] => 1575252881000
[purchase_date_pst] => 2019-12-01 18:14:41 America/Los_Angeles
[original_purchase_date] => 2019-12-02 02:14:41 Etc/GMT
[original_purchase_date_ms] => 1575252881000
[original_purchase_date_pst] => 2019-12-01 18:14:41 America/Los_Angeles
[is_trial_period] => false
)
[1] => Array
(
[quantity] => 1
[product_id] => A0002
[transaction_id] => 1000000597340067
[original_transaction_id] => 1000000597340067
[purchase_date] => 2019-11-26 07:47:59 Etc/GMT
[purchase_date_ms] => 1574754479000
[purchase_date_pst] => 2019-11-25 23:47:59 America/Los_Angeles
[original_purchase_date] => 2019-11-26 07:47:59 Etc/GMT
[original_purchase_date_ms] => 1574754479000
[original_purchase_date_pst] => 2019-11-25 23:47:59 America/Los_Angeles
[expires_date] => 2019-11-26 07:52:59 Etc/GMT
[expires_date_ms] => 1574754779000
[expires_date_pst] => 2019-11-25 23:52:59 America/Los_Angeles
[web_order_line_item_id] => 1000000048530385
[is_trial_period] => false
[is_in_intro_offer_period] => false
)
[2] => Array
(
[quantity] => 1
[product_id] => A0002
[transaction_id] => 1000000597343270
[original_transaction_id] => 1000000597340067
[purchase_date] => 2019-11-26 07:52:59 Etc/GMT
[purchase_date_ms] => 1574754779000
[purchase_date_pst] => 2019-11-25 23:52:59 America/Los_Angeles
[original_purchase_date] => 2019-11-26 07:47:59 Etc/GMT
[original_purchase_date_ms] => 1574754479000
[original_purchase_date_pst] => 2019-11-25 23:47:59 America/Los_Angeles
[expires_date] => 2019-11-26 07:57:59 Etc/GMT
[expires_date_ms] => 1574755079000
[expires_date_pst] => 2019-11-25 23:57:59 America/Los_Angeles
[web_order_line_item_id] => 1000000048530386
[is_trial_period] => false
[is_in_intro_offer_period] => false
)
[3] => Array
(
[quantity] => 1
[product_id] => A0002
[transaction_id] => 1000000597347233
[original_transaction_id] => 1000000597340067
[purchase_date] => 2019-11-26 07:57:59 Etc/GMT
[purchase_date_ms] => 1574755079000
[purchase_date_pst] => 2019-11-25 23:57:59 America/Los_Angeles
[original_purchase_date] => 2019-11-26 07:47:59 Etc/GMT
[original_purchase_date_ms] => 1574754479000
[original_purchase_date_pst] => 2019-11-25 23:47:59 America/Los_Angeles
[expires_date] => 2019-11-26 08:02:59 Etc/GMT
[expires_date_ms] => 1574755379000
[expires_date_pst] => 2019-11-26 00:02:59 America/Los_Angeles
[web_order_line_item_id] => 1000000048530521
[is_trial_period] => false
[is_in_intro_offer_period] => false
)
[4] => Array
(
[quantity] => 1
[product_id] => A0002
[transaction_id] => 1000000597350115
[original_transaction_id] => 1000000597340067
[purchase_date] => 2019-11-26 08:02:59 Etc/GMT
[purchase_date_ms] => 1574755379000
[purchase_date_pst] => 2019-11-26 00:02:59 America/Los_Angeles
[original_purchase_date] => 2019-11-26 07:47:59 Etc/GMT
[original_purchase_date_ms] => 1574754479000
[original_purchase_date_pst] => 2019-11-25 23:47:59 America/Los_Angeles
[expires_date] => 2019-11-26 08:07:59 Etc/GMT
[expires_date_ms] => 1574755679000
[expires_date_pst] => 2019-11-26 00:07:59 America/Los_Angeles
[web_order_line_item_id] => 1000000048530666
[is_trial_period] => false
[is_in_intro_offer_period] => false
)
[5] => Array
(
[quantity] => 1
[product_id] => A0002
[transaction_id] => 1000000597353683
[original_transaction_id] => 1000000597340067
[purchase_date] => 2019-11-26 08:07:59 Etc/GMT
[purchase_date_ms] => 1574755679000
[purchase_date_pst] => 2019-11-26 00:07:59 America/Los_Angeles
[original_purchase_date] => 2019-11-26 07:47:59 Etc/GMT
[original_purchase_date_ms] => 1574754479000
[original_purchase_date_pst] => 2019-11-25 23:47:59 America/Los_Angeles
[expires_date] => 2019-11-26 08:12:59 Etc/GMT
[expires_date_ms] => 1574755979000
[expires_date_pst] => 2019-11-26 00:12:59 America/Los_Angeles
[web_order_line_item_id] => 1000000048530811
[is_trial_period] => false
[is_in_intro_offer_period] => false
)
[6] => Array
(
[quantity] => 1
[product_id] => A0002
[transaction_id] => 1000000597357315
[original_transaction_id] => 1000000597340067
[purchase_date] => 2019-11-26 08:12:59 Etc/GMT
[purchase_date_ms] => 1574755979000
[purchase_date_pst] => 2019-11-26 00:12:59 America/Los_Angeles
[original_purchase_date] => 2019-11-26 07:47:59 Etc/GMT
[original_purchase_date_ms] => 1574754479000
[original_purchase_date_pst] => 2019-11-25 23:47:59 America/Los_Angeles
[expires_date] => 2019-11-26 08:17:59 Etc/GMT
[expires_date_ms] => 1574756279000
[expires_date_pst] => 2019-11-26 00:17:59 America/Los_Angeles
[web_order_line_item_id] => 1000000048530970
[is_trial_period] => false
[is_in_intro_offer_period] => false
)
)
)
[latest_receipt_info] => Array
(
[0] => Array
(
[quantity] => 1
[product_id] => A0002
[transaction_id] => 1000000599543073
[original_transaction_id] => 1000000597340067
[purchase_date] => 2019-12-02 02:20:47 Etc/GMT
[purchase_date_ms] => 1575253247000
[purchase_date_pst] => 2019-12-01 18:20:47 America/Los_Angeles
[original_purchase_date] => 2019-11-26 07:47:59 Etc/GMT
[original_purchase_date_ms] => 1574754479000
[original_purchase_date_pst] => 2019-11-25 23:47:59 America/Los_Angeles
[expires_date] => 2019-12-02 02:25:47 Etc/GMT
[expires_date_ms] => 1575253547000
[expires_date_pst] => 2019-12-01 18:25:47 America/Los_Angeles
[web_order_line_item_id] => 1000000048661565
[is_trial_period] => false
[is_in_intro_offer_period] => false
[subscription_group_identifier] => 20575137
)
)
[latest_receipt] => 票据
[pending_renewal_info] => Array
(
[0] => Array
(
[auto_renew_product_id] => A0002
[original_transaction_id] => 1000000597340067
[product_id] => A0002
[auto_renew_status] => 1
)
)
)
没有订阅过的苹果账号支付验单结构:
Array
(
[receipt] => Array
(
[receipt_type] => ProductionSandbox
[adam_id] => 0
[app_item_id] => 0
[bundle_id] => com.yiku.ppickup
[application_version] => 1.1.6
[download_id] => 0
[version_external_identifier] => 0
[receipt_creation_date] => 2019-12-10 03:42:01 Etc/GMT
[receipt_creation_date_ms] => 1575949321000
[receipt_creation_date_pst] => 2019-12-09 19:42:01 America/Los_Angeles
[request_date] => 2019-12-10 04:00:35 Etc/GMT
[request_date_ms] => 1575950435540
[request_date_pst] => 2019-12-09 20:00:35 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] => Array
(
[0] => Array
(
[quantity] => 1
[product_id] => diamond892
[transaction_id] => 1000000602917743
[original_transaction_id] => 1000000602917743
[purchase_date] => 2019-12-10 03:42:01 Etc/GMT
[purchase_date_ms] => 1575949321000
[purchase_date_pst] => 2019-12-09 19:42:01 America/Los_Angeles
[original_purchase_date] => 2019-12-10 03:42:01 Etc/GMT
[original_purchase_date_ms] => 1575949321000
[original_purchase_date_pst] => 2019-12-09 19:42:01 America/Los_Angeles
[is_trial_period] => false
)
)
)
[status] => 0
[environment] => Sandbox
)
注意:如果这个苹果账号有订阅的商品,再次购买其他一次性消费时,订单信息会在in_app 下标为0中展示,而订阅的最新信息也会在in_app下单最大下标中展示
重要
我从客户那里收到了一张收据,并通过Apple服务器对其进行了验证,我在此收据中得到了新购买的交易ID(这是自动订购的购买)。几天后,我从同一位客户获得了一张新收据,并对其进行了验证,奇怪的事情发生了:该旧购买的交易ID发生了变化。 我将旧收据中的此次购买数据与新收据中的数据进行比较,唯一的变化是transaction_id字段,original_transaction_id,purchase_date,expires_date, web_order_line_item_id 等字段是完全一样。 比起我检查数据库,我发现大约1%的交易记录有相同的情况。并且有一个特点,他们的大多数交易ID都会增加或减少1-2 。
我看到这是由恢复购买"按钮的点击触发的。如果恢复购买"按钮使用 restoreCompletedTransactions API,那么这将导致您的交易ID发生更改。我们已在Apple开发人员的支持下确认了这一点。 显然,您可以调用 SKReceiptRefreshRequest 来代替抓住最新的收据,而不是重播所有交易。据我了解,这不会导致交易ID发生更改。曾经目睹过,在对 restoreCompletedTransactions 的调用中, web_order_line_item_id 的值不会改变。 web_order_line_item_id 在每个续订购买中都是唯一的。
|