Skip to content

nimbbl-tech/nimbbl_ios_sample_app

Repository files navigation

Nimbbl iOS Sample App

A complete sample iOS application demonstrating the integration of Nimbbl payment services using both the Core API SDK and WebView SDK.

πŸ“± Overview

This sample app showcases how to integrate Nimbbl payment services into your iOS application. It demonstrates:

  • Complete payment checkout flow
  • Integration with both Core API SDK and WebView SDK
  • Modern UI with payment customization options
  • Error handling and user feedback
  • Settings and configuration management

πŸš€ Features

Payment Integration

  • βœ… Complete checkout flow implementation
  • βœ… Order creation and management
  • βœ… Payment processing with WebView interface
  • βœ… Success and error handling
  • βœ… Transaction status tracking

UI/UX Features

  • βœ… Modern, intuitive interface
  • βœ… Payment amount customization
  • βœ… Currency selection (INR, USD, etc.)
  • βœ… Payment method customization
  • βœ… Header customization options
  • βœ… User details collection
  • βœ… Settings management

Technical Features

  • βœ… Integration with Core API SDK
  • βœ… Integration with WebView SDK
  • βœ… Delegate-based callbacks
  • βœ… Error handling and logging
  • βœ… Build scripts for development
  • βœ… Production-ready configuration

πŸ“‹ Requirements

  • iOS: 13.0+
  • Xcode: 12.0+
  • Swift: 5.0+
  • CocoaPods: Latest version

οΏ½οΏ½ Installation

1. Clone the Repository

git clone https://github.com/nimbbl-tech/nimbbl_ios_sample_app.git
cd nimbbl_ios_sample_app

2. Install Dependencies

The sample app uses local SDK dependencies. Make sure you have the following repositories cloned in the same directory:

# Clone Core API SDK
git clone https://bitbucket.org/nimbbl-tech/nimbbl_mobile_kit_ios_core_api_sdk.git

# Clone WebView SDK
git clone https://bitbucket.org/nimbbl-tech/nimbbl_mobile_kit_ios_webview_sdk.git

3. Install CocoaPods Dependencies

pod install

4. Open the Project

open NimbblSampleApp.xcworkspace

🎯 Usage

Running the Sample App

  1. Open the workspace in Xcode
  2. Select your target device (iPhone Simulator or physical device)
  3. Build and run the project (⌘+R)

Sample App Features

1. Payment Configuration

  • Amount: Set payment amount (default: β‚Ή100)
  • Currency: Select currency (INR, USD, etc.)
  • Payment Options: Customize payment methods
  • Header Options: Customize checkout header

2. User Details

  • Name: Customer name
  • Phone: Contact number
  • Email: Email address
  • Toggle: Enable/disable user details collection

3. Payment Flow

  1. Configure payment settings
  2. Tap "Pay Now" to start checkout
  3. Complete payment in the WebView interface
  4. View results (success/error)

4. Settings

  • Environment URL: Configure API endpoints
  • QA Environment: Switch between environments

πŸ“ Project Structure

NimbblSampleApp/
β”œβ”€β”€ App/
β”‚   β”œβ”€β”€ AppDelegate.swift
β”‚   β”œβ”€β”€ LaunchScreen.storyboard
β”‚   └── NimbblCheckout-Bridging-Header.h
β”œβ”€β”€ Extensions/
β”‚   β”œβ”€β”€ UIColor+Hex.swift
β”‚   β”œβ”€β”€ UIComponents.swift
β”‚   └── ViewController+UITextFieldDelegate.swift
β”œβ”€β”€ Models/
β”‚   β”œβ”€β”€ IconWithName.swift
β”‚   └── ImageWithName.swift
β”œβ”€β”€ Resources/
β”‚   └── Assets.xcassets/
β”œβ”€β”€ Supporting/
β”‚   β”œβ”€β”€ AppConstants.swift
β”‚   β”œβ”€β”€ CODE_ORGANIZATION.md
β”‚   └── Config.swift
β”œβ”€β”€ ViewModels/
β”‚   β”œβ”€β”€ Payment/
β”‚   β”‚   └── PaymentManager.swift
β”‚   └── User/
β”‚       └── UserDetailsManager.swift
β”œβ”€β”€ Views/
β”‚   β”œβ”€β”€ Payment/
β”‚   β”‚   β”œβ”€β”€ HeaderOptionsBottomSheetViewController.swift
β”‚   β”‚   β”œβ”€β”€ PaymentOptionsBottomSheetViewController.swift
β”‚   β”‚   └── SubPaymentOptionsBottomSheetViewController.swift
β”‚   β”œβ”€β”€ Settings/
β”‚   β”‚   └── SettingsViewController.swift
β”‚   β”œβ”€β”€ ThankYou/
β”‚   β”‚   └── ThankYouVC.swift
β”‚   └── ViewController.swift
β”œβ”€β”€ Podfile
β”œβ”€β”€ Podfile.production
β”œβ”€β”€ build_without_sandbox.sh
└── clean_project.rb

