问题描述
我似乎碰到了一堵砖墙,但实际上我的应用程序中有一个用户登录页面和一个创建帐户页面。当用户打开我的应用程序并创建一个新帐户时,他们的信息将存储在Firebase服务器(BaSS)上。现在我的问题是如何去做因此,对于通过我的应用程序创建帐户的每个用户,他们都可以选择订阅我的应用程序,并且此订阅仅对其帐户有效(不是Apple ID)。目前,如果用户创建了一个帐户,并继续说订阅服务,一切正常,他们可以访问该应用程序的全部功能。
然而, ,当他们注销并创建另一个帐户时,因为现在订阅与用户的 apple ids 绑定,所以其他帐户或任何帐户都可以完全访问该应用程序。不仅仅是一个购买的。
所以我想我的问题是我将如何去做,使每个订阅/购买都与我的内部用户绑定,而不是设备上登录的 apple id 。 (基本上像 pandora 或 spotify ,其中您的应用程序取决于您的帐户,而不是您的苹果ID)
$ b $根据苹果文档: 坚持使用自己的服务器
将收据副本连同某种凭证或标识符一起发送到服务器,以便跟踪哪些收据属于特定用户。例如,让用户使用电子邮件或用户名和密码向服务器标识自己。不要使用UIDevice的identifierForVendor属性,因为不同的设备对这个属性有不同的值,所以你不能使用它来识别和恢复同一用户在不同设备上的购买。
如何使用Firebase做类似的事情?
当交易在iTunes上完成时,您将获得该购买的交易收据。此收据包含有关购买的各种信息。您可以将此收据存储在您的数据库中。在这个收据中,还有一个名为original_transaciton_identifier(OTI)的字段,这个标识符表示从该Apple ID制作的唯一的购买ID。现在,如果用户ID A向您发送OTI 11,请将其存储在您的数据库中针对用户A.当用户B登录并尝试恢复购买时,将更新的收据发送到您的服务器,从此收据中取出OTI,将其与数据库中存储的OTI进行比较,如果您没有发现任何内容,则意味着它是一个新的购买,否则你知道这个购买属于谁,你可以传达相同的用户B,这是链接到一些其他用户,尝试使用新的iTunes帐户购买。
I seem to have hit a brick wall, but essentially what I have in my app is a login page for the user and a create account page. When the user opens my app and creates a new account, their information is stored on a Firebase Server (BaSS).
Now my question is how would I go about making it so that for every user that created an account through my application, they have the option to subscribe to my application, and this subscription is only valid for their account (not apple id). Currently, if the user creates an account with me and proceeds to say subscribe to a service, everything works in the sense that they can access full features of the app.
However, when they logout and create another account, because as it stands right now the subscriptions are tied to the apple ids of the user, another account or any account for that matter would have full access to the application. Not just the one purchased.
So I guess my question is how would I go about making it so that each subscription/ purchase is tied to my in-house users, not the apple id logged in on the device. (Essentially like pandora or spotify, where your access to the app depends on your account with them, not your apple id)
According to apple documentation:
How would I go about doing something like that using Firebase?
When the transaction get completed on iTunes you get a transaction receipt for that purchase. This receipt contains various information about the purchase. You can store this receipt in your DB. In this receipt, there is also a field named "original_transaciton_identifier(OTI)", this identifier denotes the unique id of purchase made from that Apple id. Store this unique identifier in your DB against the user id which is sending it first.
So now, if user id A sends you an OTI 11, store it in your DB against user A. When user B logs in and tries to restore purchase, send the updated receipt to your server, take out the OTI from this receipt, compare it with the OTIs stored in your DB, if you do not find anything then it means its a new purchase, otherwise you know to whom does this purchase belong and you can convey the same to user B that this is linked to some other user, try making a purchase with a new itunes account.
这篇关于如何使自动更新订阅绑定到内部用户,而不是苹果ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!