我正在使用自动更新应用程序购买在我的项目之一。
为了检查过期日期,我正在解析收据,并将订阅日期与今天的日期进行比较。对于最新的订阅,我从latest_receipt_info键中获取最后一个对象,但现在我注意到latest_receipt_info的序列/排序在我的收据验证响应中是相反的,我指的是在0索引处出现的最新订阅(首先而不是最后)。
in_app键也以相同的方式返回数据。
我有几个问题,有人能帮我吗?
以前有人遇到过这个问题吗? date
我知道这方面的工作,有我自己的排序对回应,但寻找正确的方法。
下面是我的收据的回复,我只包括所需的钥匙。
{
"status": 0,
"environment": "Production",
"receipt": {
//other keys/values
"in_app": [
{
"product_id": "MyTestMontlyPlan",
**"expires_date": "2020-06-29 14:47:20 Etc/GMT",**
//other keys/values
},
{
"product_id": "MyTestMontlyPlan",
**"expires_date": "2020-05-29 14:47:20 Etc/GMT",**
//other keys/values
}]},
"latest_receipt_info": [
{
"product_id": "MyTestMontlyPlan",
**"expires_date": "2020-06-29 14:47:20 Etc/GMT",**
},
{
"product_id": "MyTestMontlyPlan",
**"expires_date": "2020-05-29 14:47:20 Etc/GMT",**
}],
"latest_receipt": "...", //idk why it is blank, in sandbox we receive receipt data here
"pending_renewal_info": [
{
"auto_renew_product_id": "MyTestMontlyPlan",
"original_transaction_id": "#############",
"product_id": "MyTestMontlyPlan",
"auto_renew_status": "1"
}]
}发布于 2020-06-20 12:53:27
为了安全起见,现在按照pruchase_date_*对这些数组进行排序,您应该自己对这个数组进行排序,以防止将来发生任何更改。筛选出具有前一个到期日期并已升级的事务。
https://stackoverflow.com/questions/62433355
复制相似问题