# Button Merchant Library

## Version
1.6.1

## Packages
- [androidJvm](https://building.usebutton.com/button-merchant-android/latest/index.html)
- [ButtonMerchantLibrary](https://building.usebutton.com/button-merchant-android/latest/index.html)
- [com.usebutton.merchant](https://building.usebutton.com/button-merchant-android/latest/-button%20-merchant%20-library/com.usebutton.merchant/index.html)
  - [ActivityReportingTask](https://building.usebutton.com/button-merchant-android/latest/-button%20-merchant%20-library/com.usebutton.merchant/-activity-reporting-task/index.html)
  - [ButtonMerchant](https://building.usebutton.com/button-merchant-android/latest/-button%20-merchant%20-library/com.usebutton.merchant/-button-merchant/index.html)
  - [AttributionTokenListener](https://building.usebutton.com/button-merchant-android/latest/-button%20-merchant%20-library/com.usebutton.merchant/-button-merchant/-attribution-token-listener/index.html)
  - [ButtonProduct](https://building.usebutton.com/button-merchant-android/latest/-button%20-merchant%20-library/com.usebutton.merchant/-button-product/index.html)
  - [ButtonProductCompatible](https://building.usebutton.com/button-merchant-android/latest/-button%20-merchant%20-library/com.usebutton.merchant/-button-product-compatible/index.html)
  - [Order](https://building.usebutton.com/button-merchant-android/latest/-button%20-merchant%20-library/com.usebutton.merchant/-order/index.html)
    - [Builder](https://building.usebutton.com/button-merchant-android/latest/-button%20-merchant%20-library/com.usebutton.merchant/-order/-builder/index.html)
    - [Customer](https://building.usebutton.com/button-merchant-android/latest/-button%20-merchant%20-library/com.usebutton.merchant/-order/-customer/index.html)
      - [Builder](https://building.usebutton.com/button-merchant-android/latest/-button%20-merchant%20-library/com.usebutton.merchant/-order/-customer/-builder/index.html)
    - [LineItem](https://building.usebutton.com/button-merchant-android/latest/-button%20-merchant%20-library/com.usebutton.merchant/-order/-line-item/index.html)
      - [Builder](https://building.usebutton.com/button-merchant-android/latest/-button%20-merchant%20-library/com.usebutton.merchant/-order/-line-item/-builder/index.html)
    - [OrderListener](https://building.usebutton.com/button-merchant-android/latest/-button%20-merchant%20-library/com.usebutton.merchant/-order-listener/index.html)
  - [PostInstallIntentListener](https://building.usebutton.com/button-merchant-android/latest/-button%20-merchant%20-library/com.usebutton.merchant/-post-install-intent-listener/index.html)
  - [UserActivityListener](https://building.usebutton.com/button-merchant-android/latest/-button%20-merchant%20-library/com.usebutton.merchant/-user-activity-listener/index.html)
- [com.usebutton.merchant.exception](https://building.usebutton.com/button-merchant-android/latest/-button%20-merchant%20-library/com.usebutton.merchant.exception/index.html)
  - [ApplicationIdNotFoundException](https://building.usebutton.com/button-merchant-android/latest/-button%20-merchant%20-library/com.usebutton.merchant.exception/-application-id-not-found-exception/index.html)
  - [ButtonNetworkException](https://building.usebutton.com/button-merchant-android/latest/-button%20-merchant%20-library/com.usebutton.merchant.exception/-button-network-exception/index.html)
  - [HttpStatusException](https://building.usebutton.com/button-merchant-android/latest/-button%20-merchant%20-library/com.usebutton.merchant.exception/-http-status-exception/index.html)
  - [NetworkNotFoundException](https://building.usebutton.com/button-merchant-android/latest/-button%20-merchant%20-library/com.usebutton.merchant.exception/-network-not-found-exception/index.html)
- [com.usebutton.merchant.module](https://building.usebutton.com/button-merchant-android/latest/-button%20-merchant%20-library/com.usebutton.merchant.module/index.html)
  - [ButtonUserActivity](https://building.usebutton.com/button-merchant-android/latest/-button%20-merchant%20-library/com.usebutton.merchant.module/-button-user-activity/index.html)
  - [Features](https://building.usebutton.com/button-merchant-android/latest/-button%20-merchant%20-library/com.usebutton.merchant.module/-features/index.html)

## Method
### getAttributionToken

```kotlin
@Nullable
open fun getAttributionToken(@NonNull context: Context): String
```

The `attributionToken` from the last inbound Button attributed [Intent](https://developer.android.com/reference/kotlin/android/content/Intent.html). For attribution to work correctly, you must:

- 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.

### Return

The last tracked Button attribution token.
