Home


In App Payments

The connector library provides a set of functions which help you to make use of different In-App Payment SDKs in your app.

-(void)onPurchaseSuccess {
    NSString *price = [[Enhance purchases] getDisplayPrice:@"Enhance_SKU_One" defaultPrice:@"Default Price"];
    NSString *title = [[Enhance purchases] getDisplayTitle:@"Enhance_SKU_One" defaultTitle:@"Default Title"];
    NSString *desc = [[Enhance purchases] getDisplayDescription:@"Enhance_SKU_One" defaultDescription:@"Default Description"];
}

-(void)onPurchaseFailed 
    // Failure
}

-(void)makePurchase {
    if ([[Enhance purchases] isSupported]) {
        [[Enhance purchases] attemptPurchase:@"my_product" delegate:self];
    }
}

Methods

[Enhance purchases] isSupported

BOOL [[Enhance purchases] isSupported]

Check if the In-App Payments support is currently available in your app.

Return Value:

Returns true if available, false otherwise.

[Enhance purchases] attemptPurchase

void [[Enhance purchases] attemptPurchase:
    (NSString*) productName,
    delegate:(id) delegate
]

Start the purchase flow for the given product.

Parameters:

NSString* productName - The reference name which you entered during the Enhance flow (SKU Mappings).

id delegate - Specifies the callback object. Should implement the PurchaseDelegate protocol. (See the Protocols section for more information)

[Enhance purchases] consume

void [[Enhance purchases] consume:
    (NSString*) productName,
    delegate:(id) delegate
]

Consume the given product, if applicable (availability of this feature depends on the SDK provider, not all support consumable goods).

Parameters:

NSString* productName - The reference name which you entered during the Enhance flow (SKU Mappings).

id delegate - Specifies the callback object. Should implement the ConsumeDelegate protocol. (See the Protocols section for more information)

[Enhance purchases] manuallyRestorePurchases

void [[Enhance purchases] manuallyRestorePurchases:
    (id) delegate
]

Manually restore purchases and update the user's inventory, if applicable (availability of this feature depends on the SDK provider).

Parameters:

id delegate - Specifies the callback object. Should implement the RestoreDelegate protocol. (See the Protocols section for more information)

[Enhance purchases] isItemOwned

BOOL [[Enhance purchases] isItemOwned:
    (NSString*) productName
]

Check if the given product is already owned. The result may be inaccurate, depending on whether the SDK provider stores the information about your products or not.

Parameters:

NSString* productName - The reference name which you entered during the Enhance flow (SKU Mappings).

Return Value:

Returns true if owned, false otherwise.

[Enhance purchases] getOwnedItemCount

int [[Enhance purchases] getOwnedItemCount:
    (NSString*) productName
]

Get a number of the given product that user owns, or 0 if none. The result may be inaccurate, depending on whether the SDK provider stores the information about your products or not.

Parameters:

NSString* productName - The reference name which you entered during the Enhance flow (SKU Mappings).

Return Value:

Returns a number of the given product copies.

[Enhance purchases] getDisplayPrice

NSString* [[Enhance purchases] getDisplayPrice:
    (NSString*) productName,
    defaultPrice:(NSString*) defaultPrice
]

Get a localized display price of the given product, for example: "100zł", "100¥".

Parameters:

NSString* productName - The reference name which you entered during the Enhance flow (SKU Mappings).

NSString* defaultPrice - Default value, used if the real one cannot be fetched for any reason.

Return Value:

Returns a string containing the localized display price.

[Enhance purchases] getDisplayTitle

NSString* [[Enhance purchases] getDisplayTitle:
    (NSString*) productName,
    defaultTitle:(NSString*) defaultTitle
]

Get a localized display title of the given product.

Parameters:

NSString* productName - The reference name which you entered during the Enhance flow (SKU Mappings).

NSString* defaultTitle - Default value, used if the real one cannot be fetched for any reason.

Return Value:

Returns a string containing the localized display title.

Enhance.purchases.getDisplayDescription

NSString* [Enhance.purchases.getDisplayDescription:
    (NSString*) productName,
    defaultDescription:(NSString*) defaultDescription
]

Get a localized display description of the given product.

Parameters:

NSString* productName - The reference name which you entered during the Enhance flow (SKU Mappings).

NSString* defaultDescription - Default value, used if the real one cannot be fetched for any reason.

Return Value:

Returns a string containing the localized display description.

Protocols

protocol PurchaseDelegate
-(void)onPurchaseSuccess;
-(void)onPurchaseFailed;

protocol ConsumeDelegate
-(void)onConsumeSuccess;
-(void)onConsumeFailed;

protocol RestoreDelegate
-(void)onRestoreSuccess;
-(void)onRestoreFailed;