Introduction | Overview of In-App Purchase | Retrieving Product Information | Making a Purchase
Adding a Store to Your Application | Verifying Store Receipts | Testing a Store | Auto-Renewable Subscriptions


본 페이지는 iOS In-App Purchase Programming Guide 문서의 Making a Purchase 부분을 번역해 놓은 페이지 입니다. 발 번역이라 이상한 부분이 있을 수 있습니다. 발견즉시 댓글을 달아 주세요.




Making a Purchase
구매하기

When the user is ready to purchase an item, your application asks the App Store to collect payment. When your application asks for payment, the App Store creates a persistent transaction and continues to process the payment, even if the user quits and relaunches your application. The App Store synchronizes the list of pending transactions with your application and delivers updates to your application when the status of any of these transactions changes.

사용자가 항목을 구입 할 준비가되면, 애플리케이션은 지불을 수집하는 앱 스토어요청합니다. 응용 프로그램이 지불을 요구하는 경우, 앱 스토어지속적인 트랜잭션을 생성하고 결제를 처리하는 데 계속 사용자가 종료하더라도 응용 프로그램을 다시 실행합니다.앱 스토어응용 프로그램과 함께 보류중인 트랜잭션의 목록을 동기화하고 응용 프로그램에 대한 업데이트를 제공 할 때 이러한 트랜잭션 변경 사항상태를 표시합니다.

Collecting Payments
지불 수금

To collect payment, your application creates a payment object and queues it on the payment queue, as shown in Figure 3-1.

Figure 3-1  Adding a payment request to the queue
Adding a Payment Request to the Queue

When the payment is added to the payment queue, a persistent transaction is created to hold it. After the payment is processed, the transaction is updated with information about the payment collection. Your application implements an observer that receives messages when transactions are updated. The observer should provide purchased items to the user and then remove the transaction from the payment queue.

결제 후 에 추가 될 때, 지속적인 트랜잭션유지하기 위해 만들어집니다.결제가 처리 된 후, 트랜잭션은 지불 수집에 대한 정보로 업데이트됩니다. 응용 프로그램이 트랜잭션이 업데이트 될 때 메시지를받는 관찰자를 구현합니다.관찰자는 사용자에게 구매 한 품목을 제공하고 지급 대기열에서 트랜잭션을 제거해야합니다.

SKPayment

Collecting payment starts with a payment object. The payment object includes a product identifier and optionally includes the quantity of that product to be purchased. You can queue the same payment object more than once; each time a payment object is queued results in a separate request for payment.

지불을 수집하는 것은 지불 객체로 시작합니다.지불 객체는 제품 식별자를 포함하고 선택적으로 구입할 수있는 해당 제품의 양을 포함한다. 당신은 한 번 이상 같은 지불 객체를 할 수 있으며, 각 시간을 지불 객체는 지불을위한 별도의 요청 결과를 대기하고 있습니다.


Users can disable the ability to make purchases in the Settings application. Before attempting to queue a purchase, your application should first confirm that payment can be processed. You do this by calling the payment queue’s canMakePayments method.

사용자는 설정 응용 프로그램에서 구매를 할 수있는 능력을 해제 할 수 있습니다. 구입하기 전에, 애플리케이션은 먼저 결제가 처리 할 수있는 확인해야합니다. 당신은 지불 canMakePayments 메서드를 호출하여이 작업을 수행합니다.


SKPaymentQueue

The payment queue is used to communicate with the App Store. When payments are added to the queue, Store Kit transmits the request to the App Store. Store Kit presents dialogs to ask the user to authorize payment. The completed transaction is returned to your application’s observer.

결제 큐는 앱 스토어와 통신하는 데 사용됩니다. 지불은 큐에 추가 될 때, 스토어 키트앱 스토어에 요청을 전송합니다. 스토어 키트는 지불승인하도록 사용자에게 요청하는 대화 상자를 표시합니다.완료된 트랜잭션이 응용 프로그램의 관찰자에게 반환됩니다.

SKPaymentTransaction

A transaction is created for every payment added to the queue. Each transaction has properties that allow your application to determine the status of the transaction. When payment is collected, the transaction includes additional details about the successful transaction.

모든 지불이 큐에 추가에 대한 트랜잭션이 생성됩니다. 각 트랜잭션응용 프로그램에서 트랜잭션의 상태를 확인할 수있는 속성이 있습니다. 결제가 수집 될 때, 트랜잭션이 성공적인 거래에 대한 추가 정보를 포함합니다.


Although your application can ask the payment queue for a list of pending transactions, it is more common for an application to wait until the payment queue notifies the payment queue’s observer with a list of updated transactions.

응용 프로그램이 보류중인 트랜잭션목록을 결제 큐를 요청할 수 있지만, 지불 큐가 업데이트 트랜잭션의 목록을 결제 관찰자에게 알립니다 때까지 기다려야하는 응용 프로그램에 더 일반적입니다.

SKPaymentTransactionObserver

