Flutter in_app_purchase(android)の参考になるURLやハマりポイント
verifyPurchase
pluginのreadmeを見ると下記のリンクが貼ってある
Fight fraud and abuse | Google Play's billing system
で上に書いてあることをそのまま実践しているようなfunctionsのソースが下記にあります。
わかりやすくて簡単なサンプル
Adding in-app purchases to your Flutter app | Google Codelabs
codelabs/in_app_purchases at master · flutter/codelabs · GitHub
上のソースを見て足りない部分はClassyTaxiServerで補完するような感じがいい。 push通知送るところとか。
androidでsubscription成功後のpurchases
パッケージがコンフリクト
github.com/android/play-billing-samplesを試した後で、github.com/flutter/codelabsのソースと入れ替えたらおきた。
Type 'import("/Users/takayuki/fb_ins/functions/node_modules/google-auth-library/build/src/auth/googleauth").GoogleAuth' is not assignable to type 'import("/Users/takayuki/fb_ins/functions/node_modules/googleapis-common/node_modules/google-auth-library/build/src/auth/googleauth").GoogleAuth'. Types have separate declarations of a private property 'checkIsGCE'.ts(2322)
node_modulesとpackage-lock.jsonを削除して再インストールすればOK
Verify purchasesをサーバで行う理由
By having the backend service do the validation with the stores rather than the application running on your user's device, you can prevent the user gaining access to premium features by, for example, rewinding their system clock.
SKU
PurchaseDetails.productIDのことで良さそう
サービスアカウントの権限を変えるときに反映まで結構時間がかかる
GaxiosError: The current user has insufficient permissions to perform the requested operation.
Verify purchasesするときにサーバ側(Functions)でこんなエラーが発生します。
権限を見直すと解決しますが、定時内(9時間)とかだと反映されなかったので注意が必要です。
下記にも情報があります。
Adding in-app purchases to your Flutter app | Google Codelabs
Note: It can take a while before the service account grants you access to the Android Publisher APIs. If you run into a situation where your API calls are being denied based on your permissions, try again in a few hours or the next day.
API を管理できるのは、Google Play デベロッパー アカウントの所有者に限られます。
スタートガイド | Google Play Developer API | Google Developers
大きめの開発組織だとどうしているのだろうか?マネージャのみとか?
google-play-developer-notifications@system.gserviceaccount.comは固定値
https://codelabs.developers.google.com/codelabs/flutter-in-app-purchases#9
で入力すると書いてあるが、前の工程で作った物なのかそもそも存在するものなのか分かりづらい
https://stackoverflow.com/a/64184564/16574350
上を見ると書いてある