Skip to main content

Swift SDK - Integration Guide

This guide walks you through integrating the Botsi Swift (iOS) SDK. First, it covers the necessary pre-configuration steps you need to complete, with links to detailed how-to articles for each. Finally, it dives into the specifics of SDK configuration.

1. Create and Prepare Your Botsi Account

  1. Sign up for an account.
  2. Add your app.
  3. Follow the Get Started with Botsi guide.

2. Connect the App Store to Botsi

To successfully integrate Botsi with the Apple App Store and manage in-app purchases, it is crucial to configure specific settings within your Apple Developer and App Store Connect accounts. This setup ensures seamless communication between your app and Apple's services, enabling features like subscription management and purchase validation.

For Botsi, you will need to complete the following steps:

  1. Get and Add Your App’s Bundle ID
  • The Bundle ID uniquely identifies your app in the App Store and is required for subscription handling in Botsi.
  1. Provide Issuer ID and Key ID
  • These identifiers are required for StoreKit 2 API integration.
  1. Enable and upload the In-App Purchase API (StoreKit 2)
  • Enabling the In-App Purchase API allows your app to securely validate purchases and access subscription data.
  1. Get and Enter the App Store Shared Secret
  • This 32-character key is used for validating subscriptions and in-app purchases.
  1. Configure the App Store Server Notifications
  • App Store server notifications are crucial for maintaining the accuracy and integrity of your data. By setting them up, you can receive real-time updates directly from the App Store to your dashboard.

3. Set Up Products and Paywalls

Create Product

This action allows you to define a new product within the Botsi Dashboard. You will set up its internal name, access level, subscription period, and link it to its corresponding App Store Product ID.

Create Paywall

This step involves creating a paywall that will present your product to users. You will name the paywall and associate it with a product you have already created.

Create Placement

Creating a placement determines where and how your paywall will be displayed within your application. You will give it a name and ID, and then link it to the paywall you wish to show.

4. Integrate Botsi SDK

  • SDK Repository:
    https://github.com/BotsiTeam/BotsiSDK-iOS

  • Latest available version (tag): 1.0.1

  • Installation:
    The SDK is available via Swift Package Manager.
    CocoaPods support is currently in progress.
    Installation instructions and usage methods are documented here:
    SDK Documentation

  • State of the SDK that is default for Swift Package Manager (SPM)

Example Usage

A basic example using all major SDK methods can be found in the SDK’s Example folder:
View Example File

Key Methods Used in the Example:

`Botsi.activate("public_key")

Botsi.getProfile()

Botsi.fetchProductIDs()

Botsi.getPaywall(from: "paywall_name")

Botsi.getPaywallProducts(from: paywall)

Botsi.logPaywallShown(for: paywall)

Botsi.makePurchase(product)

Botsi.restorePurchases()

Botsi.identify(_ userId: “system_user_id”)

Botsi.logout()`

5. (Optional) Import Historical Data

• Request CSV data export from RevenueCat support.
• Share the export with Botsi support to import your users’ historical data.