Your application implements the SKPaymentTransactionObserver protocol on an object and adds it as an observer to the payment queue. The observer’s primary responsibility is to examine completed transactions, deliver items that were successfully purchased, and remove those transactions from the payment queue.

응용 프로그램 개체에 SKPaymentTransactionObserver 프로토콜을 구현하고 결제 큐에 관찰자 추가합니다.관찰자의 일차적 책임완료된 트랜잭션을 검사 성공적으로 구매 된 품목전달하고 결제 큐에서 해당 트랜잭션을 제거하는 것입니다.


Your application should associate an observer with the payment queue when it launches, rather than wait until the user attempts to purchase an item. Transactions are not lost when an application terminates. The next time the application launches, Store Kit resumes processing transactions. Adding the observer during your application’s initialization ensures that all transactions are returned to your application.

응용 프로그램시작할 때 결제 큐에 관찰자를 연결하는 대신 사용자가 항목을 구입하려고 할 때까지 기다려야합니다.응용 프로그램이 종료 될 때 트랜잭션이 손실되지 않습니다.다음 번에 응용 프로그램 스토어 키트트랜잭션 처리다시 시작, 시작합니다. 응용 프로그램의 초기화 중에 관찰자를 추가하면 모든 트랜잭션이 응용 프로그램에 반환됩니다 보장합니다.

Restoring Transactions
트랜잭션을 복원

Once a transaction has been processed and removed from the queue, your application normally never sees it again. However, if your application supports product types that must be restorable, you must include an interface that allows users to restore these purchases. This interface allows a user to add the product to other devices or, if the original device was wiped, to restore the transaction on the original device.

트랜잭션 처리 대기열에서 제거 된 후 응용 프로그램이 정상적으로 다시보고하지 않습니다. 응용 프로그램을 복원 할 수 있어야 제품 유형을 지원하는 경우, 당신은 사용자가 이러한 구매를 복원 할 수있는 인터페이스를 포함해야합니다. 이 인터페이스는 원래 장치가 전멸 된 경우 사용자가 원래의 장치에 트랜잭션을 복원하려면 다른 장치에 제품을 추가하거나 할 수 있습니다.


Store Kit provides built-in functionality to restore transactions for non-consumable products, auto-renewable subscriptions and free subscriptions. To restore transactions, your application calls the payment queue’s restoreCompletedTransactions method. The payment queue sends a request to the App Store to restore the transactions. In return, the App Store generates a new restore transaction for each transaction that was previously completed. The restore transaction object’s originalTransaction property holds a copy of the original transaction. Your application processes a restore transaction by retrieving the original transaction and using it to unlock the purchased content. After Store Kit restores all the previous transactions, it notifies the payment queue observers by calling their paymentQueueRestoreCompletedTransactionsFinished: method.

스토어 키트가 아닌 소모품 제품, 자동 재생 구독 및 무료 구독에 대한 거래를 복원하는 기능을 내장하고 있습니다. 트랜잭션을 복원하려면 응용 프로그램이 지불 restoreCompletedTransactions 메서드를 호출합니다.결제 큐는 트랜잭션을 복구하는 앱 스토어요청을 보냅니다. 반환에서는, 앱 스토어 이전에 완성 된 각 트랜잭션에 대해 새로운 복원 트랜잭션을 생성합니다.복원 트랜잭션 개체originalTransaction 속성은 원본 트랜잭션의 사본을 보유하고 있습니다. 응용 프로그램은 원래 트랜잭션을 검색하고 구입 한 콘텐츠의 잠금을 해제하기 위해 그것을 사용하여 복원 트랜잭션을 처리합니다. 방법 : 스토어 키트는 이전의 트랜잭션을 복원 한 후에는 자신의 paymentQueueRestoreCompletedTransactionsFinished를 호출하여 결제 관찰자에게 알립니다.


If the user attempts to purchase a restorable product (instead of using the restore interface you implemented), the application receives a regular transaction for that item, not a restore transaction. However, the user is not charged again for that product. Your application should treat these transactions identically to those of the original transaction.

사용자가 (대신 구현 한 복원 인터페이스를 사용하여)의 복원이 제품을 구입하려고하면 응용 프로그램은 해당 항목이 아닌 복원 거래를 위해 정기적으로 거래를받습니다. 그러나 사용자 해당 제품을 다시 청구되지 않습니다. 응용 프로그램은 원래 트랜잭션의 사람들에게 동일하게 이러한 트랜잭션 처리해야합니다.


Non-renewing subscriptions and consumable products are not automatically restored by Store Kit. Non-renewing subscriptions must be restorable, however. To restore these products, you must record transactions on your own server when they are purchased and provide your own mechanism to restore those transactions to the user’s devices.

갱신 구독 및 소모품 제품 것은 자동으로 저장 장비복원되지 않습니다. 갱신 구독 그러나 복원 할 수 있어야합니다. 이 제품을 복원하려면, 당신은 그들이 구입 자신의 서버 트랜잭션을 기록하고 사용자의 장치에 해당 트랜잭션을 복구하는 자신의 메커니즘을 제공해야합니다.

Posted by 창업자닉군
,