コンテンツにジャンプする

iOS 月々のコミットメント請求計画

GitHub

Appleは、12か月間の契約期間を含む月額課金のサブスクリプションをサポートしています。StoreKitと実行中のOSがこの課金計画をサポートしている場合、 @capgo/native-purchases StoreKitは価格条件を公開し、購入時に月額課金計画を選択し、取引と更新情報のコミットメントメタデータを返します。

この機能は、ユーザーが月額支払いを希望するが、還元と予測可能性のあるコミットメントされた年間契約期間を維持したい場合の年間サブスクリプションの提案に適しています。

要件

要件
  • App Store ConnectまたはXcodeのStoreKit Testingで、12か月コミットメントの月額課金計画を設定します。
  • Xcode SDKでiOSアプリをビルドし、StoreKitを含みます。 pricingTermsbillingPlanType.
  • iOSのバージョンで実行してください。StoreKitコミットメント課金計画をサポートしているバージョンです。
  • 標準の課金オプションを保持してください。コミットメント価格条件を返さないデバイスまたはストアフロントの場合。

呼び出し getProducts() コンテキスト: Appflow の比較 / 移行のマーケティング コピー (親キー `appflow_migration_step2`)。ページ/エリア: Appflow の比較 / 移行のマーケティング コピー。役割: ウェブサイトのコピーの文。ページ: ionic-appflow.astro。Capgo の製品 / ブランドおよび開発者用語を完全に保持します。 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);
}

Capgoのトップレベル expirationDate そして isActive エンタイトルメントの決定に必要なフィールドを使用します。 commitmentInfo.expirationDate 購入者にフルコミットメントのタイムラインを説明するために使用します。

  • 購入前に、繰り返し請求価格と合計コミットメント価格を両方表示します。
  • 購入ボタン近くでコミットメント期間を明示的に表示します。
  • App Store の価格情報を取得するために StoreKit を使用します。 product.title, product.priceString, pricingTerms[].billingDisplayPriceハードコードされた価格を使用せずに、 pricingTerms[].commitmentInfo.priceString ストアキットから価格情報を取得するために、
  • 購入の復元とサブスクリプションの管理のアクションを、ペイウォールまたはアカウント画面で提供します。

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

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

あなたが「iOS月額コミットメントの請求計画」を使用している場合 iOS月額コミットメントの請求計画 「iOS月額コミットメントの請求計画」を使用して支払いと購入を計画する場合 「@capgo/native-purchases」を使用 「@capgo/native-purchases」のネイティブ機能 「@Capgo/native-purchases」の価格設定 「Capgo Pricing」の製品ワークフロー 支払いシステム 支払いシステムの実装詳細について @capgo/native-purchases @capgo/native-purchasesの実装詳細について はじめに はじめにの実装詳細について