Button Class Reference

Inherits from NSObject
Declared in Button.h

Other Methods

  version

The current SDK version (e.g. @“6.0.0”).

@property (class, readonly) NSString *version

Discussion

The current SDK version (e.g. @“6.0.0”).

Declared In

Button.h

Starting the SDK

+ configureWithApplicationId:completion:

Configures Button with your applicationId.

+ (void)configureWithApplicationId:(NSString *)applicationId completion:(nullable void ( ^ ) ( NSError *__nullable error ))completionHandler

Parameters

completionHandler

A block to be executed upon completion (optional).

Discussion

Configures Button with your applicationId.

@note Get your application Id from from the Button Dashboard.

@params applicationId Your applicationId (required).

Declared In

Button.h

Opening a URL

+ openURL:

Opens a URL in the Browser. Works with direct and non-direct partnerships.

+ (void)openURL:(NSURL *)url

Parameters

url

The URL to open (required).

Discussion

Opens a URL in the Browser. Works with direct and non-direct partnerships.

Declared In

Button.h

+ openURL:config:

Opens a URL in the Browser with a configuration object. Works with direct and non-direct partnerships.

+ (void)openURL:(NSURL *)url config:(nullable BTNBrowserConfig *)config

Parameters

url

The URL to open (required).

config

An object used to configure the Browser (optional).

Discussion

Opens a URL in the Browser with a configuration object. Works with direct and non-direct partnerships.

Declared In

Button.h

+ openURL:completion:

Opens a URL in the Browser with a completion handler. Works with direct and non-direct partnerships.

+ (void)openURL:(NSURL *)url completion:(nullable void ( ^ ) ( NSError *__nullable error ))completionHandler

Parameters

url

The URL to open (required).

completionHandler

A block that is invoked after opening the URL (optional).

Discussion

Opens a URL in the Browser with a completion handler. Works with direct and non-direct partnerships.

Declared In

Button.h

+ openURL:config:completion:

Opens a URL in the Browser with a configuration object and a completion handler. Works with direct and non-direct partnerships.

+ (void)openURL:(NSURL *)url config:(nullable BTNBrowserConfig *)config completion:(nullable void ( ^ ) ( NSError *__nullable error ))completionHandler

Parameters

url

The URL to open (required).

config

An object used to configure the Browser (optional).

completionHandler

A block that is invoked after opening the URL (optional).

Discussion

Opens a URL in the Browser with a configuration object and a completion handler. Works with direct and non-direct partnerships.

Declared In

Button.h

+ openURL:title:subtitle:completion:

Opens a URL in the Browser. Works with direct and non-direct partnerships.

+ (void)openURL:(NSURL *)url title:(nullable NSString *)title subtitle:(nullable NSString *)subtitle completion:(nullable void ( ^ ) ( NSError *__nullable error ))completionHandler

Parameters

url

The URL to open (required).

title

A title to set on the Browser (optional).

subtitle

A subtitle to set on the Browser (optional).

completionHandler

A block that is invoked after opening the URL (optional).

Discussion

Opens a URL in the Browser. Works with direct and non-direct partnerships.

Declared In

Button.h

Fetching a Purchase Path

  purchasePath

Button Purchase Path takes regular Merchant URLs to products, categories or just the homepage and replaces them with a fully attributed Button Purchase Path, optimized for both conversion and user experience. https://developer.usebutton.com/guides/publishers/ios/create-a-button-purchase-path

@property (class, readonly) id<BTNPurchasePathInterface> purchasePath

Discussion

Button Purchase Path takes regular Merchant URLs to products, categories or just the homepage and replaces them with a fully attributed Button Purchase Path, optimized for both conversion and user experience. https://developer.usebutton.com/guides/publishers/ios/create-a-button-purchase-path

Example usage:

@code BTNPurchasePathRequest request = [BTNPurchasePathRequest requestWithURL:merchantURL]; [Button.purchasePath fetchWithRequest:request purchasePathHandler:^(BTNPurchasePath purchasePath, NSError *error) { [purchasePath start]; }]; @endcode

Declared In

Button.h

User Association

  user

Associate your user with a Button session.

@property (class, readonly) id<BTNUser> user

Discussion

Associate your user with a Button session.

@discussion You can associate all Button activity with one of your users by setting their User Identifier. This can be your user ID, email or a stable hash of one. You can use this later to look up orders, activity and identify the user in Webhooks.

@code Button.user.setIdentifier(myLoggedInUser.identifier); @endcode

Declared In

Button.h

Feature Configuration

  configuration

Button SDK feature configuration.

@property (class, readonly) id<BTNConfigurationInterface> configuration

Discussion

Button SDK feature configuration.

Declared In

Button.h

Personalization

  personalization

Personalize your user’s experience.

@property (class, readonly) id<BTNPersonalizationInterface> personalization

Discussion

Personalize your user’s experience.

Declared In

Button.h

Debugging

  debug

Debug the Button SDK.

@property (class, readonly) id<BTNDebugInterface> debug

Discussion

Debug the Button SDK.

@discussion Enable debug logging during integration for more visibility.

@code Button.debug.loggingEnabled = YES; @endcode

Declared In

Button.h

Clearing Data

+ clearAllData

Discards the current session and all persisted data.

+ (void)clearAllData

Discussion

Discards the current session and all persisted data.

@discussion Call this method in your log out handler if/when your user logs out of your app.

Declared In

Button.h