# Add Frak to your mobile app

# Add Frak to your mobile app

Frak ships native SDKs for Android and iOS, so the referral loop that works on your website also works inside your app: a customer shares, a friend installs or buys, and the reward is paid on a confirmed order.

## What you get

| Capability | Android | iOS |
| --- | --- | --- |
| Share sheet with a personal referral link | Yes | Yes |
| Reward amounts to display in your UI | Yes | Yes |
| Interaction and purchase tracking | Yes | Yes |
| Referral deep links into your app | Yes | Yes |
| Handoff to install the Frak wallet | Yes | Yes |

Both SDKs split into two pieces: a core with no user interface (nothing pulls in a web view) and an optional UI piece that adds the ready-made sharing sheet.

## The three steps

1. **Register your merchant account.** Sign in to the [business dashboard](https://business.frak.id/) and note your merchant ID. Your mobile app passes it explicitly at startup. See [Register your site](/guides/dashboard/register/).

2. **Add the SDK to your app.** Initialize it once, show a share button, and track your orders. The full walkthrough is in the developer guides below.

3. **Confirm orders from your backend.** Same as on the web: a signed webhook from your server is what actually releases the reward. See [Validate purchases from your backend](/guides/platforms/custom/backend/).

## Install and initialize

Requires Android 7.0 (API 24) and Java 17. Add the artifacts:

```kotlin title="app/build.gradle.kts"
dependencies {
    implementation("id.frak.sdk:core:1.0.0-beta.1")
    // Only if you show the sharing sheet
    implementation("id.frak.sdk:ui:1.0.0-beta.1")
}
```

Initialize once, in `Application.onCreate` or your launcher Activity:

```kotlin
Frak.initialize(
    context = applicationContext,
    config = FrakConfig(merchantId = "your-merchant-id") {
        metadata = FrakMetadata {
            name = "Your Store"
            currency = FrakCurrency.EUR
            homepageLink = "https://your-store.com"
        }
    },
)
```

Show the sharing sheet:

```kotlin
val sharing = FrakSharing.Builder(::onShareResult).build(this)
sharing.present(SharingRequest { targetInteraction = "purchase" })
```

And track a confirmed order:

```kotlin
Frak.client.tracking.purchase(
    customerId = "cust_123",
    orderId = "order_456",
    token = "a-unique-order-token",
)
```

Everything is callable from Java too: every suspending call has a `CompletableFuture` twin.

[Android developer guide](/developers/integration/android/)

Requires iOS 15 and Xcode 16. In Xcode, use **File → Add Package Dependencies** with `https://github.com/frak-id/frak-ios-sdk`, or declare it in a `Package.swift`:

```swift title="Package.swift"
dependencies: [
    .package(url: "https://github.com/frak-id/frak-ios-sdk.git", exact: "1.0.0-beta.1")
],
targets: [
    .target(name: "YourApp", dependencies: [
        .product(name: "FrakSDK", package: "frak-ios-sdk"),
        // Only if you show the sharing sheet
        .product(name: "FrakSDKUI", package: "frak-ios-sdk"),
    ])
]
```

Add the wallet schemes to your `Info.plist`. Your app cannot detect or open the Frak wallet without them:

```xml title="Info.plist"
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>frakwallet</string>
    <string>frakwallet-dev</string>
</array>
```

Then initialize once, at app startup:

```swift
Frak.initialize(
    FrakConfig(
        merchantId: "your-merchant-id",
        metadata: FrakMetadata(
            name: "Your Store",
            currency: .eur,
            homepageLink: "https://your-store.com"
        )
    )
)
```

Show the sharing sheet:

```swift
Button("Share and earn") { isSharing = true }
    .frakSharingSheet(isPresented: $isSharing, request: request) { result in
        // handle the outcome
    }
```

And track a confirmed order:

```swift
await client.tracking.purchase(
    customerId: "cust_123",
    orderId: "order_456",
    token: "a-unique-order-token"
)
```

[iOS developer guide](/developers/integration/ios/)

## Deep links matter more on mobile

A referral link opens in a browser unless your app claims it. Set up App Links on Android (with a published `assetlinks.json`) and Universal Links or a custom URL scheme on iOS, so a referred friend lands in your app with the referral intact. Both developer guides show the exact manifest and `Info.plist` entries.

## Rewards still need a confirmed sale

Tracking a purchase from the app tells Frak an order might be coming. The reward is paid once your backend confirms the order with a signed webhook, exactly like the web integration. The order token you send from the app must match the one your server signs.

## Next steps

[Backend validation](/guides/platforms/custom/backend/)
  [Custom website](/guides/platforms/custom/web/)
  [Add funds](/guides/dashboard/configure/funds/)
  [Create a campaign](/guides/campaigns/create/)