iOS offerwall SDK. Swift, SwiftUI, and Objective-C.

Open the Moonetix offerwall in your iPhone and iPad app with one Swift package. It uses only UIKit and WebKit, has no third-party dependencies, and ships with a privacy manifest.

  • 13+iOS and iPadOS
  • 2.0.0Current version
  • 0Third-party dependencies
iOS SDKVersion 2.0.0
AppDelegate.swift
import MoonetixOfferwall
 
Moonetix.configure(appId: "YOUR_APP_ID")
 
// When the user taps Earn
Moonetix.open(token: token)

Go live in four steps.

Copy the code, replace the placeholders with the values from your dashboard under Apps, your app, Integration, and test before you launch.

  1. Install the SDK

    Add the package in Xcode with File, Add Package Dependencies, or use CocoaPods. You can also download the xcframework and embed it by hand. Build with Xcode 16 or newer.

    Package.swift
    dependencies: [
        .package(url: "https://moonetix.com/ios/moonetix-ios.git", from: "2.0.0"),
    ],
    targets: [
        .target(name: "MyApp", dependencies: [
            .product(name: "MoonetixOfferwall", package: "moonetix-ios"),
        ]),
    ]
  2. Add a token endpoint to your server

    Your app never holds the API key. When a user taps Earn, your app asks your server for a session, and your server asks Moonetix for a single-use token for that signed-in user. A token works once, for 10 minutes.

    session.php
    <?php
    // POST /api/moonetix/session: a fresh token for the signed-in user
    $user = current_user();
    if (!$user) {
        http_response_code(401);
        exit;
    }
     
    $key = getenv('MOONETIX_API_KEY');
    $ch  = curl_init('https://api.moonetix.com/v1/session');
    curl_setopt_array($ch, [
        CURLOPT_POST           => true,
        CURLOPT_POSTFIELDS     => http_build_query(['user_id' => (string)$user->id]),
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_TIMEOUT        => 10,
        CURLOPT_HTTPHEADER     => ['Authorization: Bearer ' . $key],
    ]);
    $data = json_decode((string)curl_exec($ch), true);
    $code = (int)curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
     
    header('Content-Type: application/json');
    if ($code === 201 && !empty($data['token'])) {
        echo json_encode(['token' => $data['token']]);
        exit;
    }
    http_response_code($code === 403 ? 403 : 503);
    echo json_encode(['error' => 'offerwall_unavailable']);
  3. Open the offerwall

    Configure once with the App ID from your dashboard, then open the offerwall with a fresh token. Without a view controller, the SDK presents from the top screen of your app, so it works from SwiftUI too.

    EarnViewController.swift
    Moonetix.configure(appId: "YOUR_APP_ID")
     
    Moonetix.onClosed = { [weak self] in
        self?.refreshBalance()
    }
    Moonetix.onError = { error in
        print(error.code.name, error.message)
    }
     
    Moonetix.open(token: token, from: self)
  4. Credit rewards with the postback

    Every reward reaches your server as a signed postback. Check the hash, add the reward once per transaction ID, and take it back if a later postback reverses it. Failed postbacks are retried up to 5 times.

    Postback macros and retries

    Dashboard, Postback tab
    https://yoursite.com/postback?user={user_id}&tx={transaction_id}&status={status}&reward={reward}&hash={hash}
9:41
Earn coins12,450 Coins
EarnMy offers
  • Castle MergeReach level 10+1,500
  • FitTrackStart a free trial+2,000
  • Word RushPlay 3 days in a row+450
  • Budget PalSet up your first budget+800
Reward creditedCastle Merge · +1,500 Coins
Native screen
Postback 200 OK

What your users see

A native screen over your app, with your title and colors, your currency, and every reward confirmed by a postback.

What the SDK handles for you

  • Offers open in the right place

    Offers that lead to the App Store open in the store app, and other sites open in the browser, so installs are tracked correctly.

  • No key inside your app

    Your app holds only the App ID. Sessions are created on your server and work once, so nobody can open the offerwall as another user.

  • A locked-down screen

    Only offerwall pages load inside it, with no JavaScript bridge into your app.

  • Native navigation

    The close button returns to your app, swiping from the left edge goes back inside the offerwall, and it resumes where the user was after the background.

  • Accessible by default

    Light and dark mode, larger text sizes, and VoiceOver work out of the box.

  • Privacy manifest included

    The SDK ships its privacy manifest, uses no device fingerprinting, and does not use the advertising identifier.

