I am using auto renewal in-app purchase in one of my project.
For checking expiry date I am parsing receipt and comparing subscription date with today's date. For latest subscription I am picking up last object from latest_receipt_info key, but now I noticed that the sequence/sorting of latest_receipt_info is reverse in my receipt validation response, I mean latest subscription coming at 0 index (First and not last).
in_app key is also returning data in same manner.
I have couple of questions, can anyone help me out
- anyone faced this issue before?
- What is the right approach to check the latest subscription date
- latest_receipt key is also blank
I know the work around to have my own sorting on response, but looking for right approach.
Below is my receipt's response, I am only including required keys.
{
"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"
}]
}