Getting started with IAP
About IAP
IAP Guideline
https://developer.apple.com/in-app-purchase/In-App-Purchase-Guidelines.pdf
APP review guideline
https://developer.apple.com/app-store/review/guidelines
消费型IAP开发checklist
Implementation Checklist
Before you submit your app for review, verify that you’ve implemented all of the required behavior. Make sure you’ve implemented the following core In-App Purchase behavior (listed in order of a typical development process):
-
Create and configure products in iTunes Connect.
You can change your products throughout the process, but you need at least one product configured before you can test any code.
-
Get a list of product identifiers, either from the app bundle or your own server. Send that list to the App Store using an instance of
SKProductsRequest
. -
Implement a user interface for your app’s store, using the instances of
SKProduct
returned by the App Store. Start with a simple interface during development, such as a table view or a few buttons.Implement a final user interface for your app’s store at whatever point makes sense in your development process.
-
Request payment by adding an instance of
SKPayment
to the transaction queue using theaddPayment:
method ofSKPaymentQueue
. -
Implement a transaction queue observer, starting with the
paymentQueue:updatedTransactions:
method.Implement the other methods in the
SKPaymentTransactionObserver
protocol at whatever point makes sense in your development process. -
Deliver the purchased product by making a persistent record of the purchase for future launches, downloading any associated content, and finally calling the
finishTransaction:
method ofSKPaymentQueue
.During development, you can implement a trivial version of this code at first—for example, simply displaying “Product Delivered” on the screen—and then implement the real version at whatever point makes sense in your development process.
update 2016.11.23 Invalid receipt. Status code: 21002 的原因是提交的订单数据格式不对,订单数据是个json格式,{"receipt-data":"base64编码的二进制数据"}
参考