Skip to content

BoltApp/bolt-ios-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Bolt IOS SDK

What is this?

Native IOS support support for Bolt Web Payments. A programmatic way to for out-of-app purchases, interactive ads, and subscriptions.

We also support other platforms:

JavaScript
JavaScript
Javascript SDK
Unity
Unity
Unity SDK
Unreal
Unreal Engine
Unreal SDK
iOS
iOS
This Repo
Android
Android
Coming Soon 🚧

Discord

Chat with us on Discord for help and inquiries!

πŸ“š Documentation

For documentation and API reference visit our quick start guide.

πŸ’° Why Bolt

Only with Bolt you get 2.1% + $0.30 on all transactions. That's 10x better than traditional app stores which take 30% of your revenue! That's the fair and transparent pricing you get with using Bolt.

Disclaimer: Fees are subject to change but will continue to remain highly competitive. See bolt.com/pricing for up to date rates and visit bolt.com/end-user-terms for end user terms and conditions.

πŸ› οΈ Prerequisites

You need 3 things to get started:

  1. Existing IOS App: You will need an ios application that supports SVM (Swift Version Manager)
  2. Backend Server: You will need to bring your own backend server (any language)
  3. Bolt Merchant Account: Dashboard access to manage your gaming store (signup or login)

πŸ“¦ Installation

Step 1: Install the IOS SDK

Add the Bolt iOS SDK to your project using Swift Package Manager:

  1. In Xcode, go to File β†’ Add Package Dependencies
  2. Enter the repository URL: https://github.com/BoltApp/bolt-ios-sdk
  3. Click Add Package
  4. Select BoltSDK and click Add Package

Alternatively, you can add it directly to your Package.swift:

dependencies: [
    .package(url: "https://github.com/BoltApp/bolt-ios-sdk", from: "1.0.0")
]

Step 2: Add code to your app

Import the SDK in your Swift files:

import BoltSDK

Then use the SDK in your app:

// Links in this sample are examples. You will need to follow our quickstart guide on how to fetch URLs from the API.

// For checkout functionality
boltSDK.gaming.openCheckout("https://bolt.com/checkout?id=123")

// For ad functionality
boltSDK.gaming.openAd("https://bolt.com/ad?id=abc", in: self) { result in
    switch result {
    case .success(let link):
        print("Ad opened: \(link)")
    case .failure(let error):
        print("Error: \(error)")
    }
}

For SwiftUI integration, see the examples in Step 4 below.

Step 3: Continue with Backend Integration

You will need to bring your own backend server to complete integration.

  • Quick Start: View our quickstart guide to get the API running
  • Example Server: We also have a sample server in NodeJS for your reference during implementation

Step 4: Example Usage

UIKit Integration

// Example usage. For real URLs you will need to use our api. See our quickstart above.
boltSDK.gaming.openCheckout("https://bolt.com/checkout?id=123")

boltSDK.gaming.openAd("https://bolt.com/ad?id=abc", in: self) { result in
    switch result {
    case .success(let link):
        print("Ad opened: \(link)")
    case .failure(let error):
        print("Error: \(error)")
    }
}

SwiftUI Integration

For SwiftUI apps, use our helper components for a simple:

import SwiftUI
import BoltSDK

struct ContentView: View {
    var body: some View {
        VStack(spacing: 20) {
            Text("Bolt SDK Demo")
                .font(.title)
            
            // Simple checkout button for testing
            // Replace button with your own and grab link from the API
            BoltCheckoutButton(
                checkoutLink: "https://bolt.com/checkout?id=123",
                buttonTitle: "Buy Now"
            )
            
            // Simple ad button for testing
            // Replace button with your own and grab link from the API
            BoltAdButton(
                adLink: "https://bolt.com/ad?id=123",
                buttonTitle: "Watch Ad"
            ) { result in
                switch result {
                case .success(let link):
                    print("Ad completed: \(link)")
                case .failure(let error):
                    print("Ad failed: \(error)")
                }
            }
        }
        .padding()
    }
}

Manual SwiftUI Integration

If you need more control, you can manually integrate with the helper:

import SwiftUI
import BoltSDK
import UIKit

struct ContentView: View {
    @State private var viewController: UIViewController?

    var body: some View {
        VStack {
            Image(systemName: "globe")
                .imageScale(.large)
                .foregroundStyle(.tint)
            Text("Hello, world!")
            Button("Press me") {
                guard let viewController else { return }
                boltSDK.gaming.openAd("https://sandbox.gcom.toffeepay.com/love.com/offer_01k5y8wdbk5b390mmwdz5ja7cd", in: viewController) { result in
                    print("Webview closed")
                }
            }
        }
        .padding()
        .background(
            BoltViewControllerProvider { vc in
                viewController = vc
            }
        )
    }
}

Need help?

Got questions, roadmap suggestions, or requesting new SDKs?
Get help and chat with us about anything on Discord Discord

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Add Bolt to your iOS app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages