android - 恢复应用内购买的安全问题

标签 android ios iphone in-app-purchase

所以,我有一个刚刚被 Apple 拒绝的应用程序,因为它没有为用户实现 restorePurchases 按钮来恢复他们购买的任何非消耗品。

我理解这背后的逻辑,并为错过它感到难过(或者不理解其实现的阻塞方面,至少),但我有一个不寻常的案例(我不确定这是否不寻常,但找不到很多关于它的最佳实践......)

我的应用程序是跨平台的,因此用户可以在 Android 和 iOS 上购买相同的商品,并且这些购买需要跨平台保留...因此,在成功验证后,我在后端更新了一个值两个客户端都具有读写权限。

正因为如此,我认为我坚持跨设备和平台的购买很好......但购买与我的应用程序用户类上的帐户相关联。

现在,如果我要按照 Apple 的要求实现按钮,是什么阻止用户将与 Apple ID 关联的购买 恢复到我的应用程序数据库中的另一个用户...可能导致可以说是“收入泄漏”-例如,以 friend 用户身份登录,恢复购买,在我的情况下,这会将购买复制到用户类......然后我有两个用户只有一个关联收入...

所以...问题:

1) 我是否对欺骗系统的能力太天真了? 2) 有没有人有关于如何解决/解决此问题的最佳实践?

最佳答案

Apple 在 In-App Purchase Programming Guide 中解决了这个问题

首先,您可以将购买信息提供给您的用户账户名,以协助Apple检测异常 Activity -

Detecting Irregular Activity

The App Store uses an irregular activity detection engine to help combat fraud. Some apps can provide additional information to improve the engine’s ability to detect unusual transactions. If your users have an account with you, in addition to their App Store accounts, provide this additional piece of information when requesting payment.

然后,在恢复购买时,您可以将相同的用户帐户信息提供给 restoreCompletedTransactionsWithApplicationUsername: 方法 -

Restoring Completed Transactions

Your app starts the process by calling the restoreCompletedTransactions method of SKPaymentQueue. This sends a request to the App Store to restore all of your app’s completed transactions. If your app sets a value for the applicationUsername property of its payment requests, as described in Detecting Irregular Activity, use the restoreCompletedTransactionsWithApplicationUsername: method to provide the same information when restoring transactions.

最后,您可以使用服务器上的收据信息将原始交易与同一用户标识的恢复交易相关联,如果不匹配则不恢复功能。

关于android - 恢复应用内购买的安全问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27412318/

相关文章:

java - 将值分配给列表<String[]>

ios - UITableViewCell 不显示文字

android - 如何将验证器传递给 Flutter 中的 `TextFormField'?

iphone - 当父键未知时在嵌套的 NSDictionary 中查找对象?

getInputStream() 上的 java.io.FileNotFoundException

android - Kotlin Observer lambda 语法?

ios - 使用 SwiftUI 实现应用内购买

iphone - 如何让 UILabel 在 Storyboard(或界面生成器)中自动调整文本大小,而不是以编程方式

android - PowerVR-SGX500 系列异常行为

ios - 如何监听 Firebase 任务完成?