ios in-app subscriptions - when does original_transaction_id change?
Asked Answered
T

1

22

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.

Tawana answered 25/9, 2013 at 9:11 Comment(2)
Yes, I'm also interested in the answer. Have you already figured it out?Diamante
Sometimes the test environment will generate a new original_transaction_id for every renewal. I'm not sure the test environment is a good indicator of anything.Calore
G
13

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.

Godly answered 19/1, 2019 at 14:50 Comment(3)
For the first and second case, does the two subscriptions have to be the same product?Raki
I got this response from Apple Developer Technical Support: "if an app validates the appStoreReceipt and also supports server-to-server notifications, then for the “same” periods in a receipt, the app process can use the original_transaction_id to match items on a server notification to the validated appStoreReceipt. However, I would not rely on the original_transaction_id remaining the same today as to a year from now."Kimmy
So if you can't rely on original_transaction_id on what would you rely if you do not want to login the user? We use cloudkit to get the iCloud id but with Family Purchases the user may not have iCloud configured. Any ideas? Maybe this deserves a question on its ownMassorete

© 2022 - 2024 — McMap. All rights reserved.