コンテンツにジャンプ

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

GitHub

ペースト用に準備されています。 @capgo/native-purchases 価格設定条件を公開し、購入時に月額請求プランを選択し、取引と更新情報のコミットメントメタデータを返します。

年間サブスクリプションの提供に使用します。ユーザーは月額支払いを希望しますが、コミットメントされた年間期間の保持と予測可能性を維持したい場合に使用します。

要件

要件
  • App Store Connect または Xcode の StoreKit Testing で 12 か月のコミットメント請求プランを月額で設定します。
  • Xcode で SDK を構築し、StoreKit を含みます。 pricingTerms and billingPlanType.
  • context
  • ページ/エリア: Capgo マーケティング ウェブサイト。役割: 短い UI ラベルまたはナビゲーション アイテム。見つかった場所: page trust.astro。メッセージ キー `and` (And)。

呼び出し 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',
);

コピーする

Fieldフィールド
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 顧客に完全なコミットメントのタイムラインを説明する。

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

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

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

使用している場合 iOS月間コミットメントの請求計画 iOS月間コミットメントの請求計画を使用して支払いと購入を計画し、@__CAPGO_KEEP_0__/native-purchases @capgo/native-purchasesのネイティブ機能のために@capgo/native-purchasesを使用 capgo Pricingの製品フローのためにcapgo Pricingを使用 Capgo Pricingの製品フローのCapgo Pricing 製品フローにおける価格設定のための Capgo iOS月間コミットメントの請求計画 Payment systemの実装詳細については @capgo/ネイティブ購入 @capgo/native-purchasesの実装詳細については Native Purchases の設定 Getting Startedの実装詳細については