Android应用内购买,如何检查用户是否购买了一件商品

标签 android paypal in-app-purchase paypal-sandbox in-app-billing

在 SharedPreference 中设置一个值以标记用户已购买此项目是否可以安全?如果用户在 SharedPreference 中破解此值怎么办。或者我需要每次都连接 IAP 服务以检查用户是否可以使用它?

(1) 使用 Google Android IAP V3 时的最佳做法是什么?

(2) 而且如果用户的设备没有安装 Google Play,我可能想使用 paypal 进行付款,但是如果我要求用户使用简单的 paypal 付款,如何跟踪购买并为用户解锁功能获得许可证 key ?我不想使用任何其他计费SDK,如果用Paypal网页购买license,如何实现?

最佳答案

(1) 使用 Google Android IAP V3 时的最佳做法是什么?

--> 官方文档说只有支付交易会由 google play 自己处理,但是在应用程序中你必须设置你的业务逻辑如何在购买产品后处理 UI 集成和其他事情。您还可以使用应用内购买 v3。

(2) 而且如果用户的设备没有安装 Google Play,我可能想使用 paypal 进行付款,但是如果我要求用户使用简单的 paypal 付款,如何跟踪购买并为用户解锁功能获得许可证 key ?我不想使用任何其他计费SDK,如果用Paypal网页购买license,如何实现?

--> 您可以要求用户动态更新 google play 版本。谷歌开发者文档说超过 90% 的设备使用 2.2 操作系统并安装了谷歌游戏商店。我不能说任何关于 paypal 交易的事情,因为我以前没有使用过它,但是是的,在应用程序购买中使用 v3 非常容易实现和理解支付过程。

如何在您的应用程序中使用

Three way to manage your application's product data.

1) 共享偏好: 您可以使用 share prefrence value 并检查它是否被购买。如果万一用户卸载了该应用程序然后重新安装该应用程序,那么您可以检查用户是否已购买,此时您会得到该项目已购买。而且您必须管理用户才能访问您的应用程序数据。

2)本地数据库: 您还可以使用本地 sqlite 数据库来存储购买详细信息和购买状态。和上面一样,如果用户清除数据或卸载应用程序,然后再次请求购买商品并检查用户是否购买了商品。

2) 服务器数据库: 如果您使用网络服务器来存储用户数据,这是比上面更好的方法。在这种情况下,如果用户卸载应用程序或清除应用程序数据,您甚至不需要进行第二次管理。

3) 混淆:(与共享偏好相比最有效的方法)

编辑:

在 SharedPreference 中设置一个值来标记用户已购买此项目是否可以安全?如果用户在 SharedPreference 中破解此值怎么办。或者我需要每次都连接 IAP 服务以检查用户是否可以使用它?

当我在互联网上搜索时,我发现 Nikolay Elenkov 的 答案如下:

If you just save a flag in shared preferences, any user with a rooted device can flip the flag at will and be 'subscribed' without paying. So you should at least do some obfuscation. Here's a sample way to do it. Additionally, there is an API to check for subscription state, so you should check periodically to make sure the subscription is valid.

更多信息查看Nikolay Elenkov's answer

应用内购买或 Paypal 哪个最适合结算?

这取决于产品类型,

--> In app billing: Best for google in app billing,

For the digital products including downloadable content such as media files or photos, virtual content such as game levels or potions, premium services and features, and more.

http://developer.android.com/google/play/billing/index.html

--> Paypal: Best for Paypal billing,

For physical content or product do you want to share. You are not permitted to sell physical goods or services using 'In-App Purchasing' since the goods purchased via this method must relate directly to the app using them.

Purchase physical product from iPhone app without Apple in app purchase

希望对您有所帮助。

关于Android应用内购买,如何检查用户是否购买了一件商品,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19242939/

相关文章:

android - 二进制 XML 文件行 #13 : Error inflating class on a class that extends VideoView

php - 麻烦整合 Paypal 信用卡支付

ios - 客户的应用内购买,付款问题

macos - 交易收据属性 : can't find it anymore?

android - 是否可以取消注册 BroadCast Lister

java - 如何验证 Wifi AP 或 Cell 是否有互联网?

api - 我需要帮助查找 Paypal 客户端 ID 和客户端 secret ID

c# - 使用 PayPal HERE 和 PayPal API

订阅的 Android IABv3 getSkuDetails 不返回结果

android - 如何使蓝牙 SPP 连接过程更可靠?