android - 使用谷歌采购 REST API 时出现 500 错误

标签 android api in-app-purchase google-play

我正在开发一款使用 Google Play 新订阅功能的 Android 应用。我的应用程序的一部分包含一个 Web 服务器,该服务器通过 API 调用定期检查这些订阅的状态。它还取消了其中一些订阅。

Google 提供了两个 REST API 来完成此任务:

https://developers.google.com/android-publisher/v1/purchases/get

https://developers.google.com/android-publisher/v1/purchases/cancel

我可以让第一个使用 OAuth 的人工作得很好。但是,当我尝试取消某些订阅时,我收到了没有详细信息的 500 错误。还有其他人经历过吗?我使用不正确吗?我确定 OAuth 正在运行,因为我可以访问第一个 API。这是我的 curl 输出,其中隐藏了我的一些帐户数据:

curl -X POST 'https://www.googleapis.com/androidpublisher/v1/applications/com.ssd.mypkg/subscriptions/mysku/purchases/mypurchasetoken/cancel' -H 'Authorization: OAuth ya29.myoauth' -d '' -v
* About to connect() to www.googleapis.com port 443 (#0)
*   Trying 209.85.148.95... connected
* Connected to www.googleapis.com (209.85.148.95) port 443 (#0)
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using RC4-SHA
* Server certificate:
*    subject: C=US; ST=California; L=Mountain View; O=Google Inc; CN=*.googleapis.com
*    start date: 2012-06-14 06:42:53 GMT
*    expire date: 2013-06-07 19:43:27 GMT
*    subjectAltName: www.googleapis.com matched
*    issuer: C=US; O=Google Inc; CN=Google Internet Authority
*    SSL certificate verify ok.
> POST /androidpublisher/v1/applications/com.ssd.mypkg/subscriptions/mysku/purchases/mypurchasetoken/cancel HTTP/1.1
> User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5
> Host: www.googleapis.com
> Accept: */*
> Authorization: OAuth ya29.myoauth
> Content-Length: 0
> Content-Type: application/x-www-form-urlencoded
> 
< HTTP/1.1 500 Internal Server Error
< Content-Type: application/json; charset=UTF-8
< Date: Fri, 06 Jul 2012 15:23:10 GMT
< Expires: Fri, 06 Jul 2012 15:23:10 GMT
< Cache-Control: private, max-age=0
< X-Content-Type-Options: nosniff
< X-Frame-Options: SAMEORIGIN
< X-XSS-Protection: 1; mode=block
< Server: GSE
< Transfer-Encoding: chunked
< 
{
 "error": {
  "code": 500,
  "message": null
 }
}
* Connection #0 to host www.googleapis.com left intact
* Closing connection #0
* SSLv3, TLS alert, Client hello (1):

最佳答案

我可以确认我遇到了完全相同的问题。获取详细信息非常有效,但取消失败。我正在为 Java 类使用 Google API,所以我认为这是一个普遍问题,我们应该将其作为错误发布到谷歌。

这是我从谷歌服务器收到的响应:

com.google.api.client.googleapis.json.GoogleJsonResponseException: 500 Internal Server Error
{
  "code" : 500,
  "message" : null
}

关于android - 使用谷歌采购 REST API 时出现 500 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11369332/

相关文章:

android - 如何在支持自然景观设备的情况下检测左景观(正常)与右景观(反向)?

android - 出于性能目的,在 AppCompat 1.4.0 及更高版本的 textview 中禁用 emoji2

javascript - 为什么我的必应翻译代码在 Google Chrome 以外的所有浏览器中都能完美运行?

iphone - 自动更新应用程序内购买 - 从我的应用程序链接到应用程序商店应用程序中的适当设置

ios - 是否测试沙盒自动更新订阅 IOS?

java - 我怎样才能在应用程序关闭之前做些什么?

java - 定义多个按钮

php - 通过 Mautic API 从外部 CRM 发送具有特殊属性的自定义电子邮件

rest - 在 Microsoft Flow 自定义连接器中进行多个 webhook 触发器配置

ios - 如何通过objective c中的appStoreReceiptURL知道自动更新in_app_purchase订阅的当前状态?