Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 receipt that I can store as a field for a User?

It is great that I know when a user cancels or renews, etc but it doesn't help that I am not sure which user this is happening for.

When you visit the docs and scroll down to Status Update Notifications, you'll notice that status notifications do have an original_transaction_id field, is this something that persists and can be relied on?

like image 479
AppreciateIt Avatar asked Jul 16 '17 03:07

AppreciateIt


People also ask

Do Apple Subscriptions automatically renew?

They automatically renew at the end of their duration until the user chooses to cancel. Subscriptions are available on iOS, iPadOS, macOS, watchOS, and tvOS.

How do I see my Apple recurring Subscriptions?

Open the Settings app. Tap your name. Tap Subscriptions. Tap the subscription.

How do I add Subscriptions to Apple settings?

Open the Settings app. Tap your name, then tap Subscriptions. Tap the name of the subscription that you want to change. Tap See All Plans, then follow the onscreen instructions to complete your purchase.


1 Answers

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.

like image 181
Vladimir Prigarin Avatar answered Oct 02 '22 08:10

Vladimir Prigarin