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

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

GitHub

Appleは、毎月請求するサブスクリプションをサポートしていますが、顧客は12か月の長期契約に同意することになります。 @capgo/native-purchases StoreKitと実行中のOSがこの請求計画をサポートしている場合、

価格条件を公開し、購入時に月額請求計画を選択し、取引と更新情報のコミットメントメタデータを返します。

年間サブスクリプションのオファーに使用してください。ユーザーは月額支払いを好みますが、コミットメントされた年間契約の確保と予測可能性を維持したい場合です。

要件
  • 要件セクション
  • Build the iOS app with an Xcode SDK that contains StoreKit pricingTerms Xcodeの__CAPGO_KEEP_0__でStoreKitを含むiOSアプリをビルドし、 billingPlanType.
  • iOSバージョンで実行してください。StoreKitコミットメント請求計画をサポートしている場合です。
  • デバイスまたはストアフロントがコミットメント価格条件を返さない場合、標準の請求オプションを維持してください。

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

Capacitorのトップレベル expirationDateisActive 特定条件の権利決定のためのフィールド。 commitmentInfo.expirationDate 購入者に全体のコミットメントのタイムラインを説明する。

  • 購入前に、繰り返し請求価格と合計コミットメント価格を両方表示する。
  • 購入ボタン近くでコミットメントの長さを明確にする。
  • 、および product.title, product.priceString, pricingTerms[].billingDisplayPriceStoreKitから代わりにハードコードされた価格を使用する。 pricingTerms[].commitmentInfo.priceString 購入画面またはアカウント画面で購入の復元とサブスクリプションの管理のアクションを提供する。
  • 関連ガイド。
__CAPGO_KEEP_0__

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

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

「@__CAPGO_KEEP_0__/native-purchases」を使用している場合 iOS 月額コミットメント請求計画 支払いと購入を計画するために使用する場合、@__CAPGO_KEEP_0__/native-purchasesを接続する 「@capgo/native-purchases」のネイティブ機能のために「@capgo/native-purchases」を使用する 「@capgo/native-purchases」の製品ワークフローとして「@capgo/native-purchases」の価格設定 「@Capgo/native-purchases」の価格設定 for the product workflow in Capgo Pricing, 決済システム 決済システムの実装詳細について @capgo/native-purchases @capgo/native-purchasesの実装詳細について、 Getting Started Getting Startedの実装詳細について。