To run the example project, clone the repo, and run pod install from the Example directory first. Then input your LeatherBack public key to be able to test
- Xcode 11.0 or greater
- iOS 10 or greater
LAAS is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'LAAS'Get the latest version of LAAS via SPM.
Go to File -> Swift Packages -> Add Package Dependency...
Then enter the URL for this package https://github.com/leatherback01/AaaS_iOS_SDK.git and select the most recent version.
import LAASlet param = LeatherBackTransactionParam(amount: 1.50, currencyCode: .GBP, channels: [.Card, .Account], showPersonalInformation: true, reference: "your unique reference number", key: "your public key", isProducEnv: false)
let paymentVC = LeatherBackViewController(delegate: self, param: param)
present(paymentVC, animated: true)let param = LeatherBackTransactionParam(amount: 1500.00, currencyCode: .NGN, channels: [.Card, .Account], showPersonalInformation: false, reference: "your unique reference number", customerEmail: "johndoe@leatherback.co", customerName: "John Doe", key: "your public key", isProducEnv: false)
let paymentVC = LeatherBackViewController(delegate: self, param: param)
present(paymentVC, animated: true)To receive events from the LeatherBackViewController your presenting viewcontroller will need to conform to the LeatherBackDelegate
class ViewController: UIViewController, LeatherBackDelegate {
func onLeatherBackError(error: LeatherBackErrorResponse) {
print("error \(error.localizedDescription)")
}
func onLeatherBackSuccess(response: LeatherBackResponse) {
//Use this reference to verify payment/transaction with LeatherBack
print("success \(response.reference)")
}
func onLeatherBackDimissal() {
print("dismissed")
}
}if showPersonalInformation is set to false, merchants are to provide the Customer's Name and Email address but if showPersonalInformation is set to true, LeatherBack will collect this information from the customer during checkout.
if reference is set to an empty string, it defaults to nil but onLeatherBackSuccess delegate method will return a reference that can be used for verifying transaction/payment
if isProducEnv is set to true, it you are to pass the production key while if it is set false, you are to pass the test keys
if channels is set to nil, the checkout will return all payment collection options
amount: Double // required
currencyCode: Currency // required
key: String // required
showPersonalInformation: Bool // required
isProducEnv: Bool // required
channels:[PaymentChannels] // optional
reference: String // optional
customerEmail: String // optional
customerName: String // optionalLAAS is available under the MIT license. See the LICENSE file for more info.