Giter VIP home page Giter VIP logo

fattmerchant-ios-sdk's Introduction

Fattmerchant iOS SDK

The Fattmerchant iOS SDK provides a simple way to accept a payment on your iOS app by providing tokenization of payment methods. By using these tokens instead of card and bank information, you no longer have to worry about sending sensitive card information to your server.

iOS Swiped Payments Guide

Mobile Reader Payments

Supercharge your mobile app by quickly adding mobile reader payments using the Omni Mobile SDK. These payments will create invoices, customers, and transaction objects in the Stax platform. You can also choose to have the payment method stored within Stax so you can use it from the Stax API.

How it works

  1. You'll first need to create an ephemeral key to initialize the Omni object.
  2. Then you'll create a TransactionRequest that holds all necessary data to take a payment.
  3. Finally, you'll ask Omni to take the payment by calling the takeMobileReaderPayment() method, passing in the TransactionRequest and a block to run once the payment is complete.

Requirements

  • Xcode 8+
  • iOS 9+
  • Ephemeral Stax API key

Installation

Use CocoaPods to install the Fattmerchant iOS SDK.

  1. Install CocoaPods{:target="_blank" rel="noreferrer"}
  2. Add pod 'Fattmerchant' to your Podfile
  3. Run pod install

Getting Started

Setup Info.plist

In order to build and run with the Cardpresent functionality, you must include the following in your project's Info.plist

  • NSBluetoothAlwaysUsageDescription: Provide a value here to let your users know why Bluetooth access is required

Initialize

Create an instance of InitParams

var initParams = Omni.InitParams(appId: "fmiossample", apiKey: apiKey, environment: Environment.DEV)

Pass the initParams to Omni.initialize(...), along with a completion lambda and an error lambda

omni = Omni()

log("Attempting initalization...")

// Initialize Omni
omni?.initialize(params: initParams, completion: {
  // Initialized!
}) { (error) in

}

Connect a Mobile Reader

In order to connect a mobile reader, you must first search for a list of available readers

omni.getAvailableReaders { readers ->

}

Once you have the list of available ones, you can choose which one you'd like to connect

omni?.getAvailableReaders(completion: { readers in
  guard !readers.isEmpty else {
    self.log("No readers found")
    return
  }

  var chosenReader = ... // Choose a reader

  omni.connect(reader: chosenReader, completion: { connectedReader in
    self.log("Connected reader: \(connectedReader)")
  }) { (error) in
    // Something went wrong
  }
}) {
  self.log("Couldn't connect to the mobile reader")
}

Take a Payment

To take a payment, simply create a TransactionRequest and pass it along to omni.takeMobileReaderTransaction(...)

// Create an Amount
let amount = Amount(cents: 50)

// Create the TransactionRequest
let request = TransactionRequest(amount: amount)

// Take the payment
omni.takeMobileReaderTransaction(request, { completedTransaction in
    // Payment successful!
}) {
    // Error
}

By default, the PaymentMethod used in the Transaction is tokenized for reuse. This allows the PaymentMethod to be used from the Stax Virtual Terminal and via the Stax API. To opt-out of tokenization, you can set the tokenize field of TransactionRequest to false

// Create a TransactionRequest with no tokenization
let request = TransactionRequest(amount: amount, tokenize: false)

Refund a Payment

You can use the [Stax API]({{ site.api_ref_url }}#reference/0/transactions){:target="_blank" rel="noreferrer"} to do so. Once you get the transaction, you can use the refundMobileReaderTransaction method to attempt the refund.

// Attain a transaction
var transaction = Transaction()

// Perform refund
omni.refundMobileReaderTransaction(transaction: transaction, completion: { (refundedTransaction) in
  // Refund successful!
}, error: { error in
  // Error
})

fattmerchant-ios-sdk's People

Contributors

hassannazari avatar muryno avatar omar-salah-elboredy avatar thomasvidas avatar tuliot avatar victor-riv avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

kvyatkovskys

fattmerchant-ios-sdk's Issues

Build errors (duplicate symbol) on iOS (xCode 13.2.1)

Your Environment

Fattmerchant SDK version: 1.4.5
Xcode version: 13.2.1
Platform: iOS
OS version: 11.6 and newer
React Native version: 0.63.2
Pod:

  - boost-for-react-native (1.63.0)
  - CocoaAsyncSocket (7.6.5)
  - CocoaLumberjack (3.7.2):
    - CocoaLumberjack/Core (= 3.7.2)
  - CocoaLumberjack/Core (3.7.2)
  - DoubleConversion (1.1.6)
  - Fattmerchant (1.4.5)

Expected Behavior

Success build

Actual Behavior

image

Steps to Reproduce

  • add react-native-background-geolocation to package.json
  • add Fattmerchant SDK to pod
  • build app

Context

I get a duplicate symbol issue when i introduce Fattmerchant SDK to my project. The libLumberjack.a file of Fattmerchant SDK is conflict with my existed dependency CocoaLumberjack for react-native-background-geolocation module.

I think this issue is caused byFattmerchant SDK linked with CocoaLumberjack without adding a dependency, could you help to deal with this?

Facing below crash in iOS when integrating using pod (Xcode 15.0)

dyld[5995]: Symbol not found: OBJC_CLASS$_NSString
Referenced from: <59D1CD20-5637-3E48-BA10-A52B603D0489> /private/var/containers/Bundle/Application/097C65C6-423B-49F6-9098-95999C2B0B7A/Runner.app/Runner
Expected in: /private/var/containers/Bundle/Application/097C65C6-423B-49F6-9098-95999C2B0B7A/Runner.app/Frameworks/Fattmerchant.framework/Fattmerchant

Payment using credit card using inbuilt API call without Mobile Reader.

Currently, application is accepting payment using a mobile reader using the following method.

    omni?.takeMobileReaderTransaction(request: createTransactionRequest(), completion: { _ in
      self.log("Finished transaction successfully")
    }, error: { error in
      self.log(error)
    })

We have a specific requirement to accept payment without using any device.

The client will enter his credit card information and payment should be done using the tokenized method through the application only.

Is it compatible with Objective-C?

Hello,
I am trying to integrate this SDK in Objective-C project but I am not able to access its classes like 'FattmerchantConfiguration'.

If it is compatible, please share proper documentation to integrate the SDK in Objective-C.

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.