iOS Developer Library/Guides

Requesting Payment, iOS In-App Purchase Programming Guide 번역

창업자닉군 2013. 9. 19. 09:49

Introduction | Designing Your App’s Store | Displaying Your App’s Store UI | Requesting Payment
Delivering Products | Providing Purchased Content | Working with Subscriptions | Preparing for App Review

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




Requesting Payment
지불 요청

In the second part of the purchase process, after the user has chosen to purchase a particular product, your app submits payment request to the App Store, as shown in Figure 3-1.

사용자가 특정 제품을 구매하기로 결정 후 구매 프로세스의 두 번째 부분에서, 당신의 응용 프로그램은 그림 3-1에서와 같이 앱 스토어에 지불 요청을 제출합니다.

Figure 3-1  Stages of the purchase process—requesting payment


Creating a Payment Request
지불 요청 만들기

When the user selects a product to buy, create a payment request using a product object. Populate the quantity if needed, and add the payment to the transaction queue to submit it to the App Store for processing. Adding a payment object to the queue multiple times results in multiple transactions—the user will be charged multiple times and your app will be expected to deliver the product multiple times. Listing 3-1 shows a simplified example of the process.

사용자가 구입할 수있는 제품을 선택하면, 제품 개체를 사용하여 지불 요청을 만듭니다. 필요한 경우 양을 채우고 처리를 위해 앱 스토어에 제출하는 트랜잭션 큐에 지불을 추가합니다. 복수의 큐에 여러 번 결과에 지불 객체를 추가 거래 - 사용자가 여러 번 요금이 부과 될 수 있으며, 귀하의 응용 프로그램은 제품을 여러 번 제공 할 것으로 예상됩니다. 목록 3-1는 프로세스의 단순화 된 예를 보여줍니다.

Listing 3-1  Creating a payment request

// At app launch
[[SKPaymentQueue defaultQueue] addTransactionObserver:observer];
 
// ...
 
// When the user buys a product
SKPayment payment = [SKPayment paymentWithProduct:product];
payment.quantity = 2;
[[SKPaymentQueue defaultQueue] addPayment:payment];

Store Kit calls the transaction queue observer to handle a completed or failed payment request. For information about implementing the observer, see “Providing Purchased Content.”

스토어 키트는 트랜잭션 큐 관찰자가 완료되거나 실패 지불 요청을 처리하기 위해 호출합니다. 관찰자를 구현하는 방법에 대한 자세한 내용은 "구입 한 컨텐츠를 제공"을 참조하십시오.

Submitting a Payment Request
지불 요청을 제출

The transaction queue plays a central role in letting your app communicate with the App Store through the Store Kit framework. You add work to the queue that the App Store needs to act on, such as a payment request that needs to be processed. After the App Store has processed the request, Store Kit calls your transaction queue observer to handle the result. In addition to using the transaction queue for payment requests, your app also uses the transaction queue to download hosted content and to find out that subscriptions have been renewed, as discussed in “Providing Purchased Content” and “Working with Subscriptions.”

트랜잭션 큐는 스토어 키트 프레임 워크를 통해 앱 스토어에 앱 통신을시키는의 중심 역할을한다. 당신은 앱 스토어와 같은 처리해야하는 지불 요청으로 행동 할 필요가있는 큐에 작업을 추가합니다.앱 스토어가 요청을 처리 한 후, 스토어 키트는 결과를 처리하는 트랜잭션 큐 옵저버를 호출합니다. 지불 요청에 대한 트랜잭션 큐를 사용하는 것 외에도, 앱도 호스팅 콘텐츠를 다운로드하고 구독으로 "구입 한 콘텐츠를 제공"과의 논의, 갱신 된 알 트랜잭션 큐를 사용하여 "구독에 대한 작업."

Register your observer when your app is launched, and make sure that the observer is ready to handle a transaction at any time, not only after you add a transaction to the queue. For example, consider the case of a user buying something in your app right before going into a tunnel. Your app isn’t able to deliver the purchased content because there is no network connection. The next time your app is launched, Store Kit calls your transaction queue observer again and delivers the purchased content at that time. Similarly, if your app fails to mark a transaction as finished, Store Kit calls the observer every time that your app is launched until the transaction in properly marked as finished.

앱이 실행될 때 관찰자를 등록하고 큐에 트랜잭션을 추가 한 후뿐만 아니라 관찰자는 언제든지 트랜잭션을 처리 할 준비가되어 있는지 확인합니다. 예를 들어, 오른쪽 터널로 가기 전에 응용 프로그램에서 뭔가를 구입하는 사용자의 경우를 고려. 귀하의 응용 프로그램은 네트워크 연결이 없기 때문에 구입 한 콘텐츠를 제공 할 수 없습니다. 앱이 실행되는 다음 번 스토어 키트가 다시 트랜잭션 큐 관찰자 호출하고 그 당시 구입 한 콘텐츠를 제공합니다. 앱이 마무리 트랜잭션을 표시하지 않을 경우 마찬가지로 스토어 키트는 관찰자에게 앱이 마무리 제대로 표시에서 트랜잭션까지 출시 될 때마다 호출합니다.

Suggested Testing Steps
제안 된 테스트 단계

Test each part of your code to verify that you have implemented it correctly.
당신이 올바르게 구현되었는지 확인하는 코드의 각 부분을 테스트합니다.

Sign In to the iTunes Store with Your Test Account
테스트 계정으로 iTunes Store에 로그인

Create a test user account in iTunes Connect, as described in iTunes Connect Developer Guide.
로 iTunes에서 설명한 연결 아이튠즈에서 테스트 사용자 계정을 생성하는 개발자 가이드를 연결합니다.

