Getting Started
The official iOS SDK for embedding Felloh payment forms in your iOS app. Supports both SwiftUI and UIKit, with card payments and open banking.
Requirements
- iOS 15.0+
- Swift 5.9+
- Xcode 15+
Installation
Add the Felloh iOS SDK to your project using Swift Package Manager.
Install the SDK
dependencies: [
.package(
url: "https://github.com/felloh-org/ios-sdk.git",
from: "1.0.0"
)
]
Or in Xcode: File > Add Package Dependencies and enter the repository URL https://github.com/felloh-org/ios-sdk.git.
Quick Start — SwiftUI
The FellohPayment view is a SwiftUI wrapper that renders the Felloh payment form. Pass your public key, an ecommerce ID
(obtained from your backend via the Ecommerce API), and closure callbacks for payment events.
The ecommerceID must be created server-side using one of the backend SDKs or the REST API. See the Ecommerce resource for details.
SwiftUI Quick Start
import FellohPaymentSDK
struct CheckoutView: View {
var body: some View {
FellohPayment(
configuration: FellohPaymentConfiguration(
publicKey: "pk_live_YOUR_PUBLIC_KEY",
environment: .sandbox
),
ecommerceID: "your-ecommerce-id",
onSuccess: { transaction in
print("Payment succeeded: \(transaction.id)")
},
onDecline: { transaction in
print("Payment declined: \(transaction.id)")
}
)
.frame(height: 500)
}
}
Quick Start — UIKit
For UIKit, create a FellohPaymentView instance, set the delegate, add it to your view hierarchy, and call render(ecommerceID:).
The view automatically adjusts its height based on the payment form content.
UIKit Quick Start
import FellohPaymentSDK
class CheckoutViewController: UIViewController,
FellohPaymentDelegate {
override func viewDidLoad() {
super.viewDidLoad()
let config = FellohPaymentConfiguration(
publicKey: "pk_live_YOUR_PUBLIC_KEY",
environment: .sandbox
)
let paymentView = FellohPaymentView(
configuration: config
)
paymentView.delegate = self
paymentView.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(paymentView)
NSLayoutConstraint.activate([
paymentView.leadingAnchor.constraint(
equalTo: view.leadingAnchor
),
paymentView.trailingAnchor.constraint(
equalTo: view.trailingAnchor
),
paymentView.topAnchor.constraint(
equalTo: view.safeAreaLayoutGuide.topAnchor
),
paymentView.heightAnchor.constraint(
equalToConstant: 500
),
])
try? paymentView.render(
ecommerceID: "your-ecommerce-id"
)
}
func fellohPaymentDidRender(
_ paymentView: FellohPaymentView
) {
print("Payment form loaded")
}
func fellohPayment(
_ paymentView: FellohPaymentView,
didSucceedWith transaction: FellohTransaction
) {
print("Payment succeeded: \(transaction.id)")
}
func fellohPayment(
_ paymentView: FellohPaymentView,
didDeclineWith transaction: FellohTransaction
) {
print("Payment declined: \(transaction.id)")
}
func fellohPayment(
_ paymentView: FellohPaymentView,
isProcessing transaction: FellohTransaction
) {
print("Processing: \(transaction.id)")
}
}
Configuration
The FellohPaymentConfiguration struct controls how the payment form behaves.
Parameters
- Name
publicKeyrequired- Type
- String
- Description
Your publishable API key from the Felloh dashboard. This is safe to include in client-side code.
- Name
environment- Type
- FellohEnvironment
- Description
The payment environment. Defaults to
.production.
- Name
moto- Type
- Bool
- Description
Enable Mail Order/Telephone Order mode. Defaults to
false.
- Name
design- Type
- FellohDesignOptions
- Description
UI options for the payment form. See below.
FellohEnvironment
| Case | Description |
|---|---|
.production | Live payments |
.sandbox | Testing with sandbox credentials |
FellohDesignOptions
- Name
payButton- Type
- Bool
- Description
Show the built-in pay button. Defaults to
true.
- Name
storeCard- Type
- Bool
- Description
Show the card storage option. Defaults to
true.
Full Configuration
let config = FellohPaymentConfiguration(
publicKey: "pk_live_YOUR_PUBLIC_KEY",
environment: .sandbox,
moto: false,
design: FellohDesignOptions(
payButton: true,
storeCard: true
)
)
