Qattah Pay iOS SDK Library
Qattah Pay iOS SDK Library is a payment integration library that allows merchants to accept payments in their iOS applications.
Last updated
Qattah Pay iOS SDK Library is a payment integration library that allows merchants to accept payments in their iOS applications.
Last updated
import qattahpay_ios_sdkvar body: some Scene {
WindowGroup {
ContentView(viewModel: ContentViewModel(qattahPay: QattahPaySDK(apiKey: "<YOUR_API_HERE>")))
}
}// create a new payment request
let paymentRequest = PaymentRequestBuilder().setAmount(120).setCurrency(Currency.SAR).setOrderId("ORDER_ID").setDescription("ORDER_DESCRIPTION").setCustomerEmail("[email protected]").setCustomerMobileNumber("0501234567").setLanguage(language).setTheme(theme).isSandbox(true).build()
// start a new payment session
qattahPay.startPaymentSession(paymentRequest: paymentRequest, onSuccess: { qattahResponse in
//handle creation success
}, onFail: { errorMessage in
//handle creation failure
})NavigationLink(destination: QattahWebView(qattahResponse: viewModel.qattahResponse, qattahPaymentCallback: self.qattahPaymentCallback as PaymentCallback), isActive: $viewModel.navigatToQattahWebView) {
EmptyView()
}import Foundation
import qattahpay_ios_sdk
class QattahPaymentCallback: PaymentCallback {
func onStarted(paymentId: String) {
print(paymentId)
}
func onSuccess(paymentId: String) {
print(paymentId)
}
func onError(errorMessage: String) {
print(errorMessage)
}
func onCancel() {
print("onCancel")
}
}