メインコンテンツにジャンプ

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

Appleは、1か月ごとに請求するサブスクリプションをサポートしていますが、顧客は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' 標準の前払い請求計画を明示的に選択する必要がある場合のみ使用してください。省略すると、 billingPlanTypeStoreKitは製品のデフォルトの購入動作を使用します。

トランザクションには、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);
}

トップレベル expirationDateisActive エンタイトルメントの決定に使用するフィールドです。コミットメントのフルタイムラインを顧客に説明するには commitmentInfo.expirationDate App Store レビュー ノート

App Store レビューノート

App Store ご利用条件の注釈
  • 購入前に定期課金価格と合計コミットメント価格を両方表示する
  • 購入ボタン近くでコミットメント期間を明示する
  • StoreKitからハードコードされた価格を使用するのではなく、 product.title, product.priceString, pricingTerms[].billingDisplayPrice, pricingTerms[].commitmentInfo.priceString を使用する
  • 購入画面またはアカウント画面で復元購入とサブスクリプション管理のアクションを提供する
関連ガイド

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

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

iOS 月額コミット請求計画を使用している場合 iOS 月額コミット請求計画 支払いと購入を計画するために、iOS 月額コミット請求計画を Using @capgo/native-purchases for the native capability in Using @capgo/native-purchases, Capgo Pricing for the product workflow in Capgo Pricing, Capgo Pricing Payment system @capgo/native-purchases 実装詳細については @capgo/native-purchases に参照してください。 Getting Started 実装詳細については Getting Started に参照してください。