# Quick start

> Four steps from a live app to rewarded users. Copy the code, change the names, and test.

Source: https://docs.sharklio.com/

**Using a coding agent?** Copy a ready-made prompt for your app from your dashboard. See [AI agent setup](https://docs.sharklio.com/ai-agent-setup).

## Before you start

Your publisher account must be approved; every app you add is live right away. Open your dashboard, Apps, your app, Integration. You need the values below from there:

| Value | Where you use it |
| --- | --- |
| App ID | In the offerwall link and in the mobile SDKs. |
| Link hash salt | On your server, to sign the offerwall link. |
| Postback secret key | On your server, to check that postbacks come from us. |
| API key | On your server, for the Offers API, the Reporting API, and mobile SDK sessions. |

Keep the salt, the secret key, and the API key on your server. Never put them in JavaScript or in an app.

## 1. Show the offerwall

Build the link on your server for the signed-in user, then open it, embed it on a page, or open it in a pop-up.

```
$userId = (string)$currentUser->id;
$hash   = hash_hmac('sha256', $userId, $linkHashSalt);
$link   = 'https://wall.sharklio.com/' . $appId . '?user_id=' . rawurlencode($userId) . '&hash=' . $hash;
```

```html
<iframe src="LINK" style="border:0;width:100%;height:100vh" title="Offerwall"></iframe>
```

You can also add a [floating button](https://docs.sharklio.com/offerwall-link#floating-button) that opens the offerwall in a pop-up.

Every embed option, and the same code in Node.js and Python: [Offerwall link](https://docs.sharklio.com/offerwall-link).

The offerwall is one of three ways to integrate. Want offers in your own design? Use the [Offers API](https://docs.sharklio.com/offers-api). Building a mobile app or game? The mobile SDKs show the offerwall as a native screen: [Android](https://docs.sharklio.com/android-sdk), [iOS](https://docs.sharklio.com/ios-sdk), [Flutter](https://docs.sharklio.com/flutter-sdk), [React Native](https://docs.sharklio.com/react-native-sdk), and [Unity](https://docs.sharklio.com/unity-sdk). Rewards reach your server the same way with all three.

## 2. Add your postback URL

In the Postback tab, enter the URL of a script on your server, with the macros you want:

```
https://yoursite.com/sharklio-postback.php?user={user_id}&tx={transaction_id}&status={status}&reward={reward}&hash={hash}
```

## 3. Handle the postback

Check the hash, then act on the status. Every transaction keeps the same ID from start to end, so store the last status you handled.

```
$tx     = $_GET['tx'] ?? '';
$userId = $_GET['user'] ?? '';
$reward = $_GET['reward'] ?? '0';
$status = (int)($_GET['status'] ?? 0);

$expected = hash_hmac('sha256', "$tx:$userId:$reward:$status", $postbackSecretKey);
if (!hash_equals($expected, $_GET['hash'] ?? '')) {
    http_response_code(403);
    exit;
}

$last = get_last_status($tx);
if ($status === 1 && $last !== 1 && $last !== 2) {
    add_to_balance($userId, $reward);
    save_status($tx, 1);
} elseif ($status === 2 && $last === 1) {
    subtract_from_balance($userId, $reward);
    save_status($tx, 2);
}
http_response_code(200);
```

| Status | Meaning | Your server |
| --- | --- | --- |
| `1` | Credited | Add the reward. |
| `2` | Reversed | Take the reward back. |

## 4. Test it

1. Click Open as a test user in Integration status on the Integration tab to see your offerwall.
2. Click Send a test postback there. By default it sends status 1 for `test_user`.
3. Open Reports, Postbacks in your dashboard and check that your server answered 200.
4. Check that `test_user` got the reward in your system, then remove it.

Test from a normal home or mobile connection. On a VPN, a proxy, or a cloud server, the offerwall shows a block page, such as VPN detected, instead of offers. See [Test from a normal connection](https://docs.sharklio.com/testing#vpn). If something does not work, see [Testing and troubleshooting](https://docs.sharklio.com/testing).
