Hi there,
I have two problems about subscription purchase in IAP 1.23.0.
In a sandbox test of iOS, there are following 2 issues:
(1) Subscription status is not updated automatically
I purchased a subscription product.
I called “CheckSubscription()” and got the first subscription status such as “isExpired()” or ”getExpireDate()”.
After 5 minutes (1 month) from the first purchase, these statuses did not change.
Then, I purchased the subscription product again.
Dialog of iPhone mentioned “You’ve Already Purchased This Subscription”.
I got the second subscription status after that.
After 5 more minutes, this status will not be updated to the 3rd subscription status.
It is same if I wait for 30 minutes or 1 hour.
(2) Receipt is missing after closing the app
Once I shutdown the app and start again, “m_StoreController.products.WithID(productID).receipt” become null.
I was not able to check the subscription status.
Then, I purchased the subscription product again.
Dialog mentioned “You’ve Already Purchased This Subscription”.
I got the latest subscription status.
It will not be updated as I wrote in (1).
I use the following code to check the subscription status.
How can I solve these problems?
Do I need to do anything else to get latest status and keep receipt info?
public bool CheckSubscription(string productID) {
var item = m_StoreController.products.WithID(productID);
Dictionary<string, string> introductory_info_dict = m_AppleExtensions.GetIntroductoryPriceDictionary();
if (item.availableToPurchase)
{
if (item.receipt != null) {
if (item.definition.type == ProductType.Subscription) {
string intro_json = (introductory_info_dict == null || !introductory_info_dict.ContainsKey(item.definition.storeSpecificId)) ? null : introductory_info_dict[item.definition.storeSpecificId];
SubscriptionManager p = new SubscriptionManager(item, intro_json);
SubscriptionInfo info = p.getSubscriptionInfo();
Debug.Log("info.isExpired=" + info.isExpired());
Debug.Log("info.getExpireDate=" + info.getExpireDate());
return true;
} else {
Debug.Log("This product is not a subscription product");
}
} else {
Debug.Log("This product should have a valid receipt");
}
} else {
Debug.Log("Not available for purchase");
}
return false;
}