Skip to main content
Version: 1.45.x

Billing

Configure​

To use App Store Billing in the SDK, you need to add products to your Info.plist.

Ask your manager for a products list:

<key>P101XPBillingProductId</key>
<array>
<string>com.101xp.sample.product1</string>
<string>com.101xp.sample.product2</string>
</array>

Checking payment on 101XP Billing Server​

Payment handler

Usage​

Restoring purchases​

To restore purchases, use the restoreProducts method:

[P101XP restoreProducts];

The result returns to the p101xpOnPurchaseProductResult method of the P101XPDelegate delegate, as with a regular purchase.

(P101XPPurchase *)purchase - object of purchase if a purchase has been completed or nil if an error has occurred.

(P101XPError *)error - purchase error if an error has occurred or nil if a purchase has been completed.

- (void)p101xpOnPurchaseProductResult:(P101XPPurchase *)purchase
error:(P101XPError *)error;

Getting product information​

getProduct​

During SDK initialization the list of products specified in Info.plist under P101XPBillingProductID is loaded.

To get a product use method getProduct.

P101XPProduct *product = [P101XP getProduct:@"com.101xp.product"];

getProducts​

To get information about available app products use method getProducts. The list of products IDs can be sent via productId. If productId is nil, then all products will be received.

[P101XP getProducts:nil];

The result of getProducts is passed to the delegate method p101xpOnGetProductsResult:

- (void)p101xpOnGetProductsResult:(NSArray<P101XPProduct *> *)products;

Make payments​

To make payments, use the purchaseProduct method.

Parameters serverId and properties are sent to 101XP Billing Server and to the game server.

[P101XP purchaseProduct:product serverId:your_server_id properties:@{ @"player_id": your_property }];

The result of the purchaseProduct is passed to the delegate method P101XPDelegate.

- (void)p101xpOnPurchaseProductResult:(P101XPPurchase *)purchase error:(P101XPError *)error;