Hi,
I'm working on an app that offers auto-renewable subscriptions on a monthly and yearly basis. The app (or the App Store Server Notification) sends the receipt to our trusted server which validates the receipts against https://buy.itunes.apple.com/verifyReceipt
We are able to validate first purchases and renewals by field latest_receipt_info
which contains an array with all the purchase transactions. However, when a user upgrades their monthly subscription to a yearly one, the array latest_receipt_info
doesn't contain the new subscription (the yearly one). The yearly subscription appears in the array pending_renewal_info
which doesn't contain the expiration_date or other fields required for updating our internal database.
We also tried to restore the purchase and validate the new receipt again but the yearly subscription never appears in latest_receipt_info
and always stays in pending_renewal_info.
How can I validate upgrades to yearly subscriptions? why doesn't it appear in latest_receipt_info?
Response from https://buy.itunes.apple.com/verifyReceipt by using the receipt sent by the App Store Server Notifications:
{
"environment": "Production",
"receipt": {
"receipt_type": "Production",
"adam_id": 987654321,
"app_item_id": 987654321,
"bundle_id": "com.company.productcompany",
"application_version": "1221",
"download_id": 5000000000000000000,
"version_external_identifier": 800000000,
"receipt_creation_date": "2021-11-26 09:39:12 Etc/GMT",
"receipt_creation_date_ms": "1637919552000",
"receipt_creation_date_pst": "2021-11-26 01:39:12 America/Los_Angeles",
"request_date": "2021-11-26 10:11:09 Etc/GMT",
"request_date_ms": "1637921469566",
"request_date_pst": "2021-11-26 02:11:09 America/Los_Angeles",
"original_purchase_date": "2021-11-17 13:50:18 Etc/GMT",
"original_purchase_date_ms": "1637157018000",
"original_purchase_date_pst": "2021-11-17 05:50:18 America/Los_Angeles",
"original_application_version": "1219",
"in_app": [
{
"quantity": "1",
"product_id": "com.company.product.subs1.onemonth",
"transaction_id": "150000000000000",
"original_transaction_id": "150000000000000",
"purchase_date": "2021-11-25 09:29:50 Etc/GMT",
"purchase_date_ms": "1637832590000",
"purchase_date_pst": "2021-11-25 01:29:50 America/Los_Angeles",
"original_purchase_date": "2021-11-25 09:29:50 Etc/GMT",
"original_purchase_date_ms": "1637832590000",
"original_purchase_date_pst": "2021-11-25 01:29:50 America/Los_Angeles",
"expires_date": "2021-12-25 09:29:50 Etc/GMT",
"expires_date_ms": "1640424590000",
"expires_date_pst": "2021-12-25 01:29:50 America/Los_Angeles",
"web_order_line_item_id": "150000419389034",
"is_trial_period": "false",
"is_in_intro_offer_period": "false",
"in_app_ownership_type": "PURCHASED"
}
]
},
"latest_receipt_info": [
{
"quantity": "1",
"product_id": "com.company.product.subs1.onemonth",
"transaction_id": "150000000000000",
"original_transaction_id": "150000000000000",
"purchase_date": "2021-11-25 09:29:50 Etc/GMT",
"purchase_date_ms": "1637832590000",
"purchase_date_pst": "2021-11-25 01:29:50 America/Los_Angeles",
"original_purchase_date": "2021-11-25 09:29:50 Etc/GMT",
"original_purchase_date_ms": "1637832590000",
"original_purchase_date_pst": "2021-11-25 01:29:50 America/Los_Angeles",
"expires_date": "2021-12-25 09:29:50 Etc/GMT",
"expires_date_ms": "1640424590000",
"expires_date_pst": "2021-12-25 01:29:50 America/Los_Angeles",
"web_order_line_item_id": "150000419389034",
"is_trial_period": "false",
"is_in_intro_offer_period": "false",
"in_app_ownership_type": "PURCHASED",
"subscription_group_identifier": "19900000"
}
],
"latest_receipt": "MII...Mk6fIA3",
"pending_renewal_info": [
{
"auto_renew_product_id": "com.company.product.subs1.twelvemonths",
"product_id": "com.company.product.subs1.onemonth",
"original_transaction_id": "150000000000000",
"auto_renew_status": "1"
}
],
"status": 0
}