mcpField
G
gpc-monetization

gpc-monetization

github.com/yasserstudioその他140 回インストール1 週間前に更新
リポジトリ

gpc-monetization について

GPCを通じてGoogle Playのサブスクリプション、買い切り商品、オファー、購入ライフサイクルを管理するスキルです。一覧、編集、バッチ処理、購入処理、返金、価格設定を扱います。

主な機能

  1. 01サブスクリプションとベースプランの管理
  2. 02オファーとアプリ内商品の操作
  3. 03購入確認とライフサイクル処理
  4. 04バッチ操作とディレクトリ同期
  5. 05外部取引の返金

活用シーン

  1. 01サブスクリプションの価格やオファーの作成・更新
  2. 02JSONファイルからのアプリ内商品の同期
  3. 03購入確認と返金処理

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/yasserstudio/gpc-skills --skill gpc-monetization

インストール後、Claude Code で/gpc-monetizationを入力して読み込まれたか確認します。

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

evals/
evals.json
references/
iap-schema.md
purchase-verification.md
subscription-schema.md
scripts/
detect_gpc.mjs

詳細

gpc-monetization

GPC でサブスクリプション、アプリ内商品、購入、価格を管理します。

使用する場面

  • サブスクリプションと基本プランの作成、更新、削除
  • サブスクリプションオファー(初回、アップグレード、離脱防止)の管理
  • アプリ内商品(1 回限りの購入)の作成、更新、同期
  • サーバーサイドでの購入の検証、確認、消費
  • サブスクリプションのキャンセル、延期、取り消し
  • 返金と無効化された購入への対応
  • サブスクリプション分析(有効、トライアル、解約、コンバージョン)の確認
  • 加入者の新しい価格帯への移行
  • 地域や通貨をまたいだ価格の換算

必要な入力

  • 認証済みの GPC — gpc auth status で有効な認証情報が表示される必要があります
  • アプリのパッケージ名 — --app または gpc config set app で設定します
  • 商品 JSON ファイル — 作成/更新操作で必要です(サブスクリプションまたは IAP の定義)
  • 購入トークン — 検証、確認、消費に必要です
  • デベロッパーアカウント ID — 一部の購入操作で必要です(--developer-id)

手順

0. セットアップを確認する
gpc auth status
gpc config get app

認証が有効で、デフォルトのアプリが設定されていることを確認します。設定されていない場合は、gpc-setup スキルを Read: します。

1. サブスクリプション
A. サブスクリプションの一覧表示と確認
# List all subscriptions
gpc subscriptions list

# Get details for a specific subscription
gpc subscriptions get <product-id>

# Paginated listing
gpc subscriptions list --limit 50
B. サブスクリプションを作成する

サブスクリプションを定義する JSON ファイルを作成してから、次を実行します。

# Preview first
gpc subscriptions create --file subscription.json --dry-run

# Create
gpc subscriptions create --file subscription.json

# Specify a regions version (defaults to 2022/02)
gpc subscriptions create --file subscription.json --regions-version "2022/02"

v0.9.84 で修正: --regions-version が、サブスクリプションと one-time-products の作成、更新、オファーの各コマンドで Google Play API に実際に送信されるようになりました。v0.9.77-v0.9.83 では GPC で受け付けられていましたが、無視されていました。指定がない場合のデフォルトは 2022/02 です。また、IAP とサブスクリプションの list --json も、統一された { <key>, nextPageToken, meta.count } エンベロープを使用するようになりました(GPC v0.9.83)。

JSON の構造とフィールドのリファレンスについては、references/subscription-schema.md を Read: します。

C. サブスクリプションを更新する
# Update specific fields
gpc subscriptions update <product-id> --file updated.json --update-mask "listings"

# Preview changes
gpc subscriptions update <product-id> --file updated.json --dry-run

# Upsert: create the subscription if it does not already exist
gpc subscriptions update <product-id> --file updated.json --allow-missing

# Control propagation speed (default: LATENCY_SENSITIVE)
gpc subscriptions update <product-id> --file updated.json --latency-tolerance LATENCY_TOLERANT

--update-mask フラグで、更新するフィールドを指定します。省略すると、サブスクリプション全体が置き換えられます。

--allow-missing フラグを指定すると、アップサート動作が有効になります。サブスクリプションが存在しない場合、エラーを返す代わりに作成されます。

--latency-tolerance フラグで、変更が反映されるまでの速度を指定します。即時反映する場合は LATENCY_SENSITIVE(デフォルト)を使用します。一括操作で、スループットの向上と引き換えに遅延を許容できる場合は LATENCY_TOLERANT を使用します。

D. 一括操作
# Batch-get multiple subscriptions at once
gpc subscriptions batch-get <id1> <id2> <id3>

# Batch-update multiple subscriptions from JSON
gpc subscriptions batch-update --file batch-updates.json --dry-run
gpc subscriptions batch-update --file batch-updates.json
E. サブスクリプションを削除する
gpc subscriptions delete <product-id> --dry-run
gpc subscriptions delete <product-id>
2. 基本プラン

基本プランでは、サブスクリプションの請求期間と価格を定義します。

# Activate a base plan (makes it available for purchase)
gpc subscriptions base-plans activate <product-id> <base-plan-id>

# Deactivate a base plan (stops new purchases, existing subscribers unaffected)
gpc subscriptions base-plans deactivate <product-id> <base-plan-id>

# Delete a base plan
gpc subscriptions base-plans delete <product-id> <base-plan-id>

# Migrate prices for a base plan
gpc subscriptions base-plans migrate-prices <product-id> <base-plan-id> --file prices.json

基本プランのすべてのコマンドで --dry-run を使用できます。

3. サブスクリプションオファー

オファーでは、プロモーション価格(初回、アップグレード、離脱防止)を定義します。

# List offers for a base plan
gpc subscriptions offers list <product-id> <base-plan-id>

# Get offer details
gpc subscriptions offers get <product-id> <base-plan-id> <offer-id>

# Create an offer
gpc subscriptions offers create <product-id> <base-plan-id> --file offer.json --dry-run
gpc subscriptions offers create <product-id> <base-plan-id> --file offer.json

# Update an offer
gpc subscriptions offers update <product-id> <base-plan-id> <offer-id> --file offer.json

# Upsert: create the offer if it does not already exist
gpc subscriptions offers update <product-id> <base-plan-id> <offer-id> --file offer.json --allow-missing

# Control propagation speed for bulk offer updates
gpc subscriptions offers update <product-id> <base-plan-id> <offer-id> --file offer.json --latency-tolerance LATENCY_TOLERANT

# Activate / deactivate an offer
gpc subscriptions offers activate <product-id> <base-plan-id> <offer-id>
gpc subscriptions offers deactivate <product-id> <base-plan-id> <offer-id>

# Delete an offer
gpc subscriptions offers delete <product-id> <base-plan-id> <offer-id>
4. アプリ内商品(IAP)

1 回限りの購入 — 消費型、非消費型、利用権。

A. 一覧表示と確認
gpc iap list

# Paginated listing (useful for apps with many products)
gpc iap list --page-size 50
gpc iap list --page-size 50 --next-page <page-token>

gpc iap get <sku>

v0.9.51 で追加: gpc iap list(別名 gpc one-time-products list)で、ページネーションされた結果に対する --page-size と --next-page がサポートされるようになりました。さらに結果がある場合、レスポンスに nextPageToken フィールドが含まれます。

B. 作成と更新
# Create from JSON
gpc iap create --file product.json --dry-run
gpc iap create --file product.json

# Specify a regions version on create (defaults to 2022/02)
gpc iap create --file product.json --regions-version "2022/02"

# Update
gpc iap update <sku> --file updated.json --dry-run
gpc iap update <sku> --file updated.json

# Upsert: create the product if it does not already exist
gpc iap update <sku> --file updated.json --allow-missing

# Control propagation speed
gpc iap update <sku> --file updated.json --latency-tolerance LATENCY_TOLERANT

# Delete
gpc iap delete <sku>

JSON の構造とフィールドのリファレンスについては、references/iap-schema.md を Read: します。

C. 一括削除
# Delete multiple IAP products at once
gpc iap batch-delete <sku1> <sku2> <sku3> --dry-run
gpc iap batch-delete <sku1> <sku2> <sku3>
D. ディレクトリから同期

JSON ファイルのディレクトリを使って、IAP 商品を一括管理します。

# Preview what would change
gpc iap sync --dir products/ --dry-run

# Apply changes
gpc iap sync --dir products/

ディレクトリ内の各 JSON ファイルは、1 つの商品を表します。GPC はローカルファイルと Play Store を比較し、必要に応じて作成、更新、削除を行います。

買い切り商品オファー -- 単一オファーコマンド(v0.9.96)

Google Play が公開している買い切り商品オファー用エンドポイントはバッチのみです。そのため、otp offers get、create、update、delete は単一アイテムのバッチリクエストとして送信され、--purchase-option が必須です。省略すると、API 呼び出しの前にオプション不足のエラーが即座に発生します。- ワイルドカードが使えるのは offers list のみです。オファーがどの購入オプションに属するかわからない場合は、まずこれを実行してください。

# Find the purchase option an offer belongs to
gpc otp offers list premium_upgrade

gpc otp offers get premium_upgrade launch_discount --purchase-option buy_once
gpc otp offers create premium_upgrade --file offer.json --purchase-option buy_once
gpc otp offers update premium_upgrade launch_discount --file offer-update.json --purchase-option buy_once
gpc otp offers delete premium_upgrade launch_discount --purchase-option buy_once

offers create はまずオファー ID の存在を確認し、上書きする代わりに API_ALREADY_EXISTS(409)で拒否します。基盤となるバッチエンドポイントはアップサートです。既存のオファーを変更するには offers update を使用してください。

v0.9.96 で修正: gpc one-time-products create/update と上記の 4 つの単一オファーコマンドは、以前はルートが見つからないエラーで失敗していました(Play では、書き込みルートの表記が読み取りルートと異なります)。v0.9.96 以降が必要です。

買い切り商品オファーのペイロード(Google のスキーマ)

オファーファイルは Google Play の OneTimeProductOffer です。discountedOffer、preOrderOffer、gameRewardOffer のいずれか 1 つに加えて、{ regionCode, availability, relativeDiscount | absoluteDiscount | noOverride } のリストである regionalPricingAndAvailabilityConfigs を含みます。relativeDiscount はユーザーが支払う割合です(0.7 = 30% オフ)。価格は購入オプションに設定します。サブスクリプション用フィールド(pricingPhases、regionalConfigs マップ、newSubscriberAvailability)は使用しないでください。Google に拒否されます。また、v0.9.99 より前の GPC ドキュメントには誤った形式が記載されていました。

{
  "offerId": "launch-discount",
  "discountedOffer": { "startTime": "2026-10-01T00:00:00Z", "endTime": "2026-10-31T23:59:59Z", "redemptionLimit": "1000" },
  "regionalPricingAndAvailabilityConfigs": [
    { "regionCode": "US", "availability": "AVAILABLE", "relativeDiscount": 0.7 }
  ]
}

Play Games Rewards(v0.9.99 以降で型定義・ドキュメント化):「"gameRewardOffer": { "redemptionLimit": "1" }」("1"~"50"、"0"/未設定 = 無制限)。Google のガイドでは、Play Console でリワードオファーを作成します。GPC はこれらのオファーの一覧表示、読み取り、更新に対応しています。

外部取引(代替課金、米国プログラム)
gpc ext-txn create --file txn.json --transaction-id order-1001    # body sent as-is
gpc ext-txn get order-1001
gpc ext-txn refund order-1001 --full
gpc ext-txn refund order-1001 --partial-amount 4990000 --currency EUR --refund-id order-1001-r1
  • 返金には GPC v0.9.99 以降が必要です。それ以前のバージョンでは、Google が要求する refundTime(および部分返金の refundId)が送信されなかったため、Google に拒否されていました。--refund-time <RFC 3339 with zone> を指定すると「現在時刻」を上書きできます。未来の時刻は拒否されます。不正なオプションは、何も送信される前に EXT_TXN_REFUND_INVALID で終了コード 2 を返し、プロンプトには金額が表示されます。
  • --partial-amount は税抜きのマイクロ単位です(4990000 = 4.99)。主要通貨単位ではありません。
  • v1.0.0-rc.1 以降では、ターミナルなしで返金する場合は --yes が必要です。指定しないと CONFIRMATION_REQUIRED で終了コード 2 を返します。
  • 米国の外部コンテンツリンクプログラム:作成ファイルに externalContentLinkDetails { linkType: LINK_TO_DIGITAL_CONTENT_OFFER | LINK_TO_APP_DOWNLOAD, installedAppPackage, externalAppCategory: APP | GAME } を追加してください。これは以前からある externalOfferDetails とは別です。Google は、2026 年 10 月 1 日以降の購入と、2026 年 12 月 1 日までのアプリダウンロードの報告を義務付けています。
OTP オファーの有効化/無効化(v0.9.57 以降)

買い切り商品オファーでは、有効化/無効化を明示的に行えます。

gpc otp offers activate --app com.example.app --product-id sku_id --offer-id offer_id
gpc otp offers deactivate --app com.example.app --product-id sku_id --offer-id offer_id

サブスクリプションオファーのライフサイクルと一致します。これがない場合、OTP オファーではバッチ更新呼び出しを通じて状態を設定する必要がありました。

OTP オファーと購入オプションのバッチ操作(v0.9.79 以降)

買い切り商品オファーと購入オプションに対するバッチ操作:

# Retrieve multiple OTP offers in one call
gpc one-time-products offers batch-get --product-id <sku> --offer-ids "offer_a,offer_b"

# Update multiple OTP offers from JSON
gpc one-time-products offers batch-update --file otp-offers.json --dry-run
gpc one-time-products offers batch-update --file otp-offers.json

# Bulk activate or deactivate OTP offers
gpc one-time-products offers batch-update-states --file otp-states.json --dry-run
gpc one-time-products offers batch-update-states --file otp-states.json

# Delete multiple OTP offers at once
gpc one-time-products offers batch-delete --product-id <sku> --offer-ids "offer_a,offer_b" --dry-run
gpc one-time-products offers batch-delete --product-id <sku> --offer-ids "offer_a,offer_b"

# Bulk delete purchase options across products
gpc one-time-products purchase-options batch-delete --file po-delete.json --dry-run
gpc one-time-products purchase-options batch-delete --file po-delete.json

# Bulk update purchase-option states (activate/deactivate)
gpc one-time-products purchase-options batch-update-states --file po-states.json --dry-run
gpc one-time-products purchase-options batch-update-states --file po-states.json

すべてのバッチコマンドは --dry-run と --json に対応しています。これらの操作は、v0.9.79 の OTP バッチ機能一式を網羅しています。オファー用の 4 つのメソッド(batch-get、batch-update、batch-update-states、batch-delete)と、購入オプション用の 2 つのメソッド(batch-delete、batch-update-states)です。

5. 購入 — 検証とライフサイクル
A. 商品購入
# Verify a purchase
gpc purchases get <product-id> <token>

# Acknowledge (required within 3 days or purchase is refunded)
gpc purchases acknowledge <product-id> <token>
gpc purchases acknowledge <product-id> <token> --payload "order-123"

# Consume (for consumable products — allows re-purchase)
gpc purchases consume <product-id> <token>
B. サブスクリプション購入
# Acknowledge a subscription purchase (v1 — required within 3 days)
gpc purchases subscription acknowledge <subscription-id> <token>
gpc purchases subscription acknowledge <subscription-id> <token> --payload "order-456"

# Get subscription purchase details (v2 API)
# Returns SubscriptionPurchaseV2 with onHoldStateContext, inGracePeriodStateContext (v0.9.76+)
# Both context objects are surfaced in --json output and structured display
gpc purchases subscription get <token>

# Cancel a subscription (v1 — requires subscription-id)
gpc purchases subscription cancel <subscription-id> <token>

# Cancel a subscription (v2 — supports cancellation types)
gpc purchases subscription cancel-v2 <token>
gpc purchases subscription cancel-v2 <token> --type DEVELOPER_CANCELED

# Defer expiry to a later date (v1)
gpc purchases subscription defer <subscription-id> <token> --expiry 2025-06-01T00:00:00Z

# Defer expiry (v2 — supports add-on subscriptions)
gpc purchases subscription defer-v2 <token> --until 2026-07-01T00:00:00Z

# Revoke a subscription (v2 API)
gpc purchases subscription revoke <token>
C. 商品購入(v2 API)
# Get product purchase details (v2 — supports multi-offer OTPs)
gpc purchases product get-v2 <token>

v2 商品購入 API は、ラインアイテム、オファーの詳細、複数商品バンドルへの対応を含む ProductPurchaseV2 を返します。

D. 注文
# Get order details
gpc purchases orders get <order-id>

# Batch retrieve orders (up to 1000)
gpc purchases orders batch-get --ids "GPA.1234,GPA.5678"

v0.9.79で新登場: 注文で OfferPhaseDetails 型が公開され、フラットな offerPhase フィールドに置き換わりました。OfferPhaseDetails は、より詳細なフェーズ情報(フェーズの種類、サイクル数、価格の詳細)を含む構造化オブジェクトです。フラットな offerPhase フィールドは非推奨です。新しいコードでは offerPhaseDetails から読み取ってください。

E. 無効化された購入と払い戻し
# List voided purchases (default: in-app only)
gpc purchases voided --start-time 2025-01-01 --end-time 2025-03-01

# Include subscription voids (type=1)
gpc purchases voided --type 1

# Include quantity-based partial refunds
gpc purchases voided --include-partial-refunds

# Refund an order (always a full refund; --revoke also removes the entitlement)
gpc purchases orders refund <order-id> --yes
gpc purchases orders refund <order-id> --revoke --yes

# Partial subscription refunds go through the v2 revoke instead
gpc purchases subscription revoke <token> --refund-type prorated --yes

orders refund が受け取るのは --revoke のみです。Google の orders.refund は全額払い戻しであり、一部払い戻しや日割り計算による払い戻しはありません。選択肢があるのは purchases subscription revoke で、--refund-type full|prorated|item(デフォルトは prorated)で指定します。--refund-type item には --product-id も必要です。

v0.9.47で新登場: --type 0(デフォルト)はアプリ内購入の無効化のみを返します。--type 1 はサブスクリプションの無効化も含めます。--include-partial-refunds は数量ベースの一部払い戻しを含めます。

すべての書き込み操作で --dry-run をサポートしています。

CI では金銭に関するコマンドに --yes が必要です(v1.0.0-rc.1以降)

purchases orders refund、purchases orders review-refund、purchases subscription revoke、external-transactions refund は金銭を移動させ、取り消すことができません。ターミナルなしで実行する場合(CI、stdin のパイプ、--no-interactive)、--yes を渡さない限り CONFIRMATION_REQUIRED(終了コード 2)で停止するようになりました。以前のバージョンでは自動的に確認されていたため、パイプラインがデフォルトで払い戻しを実行する可能性がありました。--dry-run は何も送信しないため、対象外です。対話型シェルでのプロンプトに変更はありません。

サーバー側の検証パターンとベストプラクティスについては、references/purchase-verification.md をご覧ください。

F. チャージバックの異議申し立て -- purchases orders review-refund(v0.9.96以降)

ユーザーが銀行に請求への異議を申し立てると、Play は pendingRefundToken と異議申し立て対象の orderId を含む pendingRefundReviewNotification RTDN を送信します。回答期限は24時間です。結果は Play が決定します。希望や証拠はその決定への入力であり、決定そのものではありません。

# 1. Pull the token out of the notification (full token only in JSON output)
TOKEN=$(gpc rtdn decode "<base64-payload>" --output json \
  | jq -r .pendingRefundReviewNotification.pendingRefundToken)

# 2. Answer the dispute
gpc purchases orders review-refund "GPA.1234-5678-9012-34567" \
  --app com.example.app \
  --pending-refund-token "$TOKEN" \
  --preference decline \
  --sample-content-provided \
  --consumption-percent 82 \
  --usage-events-file ./usage-events.json

# Take no side, no evidence
gpc purchases orders review-refund "GPA.1234-5678-9012-34567" \
  --pending-refund-token "$TOKEN" \
  --preference neutral \
  --no-sample-content-provided
フラグ必須備考
--pending-refund-tokenはいpendingRefundReviewNotification のトークン
--preferenceはいapprove、decline、または neutral
--sample-content-provided / --no-sample-content-providedはい(いずれか一方のみ)購入前に無料サンプル、トライアル、または機能情報を提供したかどうか。Google にデフォルト値がないため、GPC では明示する必要があります
--consumption-percentいいえ消費した割合。0~100で、小数も指定できます(ミリ単位で送信されます)
--usage-events-fileいいえ消費イベントの JSON 配列。最大 1,000 件

usage-events.json では RFC 3339 のタイムスタンプを使用します。また、位置情報を指定する場合、location.regionCode には CLDR の地域コードが必須です。

[
  {
    "consumptionTime": "2026-08-30T10:15:00Z",
    "consumptionItemDescription": "Opened chapter 4",
    "obfuscatedAccountId": "user-account-id",
    "ipAddress": "203.0.113.10",
    "location": { "regionCode": "US" }
  }
]

不正な入力は何も送信される前に、ORDER_REVIEW_REFUND_INVALID(終了コード 2)としてローカルで拒否されます。空、または空白文字のみの --consumption-percent は未指定として扱われるため、入力ミスによって誤って「消費率 0%」が申告されることはありません。--dry-run でリクエストをプレビューできます。

6. リアルタイム デベロッパー通知(RTDN)

RTDN は、サブスクリプションや購入のイベント発生時に Pub/Sub メッセージを配信します。GPC では、これらの通知をデコードして内容を確認できます。

# Check RTDN topic configuration
gpc rtdn status

# Decode a base64-encoded Pub/Sub notification payload
gpc rtdn decode <base64-payload>

# Show setup instructions for RTDN
gpc rtdn test

通知の種類には、SUBSCRIPTION_PURCHASED、SUBSCRIPTION_CANCELED、SUBSCRIPTION_RENEWED、SUBSCRIPTION_REVOKED、SUBSCRIPTION_EXPIRED、ONE_TIME_PRODUCT_PURCHASED、VOIDED_PURCHASE などがあります。

v0.9.47で新登場: RTDN コマンドは、サブスクリプションのライフサイクルイベントのデバッグに役立ちます。GCP で Pub/Sub トピックを設定し、Play Console の[収益化の設定]で構成してから、gpc rtdn decode を使用してペイロードを確認してください。

v0.9.96で新登場: gpc rtdn decode は pendingRefundReviewNotification(審査を依頼されたチャージバック)を認識し、その orderId と pendingRefundToken を表示します。トークン全体が出力されるのは --output json を指定した場合のみです。また、不完全なチャージバック通知でクラッシュしなくなりました。24時間以内にセクション 5F の gpc purchases orders review-refund で回答してください。

7. サブスクリプション分析

登録者数、コンバージョン、解約に関するインサイトを取得します:

# Active subscribers, in-trial counts, trial→paid conversion, churn cohort
gpc subscriptions analytics

# JSON output for dashboards
gpc subscriptions analytics --json

レポート:有効な登録者数、トライアル中の登録者数、解約済みの登録者数、トライアルから有料へのコンバージョン率、コホート別の推定解約率。

8. 基本プランの価格移行

既存の登録者を新しい価格に移行します:

# Migrate all subscribers on a base plan to a new price
gpc subscriptions base-plans migrate-prices <product-id> <base-plan-id> \
  --file prices.json

# Prices file format: regional prices JSON (same as base plan prices)

登録者には Google Play から通知が届き、承認するか解約する必要があります。移行をプレビューするには、--dry-run を使用します。

9. 地域別価格

基本価格を Google Play 対応のすべての地域の価格に換算します:

# Convert USD 4.99 to all regional prices
gpc pricing convert --from USD --amount 4.99

# Output as JSON for scripting
gpc pricing convert --from USD --amount 4.99 --json

換算には Google Play の公式為替レートが使用され、各地域に適した価格に丸められます。

10. データセーフティ(v0.9.75+)

API を使ってアプリのデータセーフティセクションの申告を管理します:

# Get current data safety labels
gpc data-safety get

# Update data safety declarations from CSV
gpc data-safety update --file safety.csv

検証

  • gpc subscriptions list でサブスクリプションが返される
  • gpc iap list でアプリ内アイテムが返される
  • gpc purchases get <product-id> <token> で有効なトークンの v1 購入詳細が返される
  • gpc purchases product get-v2 <token> で明細項目を含む v2 購入詳細が返される
  • gpc purchases orders get <order-id> で注文詳細が返される
  • gpc pricing convert --from USD --amount 9.99 --json で地域別価格が返される
  • すべての --dry-run コマンドは、データを変更せずに変更内容を表示する
  • すべてのコマンドで JSON 出力が機能する(--json フラグ)

失敗の原因とデバッグ

症状考えられる原因対処方法
PRODUCT_NOT_FOUND商品 ID または SKU が無効gpc subscriptions list または gpc iap list で確認します
INVALID_PURCHASE_TOKENトークンの有効期限切れ、使用済み、またはアプリが違うトークンがアプリと商品に一致することを確認します
PURCHASE_NOT_ACKNOWLEDGED3 日以内に購入が承認されなかったすぐに承認します。3 日を超えている場合、購入は自動返金されています
SUBSCRIPTION_NOT_FOUNDキャンセルまたは延期で指定したサブスクリプション ID が誤っているgpc purchases subscription get <token> を使って正しい ID を確認します
作成/更新時の INVALID_JSON商品 JSON ファイルの形式が不正スキーマリファレンスに照らして JSON 構造を検証します
購入時の PERMISSION_DENIEDサービスアカウントに財務関連の権限がないPlay Console で「財務データの閲覧」と「注文の管理」を付与します
--update-mask エラー更新マスクのフィールドパスが無効有効なフィールド名を API ドキュメントで確認します。すべてのフィールドを置き換える場合はフラグを省略します
iap sync で予期しない商品が削除されるディレクトリに一部の商品ファイルがない最初に --dry-run を使用します。同期ではディレクトリにない商品が削除されます
otp offers get/create/update/delete で --purchase-option が指定されていないv0.9.96 ではこれらの処理が、具体的な購入オプションを必要とする Play の一括オファーエンドポイント経由になっているgpc otp offers list <product-id> を実行して確認します。- が使えるのは list のみです
otp offers create で API_ALREADY_EXISTSそのオファー ID はすでに存在します。一括エンドポイントはアップサートのため、GPC は上書きせずに確認して処理を拒否します代わりに gpc otp offers update を使います
ORDER_REVIEW_REFUND_INVALID--sample-content-provided が未回答、--consumption-percent が 0~100 の範囲外、または --usage-events-file がオブジェクトの JSON 配列ではない--sample-content-provided または --no-sample-content-provided のいずれかを指定し、通常の小数を使い、ファイルを配列にします

関連スキル

  • gpc-setup — 収益化コマンドの実行前に必要な認証と設定
  • gpc-release-flow — 新商品や価格変更を含むアプリ更新のリリース
  • gpc-vitals-monitoring — 請求に関する問題に言及したレビューのモニタリング
  • gpc-ci-integration — CI/CD でのアプリ内アイテム同期と購入検証の自動化

コメント