5
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

GooglePlay定期購読状態取得時に410となる件

Posted at

GooglePlay課金における定期購読状態取得APIにて以下のレスポンスが返ることがある。

{
  "code" : 410,
  "errors" : [ {
    "domain" : "androidpublisher",
    "message" : "The purchase token is no longer valid.",
    "reason" : "purchaseTokenNoLongerValid"
  } ],
  "message" : "The purchase token is no longer valid."
}

Android Publisher APIのライブラリ(google-api-client1.23.0,google-api-services-androidpublisherv2-rev46-1.23.0)を使っているが、これを使うとGoogleJsonResponseExceptionがスローされる。
また公式ドキュメントにもこのエラーについては記述がなかった。

ユーザの状態

課金状態をコンソールで確認してみたところ、有効期限がきれたあともしばらく課金は「有効」となっている。
数日(日数はムラあり)後見ると「無効」に更新されていた。(これまで確認できたユーザすべて)
またこの状態のユーザについてGoogleに問い合わせてみたところ、Googleアカウントを削除していたということだった。

対処

GoogleJsonResponseExceptionでcatchし、e.getStatusCode == 410で判定し有料解除するようにした。
なにかいい方法があれば是非教えてください :bow:

5
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?