I am working an a project where I need to implement local receipt validation for auto-renewable subscription.
The local receipt validation already works for non-consumable purchases.
When I sent the receipt to the App Store for testing, to see how the receipt looks like, I got
the following JSON response back:
This is a short version of the JSON response.
["status": 0,
"receipt": {
"in_app" = (
{
"is_trial_period" = false;
"original_purchase_date" = "2019-11-22 18:25:10 Etc/GMT";
"product_id" = "NonConsumable";
…
},
{
"expires_date" = "2019-12-11 23:48:35 Etc/GMT";
"original_purchase_date" = "2019-12-11 23:43:37 Etc/GMT";
"product_id" = "MonthlySubscription“;
…
}
);
…
},
"pending_renewal_info": <__NSArrayM 0x283d7f3f0>(
{
"auto_renew_product_id" = "com.MonthlySubscription";
"auto_renew_status" = 0;
"expiration_intent" = 1;
"product_id" = "MonthlySubscription";
…
}
),
"environment": Sandbox,
"latest_receipt_info": <__NSArrayM 0x283d7f2d0>(
{
"is_trial_period" = false;
"original_purchase_date" = "2019-11-22 18:25:10 Etc/GMT";
"product_id" = "NonConsumable";
…
},
{
"expires_date" = "2019-12-11 23:48:35 Etc/GMT";
"original_purchase_date" = "2019-12-11 23:43:37 Etc/GMT";
"product_id" = "MonthlySubscription";
…
},
{
"expires_date" = "2019-12-11 23:53:35 Etc/GMT";
"original_purchase_date" = "2019-12-11 23:43:37 Etc/GMT";
"product_id" = "com.MonthlySubscription";
…
},
{
"expires_date" = "2019-12-11 23:58:35 Etc/GMT";
"original_purchase_date" = "2019-12-11 23:43:37 Etc/GMT";
"product_id" = "MonthlySubscription";
…
},
{
"expires_date" = "2019-12-12 00:03:35 Etc/GMT";
"original_purchase_date" = "2019-12-11 23:43:37 Etc/GMT";
"product_id" = "MonthlySubscription";
…
},
{
"expires_date" = "2019-12-12 00:08:35 Etc/GMT";
"original_purchase_date" = "2019-12-11 23:43:37 Etc/GMT";
"product_id" = "MonthlySubscription";
…
},
{
"expires_date" = "2019-12-12 00:13:35 Etc/GMT";
"original_purchase_date" = "2019-12-11 23:43:37 Etc/GMT";
"product_id" = "MonthlySubscription";
…
}
)
, "latest_receipt": MIIePwYJKoZIhvcNAQcCoIIeMDCCHiwCAQExCzAJBgUrDgMCGgUAMII…]
The JSON field "in_app" has only 2 receipts. One non-consumable and the first purchase of the auto-renewable subscription.
The complete list of the receipts are in the JSON field "latest_receipt_info“.
When I use local receipt validation and I look at ASN.1 Field Type 17 I only get the receipts that match the JSON field "in_app“.
Which means, looking at ASN.1 Field Type 17, I only get the non-consumable and the first purchase of the auto-renewable receipt.
All other subsequent receipts are missing.
How do I get to the other receipts so that I can find out when an auto-renewable subscription has expired?
Is there another Field Type not mentioned in the documentation or does it mean I can't use local receipt validation for auto-renewable subscription?