본문 바로가기

iOS 월간 약정 결제 플랜

GitHub

Apple은 고객이 12개월 약정을 유지하는 조건으로 매월 결제되는 구독 방식을 지원합니다. StoreKit과 실행 중인 OS가 이 결제 플랜을 지원하는 경우, @capgo/native-purchases 가격 조건을 노출하고 구매 시 월간 결제 플랜을 선택할 수 있게 하며, 트랜잭션에 대한 약정 메타데이터와 갱신 정보를 반환합니다.

사용자는 월 결제를 선호하지만 연간 약정의 유지율과 예측 가능성도 원하는 연간 구독 상품에 이 방식을 사용하세요.

  • App Store Connect 또는 Xcode의 StoreKit Testing에서 12개월 약정 월간 결제 플랜을 구성하세요.
  • StoreKit이 포함된 Xcode SDK로 iOS 앱을 빌드하세요. pricingTerms 및 billingPlanType.
  • StoreKit 약정 결제 플랜을 지원하는 iOS 버전에서 실행하세요.
  • 약정 가격 조건을 반환하지 않는 기기나 스토어프런트를 위해 표준 결제 옵션을 유지하세요.

가격 조건 불러오기 및 표시

“가격 조건 불러오기 및 표시” 섹션

호출하세요 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가격 조건에 포함된 입문용 또는 프로모션 혜택입니다.

페이월(Paywall) 문구 예시:

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 를 사용하세요.

  • 구매 전 정기 결제 금액과 총 약정 금액을 모두 표시하세요.
  • 구매 버튼 근처에 약정 기간을 명확하게 표시하세요.
  • 사용 product.title, product.priceString, pricingTerms[].billingDisplayPrice, 그리고 pricingTerms[].commitmentInfo.priceString 가격을 직접 입력하지 말고 StoreKit에서 가져오세요.
  • 결제 화면이나 계정 화면에서 구매 복원 및 구독 관리 기능을 제공하세요.

iOS 월간 약정 결제 플랜에서 계속하기

“iOS Monthly Commitment 결제 플랜 계속 사용하기” 섹션

사용 중이라면 iOS 월간 약정 결제 플랜 결제와 구매를 계획하려면 다음을 연결하세요 @capgo/native-purchases 사용하기 @capgo/native-purchases 사용 시 네이티브 기능을 위해, Capgo 가격 Capgo 가격 페이지의 제품 워크플로우, 결제 시스템 결제 시스템의 구현 상세 내용, @capgo/native-purchases @capgo/native-purchases의 구현 상세 내용, 그리고 시작하기 시작하기 페이지의 구현 상세 내용.