コンテンツにジャンプ

iOS月額コミットビリングプラン

GitHub

Appleは、顧客を12ヶ月の長期契約に取り組ませながら、毎月請求するサブスクリプションをサポートしています。StoreKitと実行中のOSがこの請求計画をサポートしている場合、価格条件を公開し、購入時に月額請求計画を選択し、取引と更新情報のコミットメントメタデータを返します。 @capgo/native-purchases この機能は、ユーザーが毎月支払いたいが、還元と予測可能性のある年間契約を維持したい場合に、年間サブスクリプションのオファーに使用します。

要件

要件

要件
  • App Store Connect または Xcode の StoreKit Testing で 12 か月間のコミットメント請求計画を設定します。
  • Build the iOS app with an Xcode SDK that contains StoreKit pricingTerms and billingPlanType.
  • iOS のバージョンで StoreKit コミットメント請求計画をサポートしているもので実行してください。
  • デバイスまたはストアフロントがコミットメント価格条件を返さない場合、標準の請求オプションを維持してください。

セクションのタイトル “価格条件を読み込んで表示する”

呼び出し

Call getProducts() 通常通り。サポートされているiOSサブスクリプション製品の場合、各製品には pricingTerms.

import { NativePurchases, PURCHASE_TYPE } from '@capgo/native-purchases';
const { products } = await NativePurchases.getProducts({
productIdentifiers: ['com.example.app.premium.yearly'],
productType: PURCHASE_TYPE.SUBS,
});
const premiumYearly = products.find(
(product) => product.identifier === 'com.example.app.premium.yearly',
);
const monthlyCommitment = premiumYearly?.pricingTerms?.find(
(term) => term.billingPlanType === 'monthly',
);

ストアから提供された値をハードコードされた価格から表示する:

フィールド使用する
billingDisplayPriceユーザーに表示される繰り返し請求金額、例えば月額料金。
billingPeriod表示される請求価格の請求サイクル。
commitmentInfo.priceStringユーザーのストアフロントに適切にフォーマットされた合計コミットメント価格。
commitmentInfo.periodコミットメント期間の全期間。
subscriptionOffers価格設定用語に付随する導入的またはプロモーショナルなオファー。

例のペイウォールコピー:

function commitmentLabel(term: NonNullable<typeof monthlyCommitment>) {
const total = term.commitmentInfo?.priceString;
return total
? `${term.billingDisplayPrice} billed monthly, ${total} total commitment`
: term.billingDisplayPrice;
}

月間コミットメントプランを購入

「月間コミットメントプランの購入」

ユーザーが月間コミットメントプランを選択した場合、 billingPlanType: 'monthly'.

const transaction = await NativePurchases.purchaseProduct({
productIdentifier: 'com.example.app.premium.yearly',
productType: PURCHASE_TYPE.SUBS,
billingPlanType: 'monthly',
appAccountToken: userStoreUuid,
});

使用 billingPlanType: 'upFront' 標準の前払い請求プランを明示的に選択する必要がある場合のみ使用してください。そうでない場合、 billingPlanTypeヒント

コミットメントメタデータを読み取る

「コミットメントメタデータを読む」

トランザクションには、StoreKitが提供する場合の請求プランとコミットメントの進捗状況が含まれます:

if (transaction.billingPlanType === 'monthly') {
console.log('Current billing period:', transaction.commitmentInfo?.billingPeriodNumber);
console.log('Total billing periods:', transaction.commitmentInfo?.totalBillingPeriods);
console.log('Commitment ends:', transaction.commitmentInfo?.expirationDate);
console.log('Commitment total:', transaction.commitmentInfo?.price);
}

再契約情報には、次のコミットメント状態が含まれます:

const { purchases } = await NativePurchases.getPurchases({
productType: PURCHASE_TYPE.SUBS,
onlyCurrentEntitlements: true,
});
for (const purchase of purchases) {
const commitment = purchase.renewalInfo?.commitmentInfo;
if (!commitment) continue;
console.log('Renews into another commitment:', commitment.willAutoRenew);
console.log('Next billing plan:', commitment.renewalBillingPlanType);
console.log('Next renewal date:', commitment.renewalDate);
}

上位レベルの expirationDate と isActive 権限決定のために使用するエンティテルメントのフィールドを使用します。 commitmentInfo.expirationDate 顧客にコミットメントの全期間を説明するために使用します。

App Storeレビュー用メモ

「App Storeレビュー用メモ」
  • 購入前に、繰り返し請求価格と合計コミットメント価格を両方表示します。
  • 購入ボタン近くでコミット期間を明示する。
  • 使用 product.title, product.priceString, pricingTerms[].billingDisplayPrice, そして pricingTerms[].commitmentInfo.priceString StoreKitから代わりにハードコードされた価格を使用する。
  • 購入画面またはアカウント画面で購入の復元とサブスクリプションの管理アクションを提供する。

iOS月次コミットの請求計画から続ける

セクション「iOS月次コミットの請求計画から続ける」

iOS 月次コミット請求計画を使用 iOS 月次コミット請求計画 支払いと購入を計画するために Using @capgo/native-purchases Using @capgo/native-purchases Capgo 価格設定 Capgo Pricing 支払いシステム Payment system @capgo/ネイティブ購入 @capgo/native-purchases Native Purchases iOS 月次コミットメントの開始 実装の詳細については、Getting Startedを参照してください。