GithubHelp home page GithubHelp logo

wahed-tech / flutterwavesdk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from boluok/flutterwavesdk

0.0 1.0 0.0 9.88 MB

Flutterwave IOS SDK allows you to build a quick, simple and excellent payment experience in your iOS app. We provide powerful and customizable UI screens and elements that can be used out-of-the-box to collect your users' payment details

Home Page: https://developer.flutterwave.com/

License: Other

Swift 99.24% Ruby 0.76%

flutterwavesdk's Introduction

FlutterwaveSDK

Flutterwave IOS SDK allows you to build a quick, simple and excellent payment experience in your iOS app. We provide powerful and customizable UI screens and elements that can be used out-of-the-box to collect your users' payment details.

Example

To run the example project, clone the repo, and open FlutterwaveSDK.xcworkspace in the Example directory with Xcode, run and build and you are good to go!

  1. If you don’t have an account, sign up for a Flutterwave account.
  2. Fill in the following config details in the Viewcontroller.swift to configure your payment type
config.paymentOptionsToExclude = []
config.currencyCode = "[NGN,USD,KES,RWF,ZAR,GBP,GHS,ZMF,XAF,XOF, e.t.c ]" // This is the specified currency to charge in.
config.email = "[email protected]" // This is the email address of the customer
config.isStaging = false // Toggle this for staging and live environment
config.phoneNumber = "077883***1" //Phone number
config.transcationRef = "IOS TEXT" // This is a unique reference, unique to the particular transaction being carried out. It is generated when it is not provided by the merchant for every transaction.
config.firstName = "Yemi" // This is the customers first name.
config.lastName = "Desola" //This is the customers last name.
config.meta = [["metaname":"sdk", "metavalue":"ios"]] //This is used to include additional payment information
config.narration = "simplifying payments for endless possibilities"
config.publicKey = "[PUB_KEY]" //Public key
config.encryptionKey = "[ENCRYPTION_KEY]" //Encryption key
config.isPreAuth = false  // This should be set to true to preauthoize card transactions
let controller = FlutterwavePayViewController()
let nav = UINavigationController(rootViewController: controller)
controller.amount = "[]" // This is the amount to be charged.
controller.delegate = self
self.present(nav, animated: true)

After this is done, you can make test payments, please ensure config.isStaging = true, toggle to test mode and use the keys gotten when you toggle to test mode on your dashboard.

Please note that the test cards will not work with Live API keys, they will only work on the staging environment.

Please go to https://developer.flutterwave.com/docs/test-cards for a list of test card numbers.

Please note that merchant must be PCI-DSS compliant to be able to charge cards on Flutterwave SDK

Requirements

Flutterwave SDK is compatible with iOS apps running on iOS 11.0 and above. It requires Xcode 10.0+ to build the source.

Installation

FlutterwaveSDK is available through CocoaPods. To install it, simply add the following line to your Podfile and run pod install:

pod 'FlutterwaveSDK'

Usage

 
import FlutterwaveSDK
 
class ViewController: UIViewController, FlutterwavePayProtocol {
 
func tranasctionSuccessful(flwRef: String?, responseData: FlutterwaveDataResponse?) {
print("Successful with \(responseData?.flwRef ?? "Failed to return data")")
 
}
 
func tranasctionFailed(flwRef: String?, responseData: FlutterwaveDataResponse?) {
print( "Failed transaction with FlwRef \(flwRef.orEmpty())")
}
 
let flutterLabel = UILabel()
let exampleLabel = UILabel()
let underLineView = UIView()
let launchButton = UIButton(type: .system)
 
 
 
@objc func showExample(){
   let config = FlutterwaveConfig.sharedConfig()
   config.paymentOptionsToExclude = []
   config.currencyCode = "NGN" // This is the specified currency to charge in.
   config.email = "[email protected]" // This is the email address of the customer
   config.isStaging = false // Toggle this for staging and live environment
   config.phoneNumber = "077883***1" //Phone number
   config.transcationRef = "IOS TEXT" // This is a unique reference, unique to the particular transaction being carried out. It is generated when it is not provided by the merchant for every transaction.
   config.firstName = "Yemi" // This is the customers first name.
   config.lastName = "Desola" //This is the customers last name.
   config.meta = [["metaname":"sdk", "metavalue":"ios"]] //This is used to include additional payment information
   config.narration = "simplifying payments for endless possibilities"
   config.publicKey = "[PUB_KEY]" //Public key
   config.encryptionKey = "[ENCRYPTION_KEY]" //Encryption key
   config.isPreAuth = false  // This should be set to true for preauthorize card transactions
   let controller = FlutterwavePayViewController()
   let nav = UINavigationController(rootViewController: controller)
   controller.amount = "[]" // This is the amount to be charged.
   controller.delegate = self
   self.present(nav, animated: true)
}
 

Contributing

Contributions of any kind are welcomed, including bug fixes, new features, and documentation improvements. The first thing to do is to please open an issue describing what you want to build and we will discuss how to move forward. Otherwise, go ahead and open a pull request for minor changes such as typo fixes and one liners.

Author

Flutterwave Developers

License

FlutterwaveSDK is available under the MIT license. See the LICENSE file for more info.

flutterwavesdk's People

Contributors

texyz avatar corneliusyaovi avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.