Calling Google Play Purchase Status API from App Engine

148 views
Skip to first unread message

Pertti Kellomäki

unread,
Oct 24, 2013, 7:27:17 AM10/24/13
to google-a...@googlegroups.com
I need to verify Android inapp purchases (subscriptions to a web site)
in my App Engine based server. It looks easy enough to do with the
Purchase Status API [1], but I'm not sure I understand the
authentication required.

According to the documentation, calls to the API are authenticated
with OAuth2, and from what I have gathered it uses the web server
flow. If really necessary I can go through the oauth dance, get a
refresh token, and embed it in my application. Is this really the
only/correct way to do it?

[1] <http://developer.android.com/google/play/billing/gp-purchase-status-api.html>
--
Pertti

Pertti Kellomäki

unread,
Oct 24, 2013, 3:16:12 PM10/24/13
to google-a...@googlegroups.com
For the record, I ended up following the directions in
<https://milancermak.wordpress.com/2012/08/24/server-side-verification-of-google-play-subsc/>
to get a refresh token. The procedure is somewhat clumsy but not too
painful. In the server, I create an
oauth2client.client.OAuth2Credentials instance with a fake access
token and the real refresh token, and use .refresh() to force fetching
a new access token.

Getting the purchase status from Google Play is a simple http GET
which I do with urlfetch.fetch().

Pertti
Reply all
Reply to author
Forward
0 new messages