# ButtonMerchant

To get started with your integration, get your application Id from from the [Button Dashboard](https://app.usebutton.com/) and follow our simple [integration guide](https://developer.usebutton.com/docs/ios-add-merchant-library).

- `

attributionToken
`

The last `attributionToken` from an inbound Button attributed URL.

- Always access this token directly— **never cache it**.
  - Never manage the lifecycle of this token—Button manages the token validity window server-side.
  - Always include this value when reporting orders to your order API

#### Declaration
- `

configure(applicationId:)
`

Configures ButtonMerchant with your application Id.

#### Declaration

#### Parameters

|     |     |
| --- | --- |
| `<br>                                applicationId<br>` | Your application Id (required) |

- `

trackIncomingURL(_:)  
`

Checks the passed URL for a Button attribution and if present stores the token.

- `application(_:open:options:)`
  - `application(_:userActivity:restorationHandler:)`

#### Declaration
#### Parameters

|     |     |
| --- | --- |
| `<br>                                url<br>` | A URL that has entered your app from a third party source. |

- `

trackIncomingUserActivity(_:)  
`

Checks the URL in the passed NSUserActivity for Button attribution and if present stores the token.

- `application(_:userActivity:restorationHandler:)`

#### Declaration
#### Parameters

|     |     |
| --- | --- |
| `<br>                                userActivity<br>` | A NSUserActivity with which your app has been continued. |

- `

handlePostInstallURL(_:)  
`

Checks to see if the user visited a url destined for your app prior to installing your app.

If a url is found, your completion handler will be called with the url and you are responsible for navigating the user to the relevant content in your app. If a url is not found or an error occurs, your completion handler will be called without a url and you can continue with your normal launch sequence.

#### Declaration
#### Parameters

|     |     |
| --- | --- |
| `<br>                                completion<br>` | A completion block taking an optional url and optional error. |

- `

reportOrder(_:completion:)  
`

Reports an order to Button.

#### Declaration
#### Parameters

|     |     |
| --- | --- |
| `<br>                                order<br>` | Your order object to be reported. |
| `<br>                                completion<br>` | An optional completion block taking an optional error. |

- `

clearAllData()  
`

Discards the current session and all persisted data.

#### Declaration
- `

features  
`

An interface through which library features can be enabled/disabled.

#### Declaration
- `

activity  
`

An interface through which user activity can be reported.

#### Declaration
