Google Play Developer API使用方法

By admin, 24 十二月, 2018

目标:验证Android支付有效性

原始文档入口:https://developer.android.com/google/play/billing/billing_library_overview#Verify-purchase

具体访问的API:https://developers.google.com/android-publisher/api-ref/purchases/products/get

在访问该API前,我们需要做身份认证:https://developers.google.com/android-publisher/authorization

看不明白上面教做身份认证的页面,里面有一个更详细的:Using OAuth 2.0 for Web Server Applications

这是一个PHP访问Google API的官网入口:https://developers.google.com/api-client-library/php/

上面的链接可能是有误导的,我们需要做的可能是:Using OAuth 2.0 for Server to Server Applications:https://developers.google.com/api-client-library/php/auth/service-accounts

需要到Github下载PHP库,代码中的README用法似乎也是很好的入门资料:https://github.com/googleapis/google-api-php-client

API Explore可以帮助我们在网页上试用API,可以忽略身份认证等细节,直接试试API怎么用,返回什么数据:https://developers.google.com/apis-explorer/#p/

 

PHP调用Google API的库是beta版,有可能不太能用。试试更成熟的Python 版本:https://developers.google.com/api-client-library/python/

 

这里有一个包含截图,step-by-step的教程:https://stackoverflow.com/questions/35127086/android-inapp-purchase-receipt-validation-google-play

这里有一个Python的教程,应该可以更好地帮助理解怎么用Google  API Client Libraries:https://developers.google.com/api-client-library/python/start/get_started

标签

评论

Restricted HTML

  • 允许的HTML标签:<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <img src>
  • 自动断行和分段。
  • 网页和电子邮件地址自动转换为链接。
验证码
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
请输入"Drupal10"