bizz84 / SwiftyStoreKit

Lightweight In App Purchases Swift framework for iOS 8.0+, tvOS 9.0+ and macOS 10.10+ ⛺

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Major glitch - Even subscription is expired, it gives as purchased (when subscription is upgraded to different subscription in subscription group)

phiren opened this issue · comments

Bug Report

Steps:

  1. Purchased free trial of product (yearly subscription) "#####.premiumyearly" on 15th July 2021
  2. Cancelled free trial and free trial expired on 18th July 2021
  3. On 30 Sept 2021, purchase yearly subscription "#####.premiumyearly" which will expire on 30 sept, 2022.
  4. Upgraded plan to monthly "#####. premiumMonthly" and it refunded yearly cost and charged monthly cost
  5. Cancelled monthly subscription which expired on 30th Oct 2021.
  6. But when try to validate, it is giving "#####.premiumyearly" as purchased. It should not give as purchased. (Shared receipt info as below)

To Reproduce
Difficult steps to reproduce, also not sure it is possible to reproduce in Development environment. But I have reproduced in production environment.

Fetched production receipt as below:
"latest_receipt_info" = (
{
"expires_date" = "2021-10-30 13:32:34 Etc/GMT";
"expires_date_ms" = 1635600754000;
"expires_date_pst" = "2021-10-30 06:32:34 America/Los_Angeles";
"in_app_ownership_type" = PURCHASED;
"is_in_intro_offer_period" = false;
"is_trial_period" = false;
"original_purchase_date" = "2021-07-15 17:31:35 Etc/GMT";
"original_purchase_date_ms" = 1626370295000;
"original_purchase_date_pst" = "2021-07-15 10:31:35 America/Los_Angeles";
"original_transaction_id" = 470000915211472;
"product_id" = "#####.premiumMonthly";
"purchase_date" = "2021-09-30 13:32:34 Etc/GMT";
"purchase_date_ms" = 1633008754000;
"purchase_date_pst" = "2021-09-30 06:32:34 America/Los_Angeles";
quantity = 1;
"subscription_group_identifier" = 20801591;
"transaction_id" = 470000976080132;
"web_order_line_item_id" = 470000423256270;
},
{
"expires_date" = "2022-09-30 13:30:15 Etc/GMT";
"expires_date_ms" = 1664544615000;
"expires_date_pst" = "2022-09-30 06:30:15 America/Los_Angeles";
"in_app_ownership_type" = PURCHASED;
"is_in_intro_offer_period" = false;
"is_trial_period" = false;
"is_upgraded" = true;
"original_purchase_date" = "2021-07-15 17:31:35 Etc/GMT";
"original_purchase_date_ms" = 1626370295000;
"original_purchase_date_pst" = "2021-07-15 10:31:35 America/Los_Angeles";
"original_transaction_id" = 470000915211472;
"product_id" = "#####.premiumyearly";
"purchase_date" = "2021-09-30 13:30:15 Etc/GMT";
"purchase_date_ms" = 1633008615000;
"purchase_date_pst" = "2021-09-30 06:30:15 America/Los_Angeles";
quantity = 1;
"subscription_group_identifier" = 20801591;
"transaction_id" = 470000976078370;
"web_order_line_item_id" = 470000391458152;
},
{
"expires_date" = "2021-07-18 17:31:35 Etc/GMT";
"expires_date_ms" = 1626629495000;
"expires_date_pst" = "2021-07-18 10:31:35 America/Los_Angeles";
"in_app_ownership_type" = PURCHASED;
"is_in_intro_offer_period" = false;
"is_trial_period" = true;
"original_purchase_date" = "2021-07-15 17:31:35 Etc/GMT";
"original_purchase_date_ms" = 1626370295000;
"original_purchase_date_pst" = "2021-07-15 10:31:35 America/Los_Angeles";
"original_transaction_id" = 470000915211472;
"product_id" = "#####.premiumyearly";
"purchase_date" = "2021-07-15 17:31:35 Etc/GMT";
"purchase_date_ms" = 1626370295000;
"purchase_date_pst" = "2021-07-15 10:31:35 America/Los_Angeles";
quantity = 1;
"subscription_group_identifier" = 20801591;
"transaction_id" = 470000915211472;
"web_order_line_item_id" = 470000391458151;
}
);

Expected behavior
if yearly subscription is switched to monthly subscription, it gives "is_upgraded" field in receipt. So when verity subscription, it should give as subscription expired or some different state instead of subscription purchased.

Platform Information

  • OS: iOS 15.1
  • Purchase Type: auto-renewable subscription
  • Environment: production
  • SwiftyStoreKit version: 0.16.3

Additional context

Found that in latest commit there is "is_upgraded" field is used, but it is not considering that field anywhere and it gives as purchased instead of expired or some other state.