简体   繁体   中英

How to handle auto renewable subscription resubscribe?

I am implementing auto renewable subscription in my iOS application. Monthly subscription auto renews after 5 mins in sandbox mode. I have added transaction observer in appDelegate. So when app restarts updated transaction method gets called and im getting following logs.

payment store product purchased il_pkg1_1month_2 payment storee product purchased transaction id Optional("1000000792969469") payment store product purchased il_pkg1_1month_2 payment storee product purchased transaction id Optional("1000000792972183") payment store product purchased il_pkg1_1month_2 payment storee product purchased transaction id Optional("1000000792976003") payment store product purchased il_pkg1_1month_2 payment storee product purchased transaction id Optional("1000000792978690") payment store product purchased il_pkg1_1month_2 payment storee product purchased transaction id Optional("1000000792982052")

My questions are

1)This method is not getting called when app is open and transaction is renewed. is this correct behaviour?

  1. I am planning to implement verification of receipt when this Method is called (on server side). So Suppose when i open app and transaction is auto renewed multiple times.Do i need to implement verify receipt for each transactions or the latest one only? How to verify receipt if app is open and transaction is auto renewed?

3)I have 3 kind of plans in same subscription group. I am not able to upgrade/downgrade in sandbox mode, is it possible to test upgrade/downgrade in sandbox mode?

4)After subscription has expired, if i renew subscription from manage subscription page updated transaction method is called but im getting same transaction as before renewal.Even transaction expiry date is same as before renewal. Is this correct behaviour, do i need to do any additional things.

Any help would be appreciated.

  1. That is the expected behaviour, also note that with each of the subsequent purchases there is an original_transaction_id so you can tell what the original purchase was.

  2. Whenever you call your server receipt verification, you send up the receipt data the app has currently, and Apple always returns the very latest receipt info. So you can call Apple whenever you like to verify a subscription is still active, or an any subsequent transition to verify a re-subscriptiuon happened. You can also store the data from the app receipt on the server to check from time to time only on the server side, to verify a subscription is still active and has not been cancelled.

  3. I think you used to be able to upgrade/downgrade in sandbox, if not from the sandbox account editing page in device settings, then try by allowing a downgrade/upgrade purchase in your app. At the very least I believe it should work using Xcode 12 App Store configuration local StoreKit testing.

  4. I am not sure if that behaviour you are seeing is normal, If you subscribe after a subscription has lapsed, it should behave like a new purchase - but would still have an original_transaction_id of the original subscription.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM