当我尝试验证服务器上的购买时,我从Apple获得了两种收据格式。
知道有什么区别吗?
1)
content: {
status: 0,
receipt: {
item_id: "662554154",
original_purchase_date: "2012-10-12 08:32:12 Etc/GMT",
purchase_date_pst: "2012-10-12 01:32:12 America/Los_Angeles",
purchase_date: "2012-10-12 08:32:12 Etc/GMT",
product_id: "com.example.mygame.tool1",
bid: "com.example.mygame",
version_external_identifier: "5647854",
bvrs: "1.0",
quantity: "1",
transaction_id: "8844567822225544",
app_item_id: "659563252",
original_purchase_date_ms: "1350030732000",
original_transaction_id: "8844567822225544",
purchase_date_ms: "1350030732000",
original_purchase_date_pst: "2012-10-12 01:32:12 America/Los_Angeles"
}
}
2)
content: {
receipt: {
in_app: [
{
is_trial_period: "false",
original_purchase_date_pst: "2013-10-09 20:55:27 America/Los_Angeles",
original_purchase_date_ms: "1386571707000",
original_purchase_date: "2013-10-09 04:55:27 Etc/GMT",
purchase_date_pst: "2013-10-09 20:55:27 America/Los_Angeles",
purchase_date_ms: "1386571707000",
purchase_date: "2013-10-09 04:55:27 Etc/GMT",
original_transaction_id: "654888452251325",
transaction_id: "654888452251325",
product_id: "com.example.mygame.tool1",
quantity: "1"
}
],
original_application_version: "1.0",
original_purchase_date_pst: "2013-10-09 20:55:27 America/Los_Angeles",
original_purchase_date_ms: "1386569706000",
original_purchase_date: "2013-10-09 04:55:27 Etc/GMT",
request_date_pst: "2013-10-09 20:55:27 America/Los_Angeles",
request_date_ms: "1386571710087",
request_date: "2013-10-09 04:55:27 Etc/GMT",
download_id: 215425636588954,
application_version: "1.0",
bundle_id: "com.example.mygame",
adam_id: 654225311,
receipt_type: "Sandbox"
},
environment: "Sandbox",
status: 0
}
答案 0 :(得分:29)
在iOS 6中每个IAP(应用内购买)交易都有自己的收据(StoreKit API中的SKPaymentTransaction.transactionReceipt
)。当您将此收据数据发送到其验证API时,您将获得前一个响应。
在iOS 7中,Apple已经开始使用他们称之为“Grand Unified Receipt”的东西。这意味着应用一个收据 ,其中包含有关购买应用程序本身以及IAP的信息。您可以使用-[NSBundle appStoreReceiptURL]
API从磁盘加载此收据数据(如果它似乎不存在,可能会SKReceiptRefreshRequest
获取它)。当您将此收据数据发送到他们的验证API时,您会收到后一个响应。
主要区别在于前收据格式代表一个IAP交易,而后者代表它们的数组(以及购买应用程序本身)。
查看“Using Receipts to Protect Your Digital Sales” WWDC 2013 session中的更多信息。