내용으로 건너뛰기

iOS 월간 의무 청구 계획

GitHub

애플은 12개월 기간 동안 고객을 약속하는 월간 청구를 지원합니다. StoreKit과 실행 중인 OS가 이 청구 계획을 지원할 때, 가격 조건을 노출하고 구매 시 월간 청구 계획을 선택할 수 있으며 거래 및 갱신 정보에서 약속 메타데이터를 반환합니다. @capgo/native-purchases 월간 청구를 선호하는 사용자가 여전히 연간 약속과 연관된 보존 및 예측 가능성을 원하는 연간 구독 제안에 사용하세요.

요구 사항

  • 그리고
  • iOS 앱을 Xcode SDK로 빌드하여 StoreKit을 포함하십시오. pricingTerms StoreKit billingPlanType.
  • iOS에서 StoreKit 약정 결제 계획을 지원하는 버전에서 실행하세요.
  • 기기나 매장에서 약정 가격 조건을 반환하지 않는 장치 또는 매장에 대해 표준 결제 옵션을 유지하세요.

클립보드에 복사하세요. getProducts() 매장에서 제공하는 값을 렌더링하세요. 대신 하드 코딩된 가격을 사용하세요: 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스토어킷은 제품에 대한 기본 구매 동작을 사용합니다.

약속 메타데이터 읽기

제목: 약속 메타데이터 읽기

거래에는 스토어킷이 제공할 때 요금제와 약속 진행도를 포함합니다:

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);
}

재newal 정보는 다음 의무 상태를 포함할 수 있습니다:

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 iOS 월간 약속
  • StoreKit 대신 고정 가격 대신 사용하세요.
구매 및 구독 관리 액션 제공

iOS 샌드박스 테스트 구성

iOS 앱 스토어 리뷰 지침

iOS 월간 약속 결제 계획에서 계속 iOS 월간 약속 결제 계획에서 계속 iOS 월간 약속 결제 계획을 사용 중이라면 @capgo/자연스러운 구입 native 기능을 사용하는 @capgo/native-purchases 에서 native 기능을 사용하는 경우 Capgo 가격 Capgo 가격을 위해 결제 시스템 결제 시스템을 위해 @capgo/자연스러운 구매 for the implementation detail in @capgo/native-purchases, and 시작하기 시작하기