メインコンテンツへスキップ

iOS 月額コミットメント請求プラン

GitHub

Appleは、毎月請求しつつ顧客に12か月の契約期間を求めるサブスクリプションをサポートしています。StoreKitと実行中のOSがこの請求プランに対応している場合、 @capgo/native-purchases 価格条件を公開し、購入時に月額請求プランを選択できるようにし、トランザクションと更新情報に関するコミットメントメタデータを返します。

月払いを好むユーザーに、年間契約ならではの継続率と予測可能性を確保したい年間サブスクリプションに適しています。

  • App Store Connect または Xcode の StoreKit Testing で、「12ヶ月コミットメント付き月払い」プランを設定してください。
  • StoreKit を含む Xcode SDK を使用して iOS アプリをビルドします。 pricingTerms と billingPlanType.
  • StoreKit のコミットメント請求プランをサポートしている iOS バージョンで実行してください。
  • コミットメント価格条件が返されないデバイスやストアフロント向けに、標準の請求オプションも用意しておいてください。

呼び出す 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 はその製品のデフォルトの購入動作を使用します。

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

「コミットメントメタデータの読み取り」セクション

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 を使用して、コミットメントの全タイムラインを顧客に説明してください。

  • 購入前に、定期課金の価格とコミットメント総額を両方表示してください。
  • 購入ボタンの近くに、コミットメント期間を明示してください。
  • 使用する product.title, product.priceString, pricingTerms[].billingDisplayPriceや pricingTerms[].commitmentInfo.priceString ハードコードされた価格ではなく、StoreKit から取得してください。
  • ペイウォールまたはアカウント画面に、購入の復元とサブスクリプション管理のアクションを提供してください。

iOS 月額コミットメント課金プランから続ける

セクションタイトル「iOS Monthly Commitment Billing Plansから続ける」

使用している場合 iOS 月額コミットメント請求プラン 支払いや購入を計画するには、これを以下と連携させます @capgo/native-purchases を使用する 「Using @capgo/native-purchases」のネイティブ機能については、 Capgo の料金 Capgo の料金ページのプロダクトワークフローについては、 決済システム 決済システムの実装詳細については、 @capgo/native-purchases @capgo/native-purchases の実装の詳細については、また スタートガイド 実装の詳細については、Getting Started を参照してください。