I have got StoreKit to work for auto-renewable subscriptions and can successfully buy and renew subscriptions via the Sandbox. So far, so good.
The problem I am having is that the expiry date being returned by apple seems in-correct.
When first purchasing the subscription, it gives you a receipt
response. In this response it gives you expires_date_formatted
, this is obtained by querying the receipt
or latest_receipt_info
part of the response back from apple.
When the subscription has expired, you will get a latest_expired_receipt_info
response (this does not appear in regular purchases and only when the receipt has expired).
For whatever reason, the latest_expired_receipt_info
has a different date stored inside expires_date_formatted
, and its causing me all sorts of headaches.
Usually my app will report that the subscription has expired but when you try to repurchase a subscription, it will say that the subscription is still active.
This seems to imply that the date inside latest_expired_receipt_info
is accurate, but there appears to be no way to get that date (unless you intentionally let the subscription expire).
Examples:
receipt (stored) = {
bid = "myappid.goeshere";
bvrs = "1.0";
"expires_date" = 1321365095905;
"expires_date_formatted" = "2011-11-15 13:51:35 Etc/GMT";
...other stuff....
}
latest_expired_receipt_info = {
bid = "myappid.goeshere";
bvrs = "1.0";
"expires_date" = 1321366860000;
"expires_date_formatted" = "2011-11-15 14:21:00 Etc/GMT";
...other stuff...
}
In the above example, we can see that the expires_date_formatted
is totally different, one says 13:51, the other says 14:21
In other tests the difference can be anything from a few minutes to ten or twenty minutes.
How do I get the correct expires_date_formatted
?