iOS 月額コミットメント請求計画
このプラグインのインストール手順とフルマークダウンガイドを含むセットアップコマンドをコピーします。
Appleは、顧客に12ヶ月間の長期契約を約束する月額請求のサブスクリプションをサポートしています。StoreKitと実行中のOSがこの請求計画をサポートする場合、 @capgo/native-purchases 価格の条件を公開し、購入時に月額請求計画を選択し、取引と更新情報のコミットメントメタデータを返します。
年間サブスクリプションのオファーで、ユーザーが月額支払いを好むが、コミットメントされた年間契約の確実性と保持性を維持したい場合に使用してください。
- App Store ConnectまたはXcodeのStoreKit Testingで、12か月のコミットメント請求計画の月額を設定してください。
- Xcode SDKでiOSアプリをビルドし、StoreKitを含みます。
pricingTermsStoreKitコミットメント請求計画をサポートするiOSバージョンで実行してください。billingPlanType. - コミットメント価格条件を返さないデバイスまたはストアフロントの場合、標準の請求オプションを維持してください。
- 注意
料金表示と利用規約の読み込み
セクション「料金表示と利用規約の読み込み」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' 標準の前払い請求計画を明示的に選択する必要がある場合のみ使用してください。そうでない場合 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);}トップレベルの expirationDate とフィールドを利用してエンタイトルメントの決定を行います。 isActive を利用して、コミットメントのフルタイムラインを顧客に説明します。 commitmentInfo.expirationDate ]}
App Store レビュー ノート
「App Store レビュー ノート」セクション- 購入前に、繰り返し請求価格と合計コミットメント価格を両方表示します。
- 購入ボタン近くでコミットメント期間を明確に表示します。
- 「」、「」、「」から StoreKit を使用するのではなく、ハードコードされた価格を使用します。
product.title,product.priceString,pricingTerms[].billingDisplayPrice購入画面またはアカウント画面で、復元購入とサブスクリプション管理のアクションを提供します。pricingTerms[].commitmentInfo.priceString関連ガイド - 「関連ガイド」セクション
iOS サブスクリプションの作成
iOS サンドボックス テストの設定iOS 月額コミットメント請求プランから続けて
iOS 月額コミットメント請求プランから続けてCapgoを使用している場合 iOS 月額コミットメント請求プラン 支払いと購入を計画するために使用する場合、Capgoのnative-purchases Using @capgo/native-purchases for the native capability in Using @capgo/native-purchases, Capgo Pricing for the product workflow in Capgo Pricing, Payment systemのimplementation detailのために __CAPGO_KEEP_0__ @capgo/native-purchases @capgo/native-purchasesの実装詳細について Getting Started Getting Startedの実装詳細について