How do I associate a user with an auto-renewable subscription involving Apple's status notifications?

后端 未结 1 1344
悲哀的现实
悲哀的现实 2021-02-20 12:01

How do I associate an auto-renewable subscription in a way that lets me know which notifications are for which users in MY database? Is there some sort of id from the original r

1条回答
  •  你的背包
    2021-02-20 12:47

    Yes, you can use original_transaction_id. It's property saved for all renews.

    If the user cancels their subscription and buys a new subscription, then original_transaction_id will change.

    However, if the user upgrades or downgrades their subscription, original_transaction_id will not change.

    This is supported on modern versions of iOS, including iOS 10.

    Another way to do it is to save an array of transaction_id values and associate these with user accounts. Depending on your needs, this might work better for you.

    UPD by Stafox: time-to-time original_transaction_id may changes after renew and may still the same after cancel and resubscribe.

    0 讨论(0)
提交回复
热议问题