Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

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

like image 382
Pierre Merienne Avatar asked Mar 26 '14 17:03

Pierre Merienne


People also ask

Does Google Play store have an API?

The Google Play Games Services Publishing API allows you to automate frequent tasks having to do with game services production and distribution. The Reporting API lets you retrieve information about your app's quality from Android vitals.

How do I get Google Play API?

Navigate to “IAM & Admin” and there to “Service Accounts”, if this view is not already open. The title should show “Service accounts for project Google Play Android Developer”. Here you'll see other service accounts if you already have some in place.

What is Google Play Services API?

Google Play services powers a broad set of APIs and services on Android to help you build your app, enhance privacy and security, engage users, and grow your business.


1 Answers

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.

like image 184
sibaz Avatar answered Oct 11 '22 21:10

sibaz