K Khay logo
K Khay
Get Started
SwiftPM: Kkhayv1.0.4iOS 14+ & macOS 11+

Swift & iOS Package

The official Swift package for iOS, macOS, watchOS, and Vapor. Built with modern async/await, Apple CryptoKit, and full Sendable compliance across all types.

1. Installation (Swift Package Manager)

Add Kkhay to your Xcode project via File → Add Package Dependencies... or in your Package.swift:

Package.swift
// Add to dependencies:
.package(url: "https://github.com/boboaungdev/kkhay-swift", from: "1.0.4")

2. Async/Await Invoice Creation

PaymentController.swift
import Foundation
import Kkhay
let client = KkhayClient(apiKey: "kkhay_live_YOUR_API_KEY")
func createCheckout() async throws {
let params = CreateInvoiceParams(
amount: 39.99,
currency: "USD",
payNetwork: "solana",
payToken: "USDC",
orderId: "IOS-INV-9901",
title: "In-App Subscription"
)
let invoice = try await client.createInvoice(params)
print("Invoice ID: \(invoice.id)")
print("Hosted URL: \(invoice.hostedUrl)")
// Open in Mobile Safari or ASWebAuthenticationSession
if let url = URL(string: invoice.hostedUrl) {
await UIApplication.shared.open(url)
}
}