WayaQuick — iOS SDK
Pure Swift SDK with async/await. Payments, payouts and account checks.
- iOS 14+ · Swift 5.9
- GitHub ↗
https://github.com/WAYA-MULTI-LINK/WAYA-PAY-CHAT-2.0-IOS-SDKThe official iOS SDK for WayaQuick. Accept payments, send payouts and verify accounts — written in pure Swift with no external dependencies.
#Requirements
- iOS 14.0+ / macOS 11.0+
- Swift 5.9+
- Xcode 15+
#Installation
Swift Package Manager is recommended. In Xcode:
- Open your project in Xcode.
- Go to File → Add Package Dependencies.
- Paste the repository URL below.
- Select "Up to Next Major Version" starting from 1.0.0.
- Click Add Package.
https://github.com/WAYA-MULTI-LINK/WAYA-PAY-CHAT-2.0-IOS-SDKOr add it to Package.swift:
dependencies: [
.package(
url: "https://github.com/WAYA-MULTI-LINK/WAYA-PAY-CHAT-2.0-IOS-SDK",
from: "1.0.0"
)
]Then add WayaPayKit to your target dependencies:
.target(
name: "YourApp",
dependencies: ["WayaPayKit"]
)#Quick start
import WayaPayKit
let client = WayaPayClient(options: WayaPayOptions(
merchantId: "your-merchant-id",
publicKey: "your-api-secret-key",
environment: "test" // or "production"
))Every method is async — call it with await from an async context and wrap it in do/catch.
#Initialize payment
Starts a payment and returns the transaction ID to send your customer to.
let request = InitializePaymentRequest(
currency: "NGN",
amount: 5000,
callBackUrl: "https://yoursite.com/callback",
idempotencyKey: UUID().uuidString,
paymentRef: "ORDER-001",
metadata: PaymentMetadata(
firstName: "John",
lastName: "Doe",
phoneNumber: "08012345678",
emailAddress: "john@example.com",
cancelUrl: "https://yoursite.com/cancel"
)
)
do {
let response = try await client.initializePayment(request)
print(response.data?.transactionId ?? "")
} catch {
print("Payment failed: \(error)")
}#Verify account
Returns the registered name for an account number. Always call this before a payout.
let request = VerifyAccountRequest(
accountNumber: "0123456789",
bankCode: "044"
)
let response = try await client.verifyAccount(request)
print(response.data?.accountName ?? "")#Initiate payout
Sends money from your merchant balance to a bank account.
let request = InitiatePayoutRequest(
currency: "NGN",
amount: 10000,
idempotencyKey: UUID().uuidString,
bankCode: "044",
accountNumber: "0123456789"
)
let response = try await client.initiatePayout(request)#Verify transaction
Gets the current status of a transaction by its reference.
let response = try await client.verifyTransaction(
ref: "your-transaction-ref"
)
print(response.data?.status ?? "")#Fetch bank list
Returns every supported bank and its code, for payouts and account verification.
let response = try await client.fetchBankList()
response.data?.banks?.forEach { bank in
print("\(bank.name ?? "") - \(bank.code ?? "")")
}#Environments
| Value | Description |
|---|---|
test | Test environment for development |
production | Live environment for real transactions |
#SwiftUI example
import SwiftUI
import WayaPayKit
struct CheckoutView: View {
@State private var loading = false
@State private var transactionId: String?
private let client = WayaPayClient(
options: WayaPayOptions(
merchantId: "your-merchant-id",
publicKey: "your-api-secret-key",
environment: "test"
)
)
var body: some View {
VStack(spacing: 20) {
if let id = transactionId {
Text("Transaction: \(id)")
}
Button("Pay ₦5,000") {
Task { await startPayment() }
}
.disabled(loading)
}
}
func startPayment() async {
loading = true
defer { loading = false }
let request = InitializePaymentRequest(
currency: "NGN",
amount: 5000,
callBackUrl: "https://yoursite.com/callback",
idempotencyKey: UUID().uuidString,
paymentRef: "ORDER-\(Int.random(in: 1000...9999))",
metadata: PaymentMetadata(
firstName: "John",
lastName: "Doe",
phoneNumber: "08012345678",
emailAddress: "john@example.com"
)
)
do {
let response = try await client.initializePayment(request)
transactionId = response.data?.transactionId
} catch {
print("Payment error: \(error)")
}
}
}#Custom URLSession
Need custom timeouts, retries, or mocks for tests? Pass in your own URLSession.
let config = URLSessionConfiguration.default
config.timeoutIntervalForRequest = 30
config.timeoutIntervalForResource = 60
let session = URLSession(configuration: config)
let client = WayaPayClient(
options: WayaPayOptions(
merchantId: "your-merchant-id",
publicKey: "your-api-secret-key",
environment: "test"
),
session: session
)