CocoaPods trunk is moving to be read-only. Read more on the blog, there are 7 months to go.

Payvessel 1.0.0

Payvessel 1.0.0

Maintained by Nex Panther Technologies Ltd.



Payvessel 1.0.0

  • By
  • Nex Panther Technologies Ltd

Payvessel iOS SDK

Official Payvessel Payment SDK for iOS applications.

Swift iOS License

Features

  • 💳 Accept Card, Bank Transfer, and USSD payments
  • 🔒 Secure WebView-based checkout
  • ✅ Transaction verification
  • 🌍 Sandbox and Production environments
  • 📱 iOS 13+ support

Installation

Swift Package Manager

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:

  1. Go to File > Add Packages...
  2. Enter: https://github.com/Nex-Panther-Technologies-Ltd/payvessel-ios-sdk.git
  3. Select version and click Add Package

CocoaPods

Add to your Podfile:

pod 'Payvessel', '~> 1.0'

Then run:

pod install

Quick Start

1. Configure the SDK

import 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
))

2. Initiate Payment

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)")
    }
}

3. Verify Transaction (Optional)

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)")
    }
}

Payment Parameters

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

Environment Description
.sandbox Test environment with test credentials
.production Live environment for real transactions

Error Handling

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)")
    }

Example App

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)
    }
}

Requirements

  • iOS 13.0+
  • Swift 5.5+
  • Xcode 13.0+

Support

License

MIT License - see LICENSE for details.