Quick Start

This video walks you step-by-step through the iOS SDK integration process. Watch it to quickly understand setup, configuration, and key features in action.

Before integrating the Checkout SDK, please review the following requirements:

You can install the SDK via two paths:

  • Swift Package Manager (Recommended)

  • CocoaPods (Deprecated)

Add Ottu SDK as a dependency in Package.swift:

Or in Xcode:

  1. Open your project

  2. Go to Project > Targets > Package Dependencies

  3. Add ottu-ios as a dependency

Add the following line to your Podfile:

Run:

circle-check
circle-exclamation

Once the SDK is installed, follow these steps to integrate it into your app.

1

Import the SDK

In your ViewController.swift (or any file responsible for presenting the SDK):

2

Conform to OttuDelegate

Your view controller must implement the OttuDelegate protocol:

3

Declare a Checkout Member

Inside your ViewController

4

Initialize Checkout

Inside viewDidLoad, initialize the Checkout SDK:

Required parameters

  • sessionId → ID of the created transaction

  • merchantId → Same as the domain address in API requests

  • apiKey → Public API key for authorization

  • delegate → Callback listener (usually self)

Recommended parameters

  • formsOfPayment → Defines available payment methods

  • setupPreload → Preloads transaction details for faster initialization

setupPreload comes from the transaction creation response. Passing it prevents the SDK from re-fetching transaction details, reducing initialization time by several seconds. It is a decoded JSON object to a TransactionDetails object. See an example: MainViewController.swiftarrow-up-right

The simplest version of the initialization looks like this:

5

Add the Payment View

Still inside viewDidLoad, embed the payment view into your container:

This is a basic example that adds the Checkout view without handling dimensions. For proper layout with constraints, refer to the demo app: OttuPaymentsViewController.swiftarrow-up-right

In order ViewController to be compliant to OttuDelegate, add the following functions to ViewController class:

  • Error → Displays an error alert and navigates back

  • Cancel → Displays cancel reason (custom handling for kpay)

  • Success → Displays success confirmation

This code describes callbacks to be handled by the parent app.

If your app should support Apple Pay:

  1. Enable Apple Pay capability in: Xcode > Targets > Signing & Capabilities

  2. Add Apple Pay Merchant IDs (MID) in project settings

Last updated