티스토리 뷰

📱 SwiftUI

In App Purchase API

James Wetzel 2022. 7. 1. 14:24

 

 

목록

  1. 앱 스토어(App Store)에 제품 등록 하기
  2. 앱 스토어(App Store)에서 제품 정보 및 목록 가져오기
  3. 앱 스토어(App Store)에 제품 결제 요청 및 응답  처리하기
  4. In App Purchase API

 

SKProductsRequest

An object that can retrieve localized information from the App Store about a specified list of products.

App Store에 등록한 상품 정보를 요청 합니다.

 

Your app uses an SKProductsRequest object to present localized prices and other information to the user without having to maintain that list of product information itself.

To use an SKProductsRequest object, you initialize it with a list of product identifier strings, attach a delegateand then call the request’s start() method. When the request completes, your delegate receives an SKProductsResponse object.

 

"SKProductsRequestDelegate"를 추가해라 그리고 start() 메소드를 이용해서 제품 정보를 요청해라.

요청한 제품 정보는 "SKProductsRequestDelegate"가 받을 것이다.

 


SKProductsRequestDelegate

A set of methods the delegate implements so it receives the product information your app requests.

"SKProductsRequest"를 사용하여 요청한 결과를 수신하는 대리자입니다.

 

The SKProductsRequestDelegate protocol declares methods that are implemented by the delegate of an SKProductsRequest object. The delegate receives the product information that the product request referred to. Your app uses this information when presenting products to users in its in-app store.

 

"SKProductsRequestDelegate"는 제품 정보를 수신한다.


SKProduct

Information about a product previously registered in App Store Connect.

"App Store Connect"에서 제공하는 제품 정보들입니다.

더보기

Getting the Product Identifier

 

var productIdentifier: String
The string that identifies the product to the Apple App Store.


Getting Product Attributes


var localizedDescription: String
A description of the product.


var localizedTitle: String
The name of the product.


var contentVersion: String
A string that identifies the version of the content.


var isFamilyShareable: Bool
A Boolean value that indicates whether the product is available for family sharing in App Store Connect.


Getting Pricing Information


var price: NSDecimalNumber
The cost of the product in the local currency.


var priceLocale: Locale
The locale used to format the price of the product.


var introductoryPrice: SKProductDiscount?
The object containing introductory price information for the product.


var discounts: [SKProductDiscount]
An array of subscription offers available for the auto-renewable subscription.


class SKProductDiscount
The details of an introductory offer or a promotional offer for an auto-renewable subscription.


Getting Subscription Information


var subscriptionGroupIdentifier: String?
The identifier of the subscription group to which the subscription belongs.


var subscriptionPeriod: SKProductSubscriptionPeriod?
The period details for products that are subscriptions.


class SKProductSubscriptionPeriod
An object containing the subscription period duration information.


enum SKProduct.PeriodUnit
Values representing the duration of an interval, from a day up to a year.

 

Getting Downloadable Content Information

 

var isDownloadable: Bool
A Boolean value that indicates whether the App Store has downloadable content for this product.


var downloadContentLengths: [NSNumber]
The lengths of the downloadable files available for this product.


var downloadContentVersion: String
A string that identifies which version of the content is available for download.


SKRequest

An abstract class that represents a request to the App Store.

"App Store" 요청을 대표하는 추상 클래스


SKRequestDelegate

Common methods that are implemented by delegates for any subclass of the SKRequest abstract class.

"SKRequest" 추상 클래스를 상속 받은 모든 서브클래스들에 의해 호출 되어진다.


SKPayment

A request to the App Store to process payment for additional functionality offered by your app.

"App Store"의 지불 요청 프로세서에 추가적인 기능을 설정합니다.

 

- init(product: SKProduct)
  Returns a new payment for the specified product.

  지불을 요청할 제품입니다.(SKProduct)


SKPaymentQueue

A queue of payment transactions to be processed by the App Store.

"App Store"의 지불 절차 트랜잭션 큐입니다.

 

- class func `default`() -> Self
  Returns the default payment queue instance.

  기본 지불 큐에 대한 instance를 돌려줍니다.

 

- func add(SKPayment)
  Adds a payment request to the queue.

  지불 요청을 큐에 추가합니다.

 

- func add(SKPaymentTransactionObserver)
  Adds an observer to the payment queue.

  지불 큐에 대한 감시자("SKPaymentTransactionObserver")를 등록합니다.

 

- func restoreCompletedTransactions()

     Asks the payment queue to restore previously completed purchases.

    이전에 완료된 구매를 복원하도록 지불 대기열에 요청합니다.

 

- class func canMakePayments() -> Bool
  Indicates whether the user is allowed to make payments.


SKPaymentTransactionObserver

A set of methods that process transactions, unlock purchased functionality, and continue promoted in-app purchases.

"SKPaymentQueue"에 대한 감시자 입니다.

 

- func paymentQueue(SKPaymentQueue, updatedTransactions: [SKPaymentTransaction])
  Tells an observer that one or more transactions have been updated.

  "SKPaymentQueue"의 트랙잭션("transaction")에 변화가 발생 할 경우 해당 변화를 감지 하는 감시자입니다.

 

- func paymentQueueRestoreCompletedTransactionsFinished(SKPaymentQueue)
  Tells the observer that the payment queue has finished sending restored transactions.

  "SKPaymentQueue"  감시자에게 "restored transaction"이 완료되었음을 알린다.


SKPaymentTransaction

An object in the payment queue.


SKPaymentTransactionState

Values representing the state of a transaction.

public func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {
    for transaction in transactions {
        switch (transaction.transactionState) {
        case .purchased:
        	complete(transaction: transaction)
        	break
        case .failed:
        	fail(transaction: transaction)
        	break
        case .restored:
        	restore(transaction: transaction)
        	break
        case .deferred:
        	break
        case .purchasing:
        	break
        }
    }
}

 

 

 

 

 

 

 

 

 

 

 

-  App Store Receipt

 

 

참조: http://www.appleofeyes.com/%EC%8A%A4%EC%9C%84%ED%94%84%ED%8A%B8-%EC%9D%B8%EC%95%B1%EA%B2%B0%EC%A0%9C-%ED%8A%9C%ED%86%A0%EB%A6%AC%EC%96%BC-app-purchases-tutorial-swift/

반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함