Test it, then launch.

Everything you need to check before real users see your offerwall, with the tools built into your dashboard.

  1. Open as a test user

    In Integration status on the Integration tab, open your offerwall as the user owner-test. Test visits are not counted as users.

  2. Run it on a real device

    Build for Android or iOS and open the offerwall from your Earn button with a fresh token each time.

  3. Send a test postback

    Choose the user, status, and payout, and see exactly what your server answered, with the response code and time. Test transaction IDs start with test_.

  4. Test from a normal connection

    VPNs, proxies, Tor, and cloud networks are blocked, so test on home Wi-Fi or mobile data, in a country where offers run.

Launch checklist

0 of 11 ready

Common errors, fixed fast.

What you might see while you integrate the iOS SDK, what causes it, and the fix.

  • INVALID_APP_ID

    The value passed to init is not the App ID. Passing the API key here is the most common mistake.

    FixCopy the 24-character App ID again from the Integration tab.

  • INVALID_TOKEN

    The app passed something other than the token, or a token created with the API key of another app.

    FixPass only the token field, which starts with sst_, and use the App ID and API key of the same app.

  • TOKEN_EXPIRED_OR_USED

    The token is older than 10 minutes or was already used, for example kept from an earlier tap.

    FixCreate a new token for every open, right when the user taps Earn.

  • NOT_INITIALIZED

    open was called before init.

    FixCall Moonetix.configure when your app starts.

  • UNKNOWN

    The offerwall is already open, or no view controller was on screen to present from.

    FixOpen it once at a time, and pass a visible view controller with open(token:from:).

  • Delegate is never called

    Moonetix.delegate is a weak reference, so the object was already released.

    FixKeep a strong reference to your delegate, or use the closures.

  • 403 from /v1/session

    app_not_live means the app is paused or your account is not active. user_blocked means we blocked this user.

    FixDo not show the offerwall. For app_not_live, check your notifications.

  • VPN or Proxy detected

    The device is on a VPN, a proxy, or a cloud network, where offers cannot be tracked.

    FixTest on a normal home or mobile connection, in a country where offers run.

  • Postback log shows 403 or 404

    Your script rejected the postback, or the URL is wrong.

    FixOpen the URL from the log in a browser and check your hash code.

  • Postback log shows a timeout

    Your script takes longer than 6 seconds to answer.

    FixAnswer with 200 first, and run slow work in the background.

  • Postback log shows 301 or 302

    Your URL redirects, for example from http to https.

    FixUse the final URL. Postbacks do not follow redirects.

At a glance

Minimum version
iOS 13, iPhone and iPad, built with Xcode 16 or newer
Languages
Swift, SwiftUI, and Objective-C
Install
Swift Package Manager, CocoaPods, or an xcframework
Dependencies
Only UIKit and WebKit
Privacy
Privacy manifest included, no advertising identifier
Price
Free for approved publishers

Other integrations

iOS questions

What developers ask before they add the iOS SDK.

Stuck on something? Contact us

Which iOS versions does the Moonetix SDK support?

iOS 13 or newer on iPhone and iPad, built with Xcode 16 or newer. The SDK uses only UIKit and WebKit and has no third-party dependencies.

Can I use it with SwiftUI?

Yes. Call Moonetix.open(token:) without a view controller and the SDK presents from the top screen of your app, which works from SwiftUI buttons.

How do I install it?

With Swift Package Manager from https://moonetix.com/ios/moonetix-ios.git, with CocoaPods from our podspec, or by embedding the xcframework by hand.

What do I declare in App Store privacy details?

User ID, Device ID, Coarse Location, and Product Interaction, all linked to the user, not used for tracking, for App Functionality. The SDK’s privacy manifest lists the same data.

Does the offerwall break App Store review rules?

Apple has rules for apps that reward users. The Academy has a guide on running an offerwall in an iOS app within those rules, including how to word your rewards.

How are users rewarded?

Your server receives a signed postback for every reward and credits the user. Never credit from app events, because they can be faked on a device.

Turn your traffic into earnings.

Create a free publisher account and earn from every offer your users complete on your website, app, game, or community.

Worldwide targeting