简体   繁体   English

有没有办法从后端服务器使用 google play 应用内产品?

[英]Is there a way to consume google play in-app products from backend server?

Consuming google play in-app products can easily be done from the client application ( http://developer.android.com/google/play/billing/api.html#consume ).从客户端应用程序 ( http://developer.android.com/google/play/billing/api.html#consume ) 可以轻松消费 google play 应用内产品。

However I can't find any information about doing this consume request from a backend server.但是我找不到有关从后端服务器执行此消费请求的任何信息。 The Purchase Status API ( http://developer.android.com/google/play/billing/gp-purchase-status-api.html ) is designed to be used from backend servers, however it doesn't provide any methods to consumes in-app products.购买状态 API ( http://developer.android.com/google/play/billing/gp-purchase-status-api.html ) 旨在从后端服务器使用,但它不提供任何消费方法应用内产品。

Is there a way to consume google play in-app products from backend server?有没有办法从后端服务器使用 google play 应用内产品?

I'm trying to implement something that sounds similar to your approach.我正在尝试实施听起来与您的方法相似的东西。 In our case our target audience is children, hence we're not expecting the consumer to be the person paying, and that the parent might buy several copies, one for each child.在我们的案例中,我们的目标受众是儿童,因此我们不希望消费者是付费的人,并且父母可能会购买几本,每个孩子一份。 Hence the normal model (of one thing per customer) doesn't work.因此,正常模型(每个客户一件事)不起作用。

As licencing (per child) is actually dealt with by our servers, any payments (we're handling them as a consumables), have to be actioned on the app, then the token passed to the server to be verified, then the server updates the licenses, and the next time the child concerned interrogates their licences, they perceive the payment to have been actioned.由于许可(每个孩子)实际上由我们的服务器处理,因此任何付款(我们将它们作为消耗品处理)都必须在应用程序上进行操作,然后将令牌传递给服务器进行验证,然后服务器更新证,以及有关儿童下次询问他们的证照时,他们认为付款已付诸行动。 The app then has to mark them as consumed, even though activation is not something it has direct control of.然后应用程序必须将它们标记为已消费,即使激活不是它可以直接控制的。 Instead it seems the only option is to manage a table of all of the purchaseTokens, and mark them internally as consumed, and so the app has to periodically ask if any of the tokens pending for the current (google) user, need consuming, and tick them off when they do.相反,似乎唯一的选择是管理所有购买令牌的表,并在内部将它们标记为已消费,因此应用程序必须定期询问当前(谷歌)用户是否有任何待处理的令牌需要消费,以及当他们这样做时,请勾选它们。 As an extension to this, we have to over complicate the payment process by checking ourselves if the child requesting (or the google user that's paying) should be blocked from proceeding, in case they have payments that might be pending from another child.作为对此的扩展,我们必须通过检查自己是否应该阻止请求的孩子(或正在付款的谷歌用户)继续付款,从而使付款过程过于复杂,以防他们的付款可能来自另一个孩子的待处理。

It would be so much simpler, if google were to allow the server to mark the consumable as used, but I've yet to find a solution.如果谷歌允许服务器将消耗品标记为已使用,那就简单多了,但我还没有找到解决方案。 Lets hope APIv4 has it.让我们希望 APIv4 拥有它。

It's now possible to at least Acknowledge using the Android Publisher V3 API, see:现在至少可以使用 Android Publisher V3 API 进行确认,请参阅:

https://developers.google.com/android-publisher/getting_started https://developers.google.com/android-publisher/getting_started

https://developers.google.com/android-publisher/api-ref/purchases/products/acknowledge https://developers.google.com/android-publisher/api-ref/purchases/products/acknowledge

Looks like Consume is still only possible from the client.看起来消费仍然只能从客户端进行。

The purchases.products.consume of the Android Publisher V3 API could consume a purchase for an inapp item. Android Publisher V3 API 的purchases.products.consume可以消费 inapp 项目的购买。

https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.products/consume https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.products/consume

POST https://androidpublisher.googleapis.com/androidpublisher/v3/applications/{packageName}/purchases/products/{productId}/tokens/{token}:consume

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在服务器端消费Google In-App购买 - How to consume Google In-App purchases Server-side 谷歌游戏控制台。 您的应用还没有任何应用内商品 - Google Play Console. Your app doesn't have any in-app products yet 在 Flutter 中从 Play 商店获取产品时应用内购买崩溃 - in-app purchase crashes when fetching products from the Play Store in Flutter Google为多种产品播放In App Billing Services - Google play In App Billing Services for multiple products Google Play应用内结算onPurchasesUpdated()错误响应代码-1 - Google Play in-app Billing onPurchasesUpdated() error response code -1 获取Google Play应用内订阅的截止日期 - Getting the expiration date for Google Play In-App Subscriptions 将APK的草稿上传到Google Play中以测试应用内结算 - Uploading draft of APK into Google Play to test In-App Billing 应用内计费确认购买问题[使用谷歌播放应用内计费库] - In-app billing acknowledgePurchase issue [using google play in-app billing library] Android应用内结算处理Google Server响应代码 - Android in-app billing handling google Server Response Codes Google Play Inapp Billing v3:后端服务器的用途是什么? - Google Play Inapp Billing v3: what is the purpose of Backend Server?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM