Purpl Documentation
상품과 구매
StoreKit 상품을 조회하고 사용자가 선택한 상품을 구매합니다.
상품 조회
Purchases는 PurchaseConfiguration의 상품 식별자를 StoreKit에 전달합니다. 가격, 구독 기간과 구매 가능 여부는 StoreKit 응답을 그대로 사용합니다.
상품 구매
Swift
let products = try await Purchases.shared.products()
guard let yearlyProduct = products.first(where: {
$0.id == "time.plus.yearly"
}) else {
return
}
let result = try await Purchases.shared.purchase(yearlyProduct)PurchaseResult는 완료, 승인 대기와 사용자 취소를 구분합니다. 거래 검증 실패와 스토어 오류는 throw로 전달됩니다.