ios in-app subscriptions - when does original_transaction_id change?

泄露秘密 提交于 2019-12-21 03:47:14

问题


When there is an auto-renewing subscription, consider the following model situation:

  • user buys 1 month subscription, lets say in January
  • cancels renewal
  • then waits until March (>1 month) and buys same subscription again

Does the AppStore return (on receipt verification) a new original_transaction_id for the new purchase? Or rephrased, can original_transaction_id be used for grouping receipts to determine intervals when user had active subscription?

Because in sandbox, when there is a simulated situation like this, it returns always original_transaction_id from the FIRST purchase of given subscription, regardless if there were some intervals where user had not active subscription. When there was multiple purchases of subscription with intervals between, when it was expired, Sandbox receipt verification returns original_purchase_date of first purchase, and expires_date of last purchase.

My problem is, to test it in live enviroment, I would have to wait more than a month to let subscriptions expire to test the exact behaviour.


回答1:


I have maintained an production app with subscription for several years.

As far as I see, original_transaction_id does not change in that case you mentioned.

Moreover, original_transaction_id belongs to subscription group, not each product_id.

So it remains same in below cases.

  • User start subscription, stop auto-renew and expire, then start subscription again.
  • User start subscription and cancel it, but start again.
  • User start subscription and upgrade or downgrade to subscription in same group.

But this is not a guaranteed result, so you would better prepare in case original_transaction_id changes.




回答2:


Original_transaction_id is (All receipts in a chain of renewals for an auto-renewable subscription have the same value for this field.)

Expires_date is (The expiration date for the subscription, expressed as the number of milliseconds since January 1, 1970, 00:00:00 GMT.)

Reference: https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Chapters/ReceiptFields.html#//apple_ref/doc/uid/TP40010573-CH106-SW12

Why do you want to test it in real scenario when you may test in it simulated environment as per apple's guidelines at https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnectInAppPurchase_Guide/Chapters/TestingInAppPurchases.html ?



来源:https://stackoverflow.com/questions/19000758/ios-in-app-subscriptions-when-does-original-transaction-id-change

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!