On a development iOS device, sign out of the iTunes Store in Settings. Then build and run your app from Xcode.
개발 IOS 장치에서 설정에서 아이튠즈 스토어에서 로그 아웃. 그런 다음 빌드 엑스 코드에서 응용 프로그램을 실행합니다.

On a development OS X device, sign out of the Mac App Store. Then build your app in Xcode and launch it from Finder.
개발 OS X 장치에서, 맥 앱 스토어에서 로그 아웃. 그런 엑스 코드에서 응용 프로그램을 구축하고 Finder에서 그것을 실행합니다.

Use your app to make an in-app purchase. When prompted to sign in to the App Store, use your test account. Note that the text “[Environment: Sandbox]” appears as part of the prompt, indicating that you are connected to the test environment.

인 - 앱 구매를 만들기 위해 응용 프로그램을 사용합니다.앱 스토어에 로그인하라는 메시지가 표시되면 테스트 계정을 사용합니다. 당신이 테스트 환경에 연결되어 있음을 나타내는 프롬프트의 일부로 표시 : 텍스트 "[샌드 박스 환경은]"라고합니다.

If the text “[Environment: Sandbox]” does not appear, that indicates you are using the production environment. Make sure you are running a development signed build of your app. Production signed builds use the production environment.

텍스트를 "[환경 : 샌드 박스]"가 표시되지 않습니다, ​​그건 당신이 프로덕션 환경을 사용하고 있음을 나타냅니다. 당신이 개발을 실행하고 있는지 확인합니다 귀하의 응용 프로그램 빌드 서명했다. 생산 빌드 환경을 사용하여 서명했다.

Verify Your Observer Code
귀하의 관찰자 코드 확인

Review the transaction observer’s implementation of the SKPaymentTransactionObserver protocol. Verify that it can handle transactions even if you aren’t currently displaying your app’s store UI and even if you didn’t recently initiate a purchase.

SKPaymentTransactionObserver 프로토콜의 트랜잭션 관찰자의 구현을 검토합니다. 현재 앱의 상점 UI를 표시하지 않습니다 그리고 당신은 최근에 구매를 시작하지 않았더라도해도 트랜잭션을 처리 할 수 ​​있는지 확인합니다.

Locate the call to the addTransactionObserver: method of SKPaymentQueue in your code. Verify that your app calls this method at app launch.

코드에서 SKPaymentQueue의 방법 : addTransactionObserver 호출을 찾습니다. 앱이 앱 시작시이 메서드를 호출하는지 확인합니다.

Test Fetching the List of Products
제품 목록 가져 오기 테스트

If your product identifiers are embedded in your app, set a breakpoint in your code after they are loaded and verify that the instance of NSArray contains the expected list of product identifiers.

제품 식별자가 응용 프로그램에 포함 된 경우,이로드 된 후 코드에서 중단 점을 설정하고있는 NSArray의 인스턴스가 제품 식별자의 예상 목록이 포함되어 있는지 확인합니다.

If your product identifiers are fetched from a server, manually fetch the JSON file—using a web browser such as Safari or a command-line utility such as curl—and verify that the data returned from your server contains the expected list of product identifiers. Also verify that your server correctly implements standard HTTP caching mechanisms.

제품 식별자는 서버에서 가져온 경우, 수동으로 JSON을 가져올 파일을 사용하여 데이터가 서버에서 반환하는 등의 사파리와 같은 웹 브라우저 또는 컬 및 확인과 같은 명령 줄 유틸리티하는 제품 식별자의 예상 목록이 포함되어 있습니다. 또한 서버가 올바르게 표준 HTTP 캐싱 메커니즘을 구현하는지 확인합니다.

Test a Products Request
제품 요청을 테스트

Using the list of product identifiers that you tested, create and submit an instance of SKProductsRequest. Set a breakpoint in your code, and inspect the lists of valid and invalid product identifiers. If there are invalid product identifiers, review your products in iTunes Connect and correct your JSON file or property list.

당신이 검사하는 제품 식별자 목록을 사용하여 SKProductsRequest의 인스턴스를 작성하고 제출합니다. 코드에서 중단 점을 설정하고, 유효하고 유효하지 않은 제품 식별자의 목록을 검사합니다. 잘못된 제품 식별자가있는 경우, iTunes에서 제품을 검토 연결하고 JSON 파일 또는 재산 목록을 수정합니다.

Test a Payment Request
지불 요청을 테스트

Create an instance of SKPayment using a valid product identifier that you have already tested. Set a breakpoint and inspect the payment request. Add the payment request to the transaction queue, and set a breakpoint to confirm that the paymentQueue:updatedTransactions: method of your observer is called.

이미 테스트 한 유효한 제품 식별자를 사용하여 SKPayment의 인스턴스를 만듭니다.중단 점을 설정하고 결제 요청을 검사합니다.트랜잭션 큐에 지불 요청을 추가하고 paymentQueue 확인하는 중단 점을 설정 updatedTransactions : 귀하의 관찰자 메서드가 호출됩니다.

During testing, it’s ok to finish the transaction immediately without providing the content. However, even during testing, failing to finish the transaction can cause problems: unfinished transaction remain in the queue indefinitely, which could interfere with later testing.

테스트하는 동안, 그것은 콘텐츠를 제공하지 않고 즉시 트랜잭션을 완료 괜찮아요. 그러나 심지어 테스트하는 동안 트랜잭션을 완료하는 데 실패하면 문제가 발생할 수 있습니다 : 끝나지 않은 트랜잭션을 나중에 시험을 방해 할 수있는 무한정 대기열에 남아 있습니다.