πŸ”§ Configuration

Environment Setup

The sample app supports multiple environments:

// Development Environment
let devUrl = "https://api-qa1.nimbbl.tech"

// Production Environment
let prodUrl = "https://api.nimbbl.tech"

SDK Integration

The sample app demonstrates integration with both SDKs:

// Core API SDK Integration
import nimbbl_mobile_kit_ios_core_api_sdk

let sdk = NimbblCoreApiSDK.shared
sdk.updateOrderDetails(token: orderToken, orderId: orderId) { result in
    // Handle response
}

// WebView SDK Integration
import nimbbl_mobile_kit_ios_webview_sdk

NimbblCheckoutSDK.shared.delegate = self
let options = NimbblCheckoutOptions()
options.orderToken = "your_order_token"
NimbblCheckoutSDK.shared.checkout(from: self, options: options)

🎨 Customization

UI Customization

The sample app includes various customization options:

  • Header Options: Customize checkout header appearance
  • Payment Options: Configure available payment methods
  • Amount & Currency: Set payment amount and currency
  • User Details: Collect customer information

Payment Flow Customization

// Customize checkout options
let options = NimbblCheckoutOptions()
options.orderToken = orderToken
options.amount = amount
options.currency = currency
options.customerName = customerName
options.customerEmail = customerEmail
options.customerPhone = customerPhone

// Start checkout
NimbblCheckoutSDK.shared.checkout(from: self, options: options)

πŸ” Debugging

Build Scripts

The project includes helpful build scripts:

# Build without code signing (for development)
./build_without_sandbox.sh

# Clean project
ruby clean_project.rb

Logging

The sample app includes comprehensive logging:

// Enable debug logging
LogUtil.debugLog(tag: "SampleApp", message: "Debug message")

// Error logging
LogUtil.errorLog(tag: "SampleApp", message: "Error occurred")

πŸ“š Documentation

πŸ› Troubleshooting

Common Issues

  1. Build Errors

    • Ensure all SDK repositories are cloned
    • Run pod install to install dependencies
    • Clean build folder (⌘+Shift+K)
  2. Runtime Errors

    • Check network connectivity
    • Verify API endpoints in settings
    • Check console logs for error messages
  3. Payment Issues

    • Verify order token is valid
    • Check payment amount and currency
    • Ensure proper delegate implementation

Getting Help

  • Documentation: Check the SDK documentation
  • Issues: Report issues on GitHub
  • Support: Contact support@nimbbl.com

πŸš€ Production Deployment

Before Production

  1. Update API endpoints to production URLs
  2. Configure code signing for App Store distribution
  3. Test thoroughly on physical devices
  4. Review security settings and configurations

Build Configuration

# Production build
xcodebuild -workspace NimbblSampleApp.xcworkspace \
           -scheme NimbblSampleApp \
           -configuration Release \
           -destination 'generic/platform=iOS' \
           archive

πŸ“„ License

This sample app is provided as-is for demonstration purposes. See the LICENSE file for details.

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

πŸ“ž Support

For support and questions:


Happy Coding! πŸŽ‰

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages