苹果receipt例子
使用[[NSBundle mainBundle] appStoreReceiptURL]方式获取receipt (iOS7及以上获取receipt的方法)
普通付费
"latest_receipt_info" = (//注意这里是数组
{
"expires_date" = "2015-07-21 10:14:43 Etc/GMT";
"expires_date_ms" = 1437473683000;
"expires_date_pst" = "2015-07-21 03:14:43 America/Los_Angeles";
"is_trial_period" = false;
"original_purchase_date" = "2015-07-21 10:11:44 Etc/GMT";
"original_purchase_date_ms" = 1437473504000;
"original_purchase_date_pst" = "2015-07-21 03:11:44 America/Los_Angeles";
"original_transaction_id" = 1000000164375618;
"product_id" = "com.caocao.subscription";
"purchase_date" = "2015-07-21 10:11:43 Etc/GMT";
"purchase_date_ms" = 1437473503000;
"purchase_date_pst" = "2015-07-21 03:11:43 America/Los_Angeles";
quantity = 1;
"transaction_id" = 1000000164375618;
"web_order_line_item_id" = 1000000030188223;
},
{
"expires_date" = "2015-07-21 10:17:43 Etc/GMT";
"expires_date_ms" = 1437473863000;
"expires_date_pst" = "2015-07-21 03:17:43 America/Los_Angeles";
"is_trial_period" = false;
"original_purchase_date" = "2015-07-21 10:13:55 Etc/GMT";
"original_purchase_date_ms" = 1437473635000;
"original_purchase_date_pst" = "2015-07-21 03:13:55 America/Los_Angeles";
"original_transaction_id" = 1000000164375618;
"product_id" = "com.caocao.subscription";
"purchase_date" = "2015-07-21 10:14:43 Etc/GMT";
"purchase_date_ms" = 1437473683000;
"purchase_date_pst" = "2015-07-21 03:14:43 America/Los_Angeles";
quantity = 1;
"transaction_id" = 1000000164376037;
"web_order_line_item_id" = 1000000030188222;
},
//…
{
"expires_date" = "2015-07-21 10:29:43 Etc/GMT";
"expires_date_ms" = 1437474583000;
"expires_date_pst" = "2015-07-21 03:29:43 America/Los_Angeles";
"is_trial_period" = false;
"original_purchase_date" = "2015-07-21 10:25:57 Etc/GMT";
"original_purchase_date_ms" = 1437474357000;
"original_purchase_date_pst" = "2015-07-21 03:25:57 America/Los_Angeles";
"original_transaction_id" = 1000000164375618;
"product_id" = "com.caocao.subscription";
"purchase_date" = "2015-07-21 10:26:43 Etc/GMT";
"purchase_date_ms" = 1437474403000;
"purchase_date_pst" = "2015-07-21 03:26:43 America/Los_Angeles";
quantity = 1;
"transaction_id" = 1000000164377437;
"web_order_line_item_id" = 1000000030188313;
}
);
receipt = {
"adam_id" = 0;
"app_item_id" = 0;
"application_version" = 1;
"bundle_id" = "com.LHB.caocao";
"download_id" = 0;
"in_app" = (
{
"is_trial_period" = false;
"original_purchase_date" = "2015-08-11 06:35:54 Etc/GMT";
"original_purchase_date_ms" = 1439274954000;
"original_purchase_date_pst" = "2015-08-10 23:35:54 America/Los_Angeles";
"original_transaction_id" = 1000000167126673;
"product_id" = "Iap_CaoCaoBXS_Arm_Buy1";
"purchase_date" = "2015-08-11 06:35:54 Etc/GMT";
"purchase_date_ms" = 1439274954000;
"purchase_date_pst" = "2015-08-10 23:35:54 America/Los_Angeles";
quantity = 1;
"transaction_id" = 1000000167126673;
},
{
"expires_date" = "2015-07-21 10:17:43 Etc/GMT";
"expires_date_ms" = 1437473863000;
"expires_date_pst" = "2015-07-21 03:17:43 America/Los_Angeles";
"is_trial_period" = false;
"original_purchase_date" = "2015-07-21 10:13:55 Etc/GMT";
"original_purchase_date_ms" = 1437473635000;
"original_purchase_date_pst" = "2015-07-21 03:13:55 America/Los_Angeles";
"original_transaction_id" = 1000000164375618;
"product_id" = "com.caocao.subscription";
"purchase_date" = "2015-07-21 10:14:43 Etc/GMT";
"purchase_date_ms" = 1437473683000;
"purchase_date_pst" = "2015-07-21 03:14:43 America/Los_Angeles";
quantity = 1;
"transaction_id" = 1000000164376037;
"web_order_line_item_id" = 1000000030188222;
},
//…
{
"expires_date" = "2015-07-21 10:29:43 Etc/GMT";
"expires_date_ms" = 1437474583000;
"expires_date_pst" = "2015-07-21 03:29:43 America/Los_Angeles";
"is_trial_period" = false;
"original_purchase_date" = "2015-07-21 10:25:57 Etc/GMT";
"original_purchase_date_ms" = 1437474357000;
"original_purchase_date_pst" = "2015-07-21 03:25:57 America/Los_Angeles";
"original_transaction_id" = 1000000164375618;
"product_id" = "com.caocao.subscription";
"purchase_date" = "2015-07-21 10:26:43 Etc/GMT";
"purchase_date_ms" = 1437474403000;
"purchase_date_pst" = "2015-07-21 03:26:43 America/Los_Angeles";
quantity = 1;
"transaction_id" = 1000000164377437;
"web_order_line_item_id" = 1000000030188313;
}
);
"original_application_version" = "1.0";
"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";
"receipt_type" = ProductionSandbox;
"request_date" = "2015-08-11 06:36:51 Etc/GMT";
"request_date_ms" = 1439275011988;
"request_date_pst" = "2015-08-10 23:36:51 America/Los_Angeles";
"version_external_identifier" = 0;
};
status = 0;
}
订阅模式
{
environment = Sandbox;
"latest_receipt" = "XXXXXX”;
"latest_receipt_info" = (//注意这里是数组
{
"expires_date" = "2015-04-09 10:05:35 Etc/GMT";
"expires_date_ms" = 1428573935000;//注意这里的字段也不同
"expires_date_pst" = "2015-04-09 03:05:35 America/Los_Angeles";
"is_trial_period" = false;
"original_purchase_date" = "2015-04-09 10:02:36 Etc/GMT";
"original_purchase_date_ms" = 1428573756000;
"original_purchase_date_pst" = "2015-04-09 03:02:36 America/Los_Angeles";
"original_transaction_id" = 1000000151042480;
"product_id" = "com.caocao.subscription";
"purchase_date" = "2015-04-09 10:02:35 Etc/GMT";
"purchase_date_ms" = 1428573755000;
"purchase_date_pst" = "2015-04-09 03:02:35 America/Los_Angeles";
quantity = 1;
"transaction_id" = 1000000151042480;
"web_order_line_item_id" = 1000000029454808;
},
//......
{
"expires_date" = "2015-05-20 11:18:21 Etc/GMT";
"expires_date_ms" = 1432120701000;
"expires_date_pst" = "2015-05-20 04:18:21 America/Los_Angeles";
"is_trial_period" = false;
"original_purchase_date" = "2015-05-20 11:14:39 Etc/GMT";
"original_purchase_date_ms" = 1432120479000;
"original_purchase_date_pst" = "2015-05-20 04:14:39 America/Los_Angeles";
"original_transaction_id" = 1000000151202398;
"product_id" = "com.caocao.subscription";
"purchase_date" = "2015-05-20 11:15:21 Etc/GMT";
"purchase_date_ms" = 1432120521000;
"purchase_date_pst" = "2015-05-20 04:15:21 America/Los_Angeles";
quantity = 1;
"transaction_id" = 1000000155963876;
"web_order_line_item_id" = 1000000029780652;
},
{
"expires_date" = "2015-06-03 10:00:37 Etc/GMT";
"expires_date_ms" = 1433325637000;
"expires_date_pst" = "2015-06-03 03:00:37 America/Los_Angeles";
"is_trial_period" = false;
"original_purchase_date" = "2015-06-03 09:57:37 Etc/GMT";
"original_purchase_date_ms" = 1433325457000;
"original_purchase_date_pst" = "2015-06-03 02:57:37 America/Los_Angeles";
"original_transaction_id" = 1000000151202398;
"product_id" = "com.caocao.subscription";
"purchase_date" = "2015-06-03 09:57:37 Etc/GMT";
"purchase_date_ms" = 1433325457000;
"purchase_date_pst" = "2015-06-03 02:57:37 America/Los_Angeles";
quantity = 1;
"transaction_id" = 1000000157762774;
"web_order_line_item_id" = 1000000029780676;
}
);
receipt = {
"adam_id" = 0;
"app_item_id" = 0;
"application_version" = 1;
"bundle_id" = "com.LHB.caocao";
"download_id" = 0;
"in_app" = (
{
"is_trial_period" = false;
"original_purchase_date" = "2015-04-27 03:58:31 Etc/GMT";
"original_purchase_date_ms" = 1430107111000;
"original_purchase_date_pst" = "2015-04-26 20:58:31 America/Los_Angeles";
"original_transaction_id" = 1000000153126218;
"product_id" = "com.caocao.subscription";
"purchase_date" = "2015-04-27 03:58:31 Etc/GMT";
"purchase_date_ms" = 1430107111000;
"purchase_date_pst" = "2015-04-26 20:58:31 America/Los_Angeles";
quantity = 1;
"transaction_id" = 1000000153126218;
},
//......
{
"expires_date" = "2015-05-20 11:18:21 Etc/GMT";
"expires_date_ms" = 1432120701000;
"expires_date_pst" = "2015-05-20 04:18:21 America/Los_Angeles";
"is_trial_period" = false;
"original_purchase_date" = "2015-05-20 11:14:39 Etc/GMT";
"original_purchase_date_ms" = 1432120479000;
"original_purchase_date_pst" = "2015-05-20 04:14:39 America/Los_Angeles";
"original_transaction_id" = 1000000151202398;
"product_id" = "com.caocao.subscription";
"purchase_date" = "2015-05-20 11:15:21 Etc/GMT";
"purchase_date_ms" = 1432120521000;
"purchase_date_pst" = "2015-05-20 04:15:21 America/Los_Angeles";
quantity = 1;
"transaction_id" = 1000000155963876;
"web_order_line_item_id" = 1000000029780652;
},
{
"expires_date" = "2015-06-03 10:00:37 Etc/GMT";
"expires_date_ms" = 1433325637000;
"expires_date_pst" = "2015-06-03 03:00:37 America/Los_Angeles";
"is_trial_period" = false;
"original_purchase_date" = "2015-06-03 09:57:37 Etc/GMT";
"original_purchase_date_ms" = 1433325457000;
"original_purchase_date_pst" = "2015-06-03 02:57:37 America/Los_Angeles";
"original_transaction_id" = 1000000151202398;
"product_id" = "com.caocao.subscription";
"purchase_date" = "2015-06-03 09:57:37 Etc/GMT";
"purchase_date_ms" = 1433325457000;
"purchase_date_pst" = "2015-06-03 02:57:37 America/Los_Angeles";
quantity = 1;
"transaction_id" = 1000000157762774;
"web_order_line_item_id" = 1000000029780676;
}
);
"original_application_version" = "1.0";
"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";
"receipt_type" = ProductionSandbox;
"request_date" = "2015-06-03 09:58:07 Etc/GMT";
"request_date_ms" = 1433325487766;
"request_date_pst" = "2015-06-03 02:58:07 America/Los_Angeles";
"version_external_identifier" = 0;
};
status = 0;
}
使用transaction.transactionReceipt方式获取receipt (iOS6及下面获取receipt的方法)
普通付费
{
receipt = {//注意这里是字典
bid = "com.LHB.caocao";
bvrs = 1;
"item_id" = 573837050;
"original_purchase_date" = "2015-06-03 10:00:10 Etc/GMT";
"original_purchase_date_ms" = 1433325610666;
"original_purchase_date_pst" = "2015-06-03 03:00:10 America/Los_Angeles";
"original_transaction_id" = 1000000157763130;
"product_id" = "Iap_CaoCaoBXS_Arm_Buy1";
"purchase_date" = "2015-06-03 10:00:10 Etc/GMT";
"purchase_date_ms" = 1433325610666;
"purchase_date_pst" = "2015-06-03 03:00:10 America/Los_Angeles";
quantity = 1;
"transaction_id" = 1000000157763130;
"unique_identifier" = f8ba3cb4be1589fb9b75df93babb3560d280781d;
"unique_vendor_identifier" = "F9E0DAB3-5BC0-4196-B9F9-13C46616674D";
};
//注意这里不会下发latest_receipt_info字段
status = 0;
}
订阅模式
{
"latest_receipt" = "XXXXXX”;
"latest_receipt_info" = {//注意这里是字典
bid = "com.LHB.caocao";
bvrs = 1;
"expires_date" = 1433325817000;//注意这里的字段也不同
"expires_date_formatted" = "2015-06-03 10:03:37 Etc/GMT";
"expires_date_formatted_pst" = "2015-06-03 03:03:37 America/Los_Angeles";
"item_id" = 984396596;
"original_purchase_date" = "2015-04-10 06:39:41 Etc/GMT";
"original_purchase_date_ms" = 1428647981000;
"original_purchase_date_pst" = "2015-04-09 23:39:41 America/Los_Angeles";
"original_transaction_id" = 1000000151202398;
"product_id" = "com.caocao.subscription";
"purchase_date" = "2015-06-03 10:00:37 Etc/GMT";
"purchase_date_ms" = 1433325637000;
"purchase_date_pst" = "2015-06-03 03:00:37 America/Los_Angeles";
quantity = 1;
"transaction_id" = 1000000157763103;
"unique_identifier" = 000018c46730;
"unique_vendor_identifier" = "4AD81C5A-52E3-414D-9070-6ACC9B898CD6";
"web_order_line_item_id" = 1000000029863111;
};
receipt = {
bid = "com.LHB.caocao";
bvrs = 1;
"expires_date" = 1433325817000;
"expires_date_formatted" = "2015-06-03 10:03:37 Etc/GMT";
"expires_date_formatted_pst" = "2015-06-03 03:03:37 America/Los_Angeles";
"item_id" = 984396596;
"original_purchase_date" = "2015-04-10 06:39:41 Etc/GMT";
"original_purchase_date_ms" = 1428647981000;
"original_purchase_date_pst" = "2015-04-09 23:39:41 America/Los_Angeles";
"original_transaction_id" = 1000000151202398;
"product_id" = "com.caocao.subscription";
"purchase_date" = "2015-06-03 10:00:37 Etc/GMT";
"purchase_date_ms" = 1433325637000;
"purchase_date_pst" = "2015-06-03 03:00:37 America/Los_Angeles";
quantity = 1;
"transaction_id" = 1000000157763097;
"unique_identifier" = f8ba3cb4be1589fb9b75df93babb3560d280781d;
"unique_vendor_identifier" = "F9E0DAB3-5BC0-4196-B9F9-13C46616674D";
"web_order_line_item_id" = 1000000029863111;
};
status = 0;
}
因此,使用不同的方式获取receipt,返回的数据差异非常大
获取receipt的方法详情可參考http://blog.csdn.net/xyxjn/article/details/17116651
另外,自己主动订阅可视为非消费品,能够运行苹果恢复流程将其恢复。因为运行苹果恢复流程时。会将之前所有购买过的非消费品所有恢复(数据量较大),且会进入n次恢复回调(n为之前购买过的总次数)
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions中的
case SKPaymentTransactionStateRestored
只是这里不必将每次恢复回来的自己主动订阅数据都拿去苹果验证,由于科学研究表明,
測试环境下验证结果为订阅模式的恢复流程每次返回的receipt不同,但拿去苹果验证的返回结果基本是一样的(至少是眼下用到的数据结果是一样的)