如何使自动续订订阅与内部用户绑定,而不是苹果ID?

时间:2022-04-25 11:24:06

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).

我似乎打了一堵砖墙,但基本上我在我的应用程序中的是用户的登录页面和创建帐户页面。当用户打开我的应用并创建新帐户时,他们的信息将存储在Firebase服务器(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.

现在我的问题是我将如何制作它,以便对于通过我的应用程序创建帐户的每个用户,他们都可以选择订阅我的应用程序,并且此订阅仅对其帐户有效(不是苹果ID)。目前,如果用户与我创建一个帐户并继续说订阅服务,那么一切都可以访问应用程序的完整功能。

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.

但是,当他们注销并创建另一个帐户时,因为现在它的订阅与用户的苹果ID相关联,另一个帐户或任何帐户可以完全访问该应用程序。不只是购买的那个。

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)

所以我想我的问题是如何制作它以便每次订阅/购买都与我的内部用户绑定,而不是设备上登录的苹果ID。 (基本上像pandora或spotify,您对应用的访问权限取决于您的帐户,而不是您的苹果ID)

According to apple documentation:

根据苹果文档:

Persisting Using Your Own Server Send a copy of the receipt to your server along with some kind of credentials or identifier so you can keep track of which receipts belong to a particular user. For example, let users identify themselves to your server with an email or user name, plus a password. Don’t use the identifierForVendor property of UIDevice—you can’t use it to identify and restore purchases made by the same user on a different device, because different devices have different values for this property.

持续使用您自己的服务器将收据的副本连同某种凭据或标识符一起发送到您的服务器,以便您可以跟踪哪些收据属于特定用户。例如,让用户使用电子邮件或用户名以及密码向服务器标识自己。不要使用UIDevice的identifierForVendor属性 - 您不能使用它来识别和恢复同一用户在其他设备上进行的购买,因为不同的设备对此属性具有不同的值。

How would I go about doing something like that using Firebase?

我如何使用Firebase做类似的事情?

1 个解决方案

#1


5  

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.

在iTunes上完成交易后,您将获得该购买的交易收据。此收据包含有关购买的各种信息。您可以将此收据存储在数据库中。在此收据中,还有一个名为“original_transaciton_identifier(OTI)”的字段,该标识符表示从该Apple ID进行的购买的唯一ID。将此唯一标识符存储在您的数据库中,与首先发送它的用户ID相对应。

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 A向您发送OTI 11,则将其存储在您的数据库中,防止用户A.当用户B登录并尝试恢复购买时,将更新的收据发送到您的服务器,从此收据中取出OTI,比较将OTI存储在您的数据库中,如果您没有找到任何内容,那么这意味着它是一个新的购买,否则您知道此购买属于谁,您可以将其传达给用户B,这与其他用户相关联,尝试使用新的iTunes帐户进行购买。

#1


5  

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.

在iTunes上完成交易后,您将获得该购买的交易收据。此收据包含有关购买的各种信息。您可以将此收据存储在数据库中。在此收据中,还有一个名为“original_transaciton_identifier(OTI)”的字段,该标识符表示从该Apple ID进行的购买的唯一ID。将此唯一标识符存储在您的数据库中,与首先发送它的用户ID相对应。

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 A向您发送OTI 11,则将其存储在您的数据库中,防止用户A.当用户B登录并尝试恢复购买时,将更新的收据发送到您的服务器,从此收据中取出OTI,比较将OTI存储在您的数据库中,如果您没有找到任何内容,那么这意味着它是一个新的购买,否则您知道此购买属于谁,您可以将其传达给用户B,这与其他用户相关联,尝试使用新的iTunes帐户进行购买。