应用内购买已成功添加到应用中
IAP当前处于开发模式,我将IAP收据验证放在服务器端,并且工作正常。
现在,我想为IAP集成促销代码。但是它们可以在得到Apple的批准后生成(IAP评论)
问题:由于来自Apple Server的收据验证响应中不包含交易金额或任何促销代码字段,因此我如何检测到针对交易使用了促销代码
示例:
{
"receipt": {
"receipt_type": "ProductionSandbox",
"adam_id": 0,
"app_item_id": 0,
"bundle_id": "com.myApp",
"application_version": "14.06",
"download_id": 0,
"version_external_identifier": 0,
"receipt_creation_date": "2018-09-05 05:18:33 Etc/GMT",
"receipt_creation_date_ms": "1536124713000",
"receipt_creation_date_pst": "2018-09-04 22:18:33 America/Los_Angeles",
"request_date": "2018-09-25 04:53:09 Etc/GMT",
"request_date_ms": "1537851189557",
"request_date_pst": "2018-09-24 21:53:09 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": "com.myApp.testpack",
"transaction_id": "1000000439689939",
"original_transaction_id": "1000000439689939",
"purchase_date": "2018-09-05 05:03:52 Etc/GMT",
"purchase_date_ms": "1536123832000",
"purchase_date_pst": "2018-09-04 22:03:52 America/Los_Angeles",
"original_purchase_date": "2018-09-05 05:03:52 Etc/GMT",
"original_purchase_date_ms": "1536123832000",
"original_purchase_date_pst": "2018-09-04 22:03:52 America/Los_Angeles",
"is_trial_period": "false"
},
{
"quantity": "1",
"product_id": "com.myApp.testpack",
"transaction_id": "1000000439690499",
"original_transaction_id": "1000000439690499",
"purchase_date": "2018-09-05 05:09:38 Etc/GMT",
"purchase_date_ms": "1536124178000",
"purchase_date_pst": "2018-09-04 22:09:38 America/Los_Angeles",
"original_purchase_date": "2018-09-05 05:09:38 Etc/GMT",
"original_purchase_date_ms": "1536124178000",
"original_purchase_date_pst": "2018-09-04 22:09:38 America/Los_Angeles",
"is_trial_period": "false"
},
{
"quantity": "1",
"product_id": "com.myApp.testpack",
"transaction_id": "1000000439692512",
"original_transaction_id": "1000000439692512",
"purchase_date": "2018-09-05 05:18:01 Etc/GMT",
"purchase_date_ms": "1536124681000",
"purchase_date_pst": "2018-09-04 22:18:01 America/Los_Angeles",
"original_purchase_date": "2018-09-05 05:18:01 Etc/GMT",
"original_purchase_date_ms": "1536124681000",
"original_purchase_date_pst": "2018-09-04 22:18:01 America/Los_Angeles",
"is_trial_period": "false"
}
]
},
"status": 0,
"environment": "Sandbox"
}
我只想将交易期间使用的优惠券代码存储在数据库中以进行分析。
答案 0 :(得分:0)
@ Paulw11在评论中提到,无法从收据或应用程序本身中得知。
我开始寻找从App Analytics提取详细信息的方法,发现Apple提供了Reporter,可以让我们从App Analytics下载报告。这是基于Java的。但是人们也将其移植到另一种语言。
有用的库: