Create Android Auto-Renewable Subscription
このプラグインのインストール手順とフルマークダウンガイドのセットアッププロンプトをコピーしてください。
自動更新可能なサブスクリプションは、ユーザーがキャンセルするまで、毎回の請求期間の終わりで自動的に更新されます。
概要
概要サブスクリプションは、以下の用途に適しています。
- プレミアムコンテンツへのアクセス
- 広告なしのエクスペリエンス
- クラウドストレージ
- 継続的なサービス
サブスクリプションの作成
サブスクリプションの作成-
サブスクリプションに移動
Google Play Consoleでアプリを選択し、左のメニューから Monetize > サブスクリプション をクリックしてください。
サブスクリプションを作成 サブスクリプションに移動 基本情報を入力

-
__CAPGO_KEEP_0__
__CAPGO_KEEP_1__

-
Base Planを作成
Google Playでは、1つのサブスクリプションにつき1つの基本プランが必要です。native-purchasesプラグインは、iOSの互換性を維持するために、1つの基本プランのみをサポートしています。
Click 基本プランを追加して続行 を続行

-
基本プランの詳細を設定
入力
- 基本プランID基本プランIDは一意の識別子です
- 請求期間ユーザーが請求される頻度を指定します(週、月、年など)
- grace period: __CAPGO_KEEP_0__ window during which Google maintains the subscription while retrying payment before cancellation

-
Set Up Pricing
Access the pricing section and select all countries/regions where you want to offer the subscription.

-
Configure Price
Set your base price in your primary currency. Google Play automatically converts this to local currencies.

-
Review Regional Pricing
Review the automatically converted prices for each country. You can adjust individual prices if needed.

-
__CAPGO_KEEP_0__
__CAPGO_KEEP_1__

-
__CAPGO_KEEP_3__
__CAPGO_KEEP_4__ __CAPGO_KEEP_5__ __CAPGO_KEEP_6__

__CAPGO_KEEP_8__
__CAPGO_KEEP_9____CAPGO_KEEP_10__
__CAPGO_KEEP_11__native-purchases プラグインでは、iOS のサブスクリプション処理と一致するために、1 つの基本プランがサブスクリプションごとに必要です。複数の基本プランはサポートされていません。
グレード ペリオード
セクション「グレード ペリオード」グレード ペリオードでは、Google Play が失敗した支払いを再試行し、ユーザーのサブスクリプション アクセスを維持します。一般的なグレード ペリオードは次のとおりです。
- 月間サブスクリプションの場合、3 日
- 長期サブスクリプションの場合、7 日
サブスクリプション ステータス
セクション「サブスクリプション ステータス」作成後、サブスクリプションは「ドラフト」ステータスになります。サンドボックス モードでドラフト サブスクリプションをテストできます。
アプリ内での使用
セクション「アプリ内での使用」作成後、サブスクリプションをアプリ内で使用するには、製品 ID を参照してください。
import { NativePurchases, PURCHASE_TYPE } from '@capgo/native-purchases';
// Load subscription infoconst { products } = await NativePurchases.getProducts({ productIdentifiers: ['com.example.premium.monthly'], productType: PURCHASE_TYPE.SUBS,});
const product = products[0];console.log(`${product.title} — ${product.priceString}`);
// Purchase (planIdentifier = Base Plan ID from Google Play Console)const transaction = await NativePurchases.purchaseProduct({ productIdentifier: 'com.example.premium.monthly', planIdentifier: 'monthly-plan', // REQUIRED on Android, ignored on iOS productType: PURCHASE_TYPE.SUBS,});
console.log('Transaction ID', transaction.transactionId);
// Later, check purchase stateconst { purchases } = await NativePurchases.getPurchases({ productType: PURCHASE_TYPE.SUBS,});
const subscription = purchases.find( (purchase) => purchase.productIdentifier === 'com.example.premium.monthly',);
if (subscription && subscription.purchaseState === 'PURCHASED' && subscription.isAcknowledged) { console.log('Subscription active locally'); // For expiration/cancellation, validate purchaseToken through your backend}次のステップ
「次のステップ」のセクション- 新規サブスクライバーを引き付けるための紹介オファーを作成 サブスクライバーを引き付けるための紹介オファーを作成
- サンドボックステストを設定 サブスクリプションをテストする
- セキュリティのためにバックエンドの受領手続きを設定
トラブルシューティング
「トラブルシューティング」のセクションアプリ内にサブスクリプションが表示されない場合:
- 製品IDが正確に一致していることを確認
- __CAPGO_KEEP_0__を有効化する
- __CAPGO_KEEP_1__が正しいパッケージ名を持つことを確認する
- __CAPGO_KEEP_0__が有効化された後、2-3時間待って変更が反映される
基本プランエラー:
- __CAPGO_KEEP_0__が1つだけあることを確認する
- 必要なすべてのフィールドが入力されていることを確認する
- 請求期間が有効であることを確認する
価格に関する問題:
- 少なくとも1つの国を選択していることを確認する
- 基本価格が許可されている最小価格より大きいことを確認する
- 通貨変換レートが受け入れられることを確認する
Create Android Auto-Renewable Subscriptionから続ける
Android Auto-Renewable サブスクリプションの作成から続けるCapgoを使用している場合 Android Auto-Renewable サブスクリプションの作成 Capgoを使用して Using @capgo/native-purchases for the native capability in Using @capgo/native-purchases, @capgo/capacitor-in-app-review for the implementation detail in @capgo/capacitor-in-app-review, Using @capgo/capacitor-in-app-review for the native capability in Using @capgo/capacitor-in-app-review, @capgo/capacitor-native-market for the implementation detail in @capgo/capacitor-native-market, and 使用@capgo/capacitor-native-market for the native capability in 使用@capgo/capacitor-native-market。