Integrate with Enhance - Native iOS
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.
Example Usage
-(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]
Return Value:
Returns true
if available, false
otherwise.
[Enhance purchases] attemptPurchase
void [[Enhance purchases] attemptPurchase:
(NSString*) productName,
delegate:(id) delegate
]
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
]
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
]
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
]
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
]
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
]
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
]
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
]
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;