Detailed process of using IAP in iOS payment

1. Appstore information is complete

First of all, there must be a developer account that can publish products, and a development environment that can run applications. IAP can only be tested on a real machine. We must have an IOS device.

All operations we perform are performed on the mac, and the tests are all real machines.

In the test, we definitely don't want to pay the real thing, don't worry, we can add a test account to the developer account, which is simple and convenient, that is, SandBox.

1.1 Create app ID

I won’t talk nonsense during the process, I can search a lot on the Internet, and the newly created app ID will open the payment in iap by default, as shown in the figure

The preparatory work is the same as not using iap. After creating the application, make sure that everything is correct. It is recommended to test without adding iap first to see if the project can pass the inspection. After everything is ready, create an iap payment entry.

1.1 Create an iap paid entry

Enter iTunse Connect, enter my apps, click the newly created project, click In-App Purchses, enter iap, as shown in the figure

Click "Create New" in the upper left corner to create a new IAP paid item, and there will be 5 IAP types to choose from in the Select Type interface. As shown:

There are four options for type selection:

1) Consumable (consumables): You need to pay for each download;

2) Non-consumable (non-consumable): only need to pay once;

3) Auto-Renewable Subscriptions: automatic subscription;

4) Free Subscription: Free subscription

If there is only free subscription in the type selection, it means that our developer account does not have the bank card payment function.

Generally, we need to buy gold coins in the game, so we choose the first type of Consumable. After choosing it, it looks like this

Just choose Chinese. Some people say that you don’t need to choose English for Chinese. Just save it at the end.

Now the payment entry that needs to be created has been completed.

1.3 Create a sandbox test account

Click users and roles in iTunse Connect, then click sandbox testers


Click the plus sign to add one

When choosing app atore territory, just choose China. When we test, the text of the purchase information that pops up will be the text of the country you selected. Just create and save.

2. iap access project

I encapsulated what I needed and just called it directly, with comments in the code.

In our project, we need to add the StoreKit.framework library

Instructions:

IOSiAP_Bridge* bridge = new IOSiAP_Bridge();
bridge->requestProducts(int);

Guess you like

Origin blog.csdn.net/qq_21743659/article/details/108596001