Button Class Reference

Button

The main interface to the Button SDK.


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

### Starting the SDK

- ```
                      configure(applicationId:)

Configures Button with your applicationId.

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

@params applicationId Your applicationId (required).

Declaration

Parameters

<br> completionHandler<br> A block to be executed upon completion (optional).

Fetching a Purchase Path


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/docs/publishers-ios-app-setup#handle-link-routing-when-a-user-taps](https://developer.usebutton.com/docs/publishers-ios-app-setup#handle-link-routing-when-a-user-taps)

Example usage:

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


#### Declaration

### User Association

- ```
                      user

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 or a stable hash of one. You can use this later to look up orders in
Webhooks.

Button.user.setIdentifier(myLoggedInUser.identifier);

Declaration

Feature Configuration


Button SDK feature configuration.

#### Declaration

### Offers

- ```
                      offers

Offer impressions

Declaration

Debugging


Debug the Button SDK.

@discussion  
Enable debug logging during integration for more visibility.

Button.debug.loggingEnabled = YES;


#### Declaration

### Clearing Data

- ```
                      clearAllData()

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.

Declaration