Official Payvessel Payment SDK for iOS applications.
- 💳 Accept Card, Bank Transfer, and USSD payments
- 🔒 Secure WebView-based checkout
- ✅ Transaction verification
- 🌍 Sandbox and Production environments
- 📱 iOS 13+ support
Add the following to your Package.swift:
dependencies: [
.package(url: "https://github.com/Nex-Panther-Technologies-Ltd/payvessel-ios-sdk.git", from: "1.0.0")
]Or in Xcode:
- Go to File > Add Packages...
- Enter:
https://github.com/Nex-Panther-Technologies-Ltd/payvessel-ios-sdk.git - Select version and click Add Package
Add to your Podfile:
pod 'Payvessel', '~> 1.0'Then run:
pod installimport Payvessel
// In your AppDelegate or app initialization
Payvessel.shared.configure(with: PayvesselConfig(
apiKey: "your_api_key",
secretKey: "your_secret_key",
environment: .sandbox // Use .production for live
))import Payvessel
let params = PayvesselPaymentParams(
amount: 5000.0, // Amount in Naira
email: "[email protected]",
currency: "NGN",
customerName: "John Doe",
phone: "08012345678",
description: "Payment for Order #123"
)
Payvessel.shared.checkout(params: params, from: self) { result in
switch result {
case .success(let transaction):
print("Payment successful!")
print("Reference: \(transaction.reference)")
print("Amount: \(transaction.amount)")
case .cancelled:
print("Payment cancelled by user")
case .failure(let error):
print("Payment failed: \(error.localizedDescription)")
}
}Payvessel.shared.verifyTransaction(reference: "your_reference") { result in
switch result {
case .success(let transaction):
if transaction.isSuccessful {
print("Transaction verified successfully")
}
case .failure(let error):
print("Verification failed: \(error.localizedDescription)")
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
amount |
Double | Yes | Amount in the currency's main unit (e.g., Naira) |
email |
String | Yes | Customer's email address |
currency |
String | No | Currency code (default: "NGN") |
reference |
String | No | Unique transaction reference (auto-generated if not provided) |
customerName |
String | No | Customer's full name |
phone |
String | No | Customer's phone number |
description |
String | No | Payment description |
channels |
[String] | No | Payment channels to enable (e.g., ["card", "bank_transfer"]) |
metadata |
[String: Any] | No | Additional metadata |
| Environment | Description |
|---|---|
.sandbox |
Test environment with test credentials |
.production |
Live environment for real transactions |
case .failure(let error):
switch error {
case .notConfigured:
print("SDK not configured")
case .networkError(let message):
print("Network error: \(message)")
case .apiError(let message):
print("API error: \(message)")
case .cancelled:
print("User cancelled")
default:
print("Error: \(error.localizedDescription)")
}Check the Example folder for a complete sample application.
import UIKit
import Payvessel
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Configure SDK
Payvessel.shared.configure(with: PayvesselConfig(
apiKey: "your_api_key",
secretKey: "your_secret_key",
environment: .sandbox
))
}
@IBAction func payButtonTapped(_ sender: UIButton) {
let params = PayvesselPaymentParams(
amount: 1000.0,
email: "[email protected]",
description: "Test Payment"
)
Payvessel.shared.checkout(params: params, from: self) { result in
switch result {
case .success(let transaction):
self.showAlert(title: "Success", message: "Payment of \(transaction.amount) was successful!")
case .cancelled:
self.showAlert(title: "Cancelled", message: "Payment was cancelled")
case .failure(let error):
self.showAlert(title: "Error", message: error.localizedDescription)
}
}
}
func showAlert(title: String, message: String) {
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default))
present(alert, animated: true)
}
}- iOS 13.0+
- Swift 5.5+
- Xcode 13.0+
- Documentation: docs.payvessel.com
- Email: [email protected]
- Dashboard: dashboard.payvessel.com
MIT License - see LICENSE for details.