Configure mongo.apple.com to log on to mongo.apple.com, and then perform the following steps: Create an App ID without wildcards for the application. Use this App ID to generate and install the corresponding Provisioning Profile file. Configure iTunes Connectwww.2cto.com to log on to iTunes Connet, and then perform the following steps: Create a new application with this App ID. In this application, create an in-app payment project and select the payment option. Generally, two types of payment options are available: Consumable or Non-Consumable, then you can set the price and Product ID, as well as the purchase introduction and the Product ID here, which should be remembered later in development. As shown in: Add a test user for paying in sandbox, as shown in. Note that Apple requires the same password as the official account for this test user. The password must be at least 8 characters long and contain numbers and uppercase/lowercase letters: Fill in related tax, bank, and contact information. As shown in: Development (ios) 1. Introduce storekit. framework and # import <StoreKit/StoreKit. h> in the Project 2. Obtain the list of all paid Product IDs. This can be stored locally using constants or returned by your server. 3. Create an interface to display all in-app payment items. The price and description of these in-app payment items can be returned by your server. However, if it is a single-host game application or tool application without a server, you can query the application Store. During the test, I found that the query speed to the App Store is very slow. It usually takes 2-3 seconds. Therefore, we do not recommend that you create your own server. 4. When a user clicks an IAP project, we first check whether the user allows in-app payment. If not, the following steps are not required. The Code is as follows: if ([SKPaymentQueue canMakePayments]) {// execute Step 1: [self getProductInfo];} else {NSLog (@ "failed, you are prohibited from using in-app payment. ");} 5. We first query the AppStore through the IAP ProductID to obtain the SKPayment instance, and then initiate a purchase operation through the addPayment method of SKPaymentQueue. // The following ProductId should have been added to itunesConnect in advance, and an existing paid item exists. Otherwise, the query will fail. -(Void) getProductInfo {NSSet * set = [NSSet setWithArray: @ [@ "ProductId"]; SKProductsRequest * request = [[SKProductsRequest alloc] initWithProductIdentifiers: set]; request. delegate = self; [request start];} // callback function of the preceding query-(void) productsRequest :( SKProductsRequest *) request didReceiveResponse :( SKProductsResponse *) response {NSArray * myProduct = response. products; if (myProduct. count = 0) {NSLog (@ "Unable to obtain product information. Purchase failed. "); Return;} SKPayment * payment = [SKPayment paymentWithProduct: myProduct [0]; [[SKPaymentQueue defaultQueue] addPayment: payment];} 6. In the viewDidLoad method, set the purchase page to the purchased Observer. -(Void) viewDidLoad {[super viewDidLoad]; // listen to the purchase result [[SKPaymentQueue defaultQueue] addTransactionObserver: self];}-(void) viewDidUnload {[super viewDidUnload]; [[SKPaymentQueue defaultQueue] removeTransactionObserver: self];} 7. When a user purchases an operation, the following callback function is triggered and processed accordingly. -(Void) paymentQueue :( SKPaymentQueue *) queue updatedTransactions :( NSArray *) transactions {for (SKPaymentTransaction * transaction in transactions) {switch (transaction. transactionState) {case SKPaymentTransactionStatePurchased: // NSLog (@ "transactionIdentifier = % @", transaction. transactionIdentifier); [self completeTransaction: transaction]; break; case SKPaymentTransactionStateFailed: // transaction failed [Self failedTransaction: transaction]; break; case SKPaymentTransactionStateRestored: // you have purchased this product [self restoreTransaction: transaction]; break; case SKPaymentTransactionStatePurchasing: // Add a product to the list NSLog (@ "add product to List"); break; default: break ;}}- (void) completeTransaction :( SKPaymentTransaction *) transaction {// Your application shocould implement these two methods. NSString * productIdentifier = transa Ction. payment. productIdentifier; NSString * receept = [transaction. transactionreceipbase64encodedstring]; if ([productIdentifier length]> 0) {// verify the purchase credential to your server} // Remove the transaction from the payment queue. [[SKPaymentQueue defaultQueue] finishTransaction: transaction];}-(void) failedTransaction :( SKPaymentTransaction *) transaction {if (transaction. error. code! = SKErrorPaymentCancelled) {NSLog (@ "failed to purchase");} else {NSLog (@ "User canceled transaction");} [[SKPaymentQueue defaultQueue] finishTransaction: transaction];} -(void) restoreTransaction :( SKPaymentTransaction *) transaction {// for purchased items, process the logic of resuming the purchase [[SKPaymentQueue defaultQueue] finishTransaction: transaction];} 8. Optional ). If the purchase is successful, we need to send the credential to the server for verification. In consideration of network exceptions, the sending credential operation on iOS should be persistent. If the program exits, crashes, or the network is abnormal, retry again.