Create a file called AppDelegate.swift and import the SDK.
import BNPayment
The Merchant Account is the Mobile SDK Merchant ID/Merchant GUID for a second level of authentication. It will be provided to you as part of the sign up process.
For Test mode
:
do {
try BNPaymentHandler.setup(withMerchantAccount: appSettings.getCurrentRunModeMerchantGuid(), baseUrl: appSettings.getRunModeUrl(), debug: true) }
catch {
guard (error as NSError).domain != "Foundation._GenericObjCError", (error as NSError).code != 0 else {
return
}
let alert = UIAlertController(title: "Error", message: error.localizedDescription, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Dismiss", style: .cancel, handler: nil))
}
For Production mode
:
do {
try BNPaymentHandler.setup(withMerchantAccount: appSettings.getCurrentRunModeMerchantGuid(), baseUrl: appSettings.getRunModeUrl(), debug: false) }
catch {
guard (error as NSError).domain != "Foundation._GenericObjCError", (error as NSError).code != 0 else {
return
}
let alert = UIAlertController(title: "Error", message: error.localizedDescription, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Dismiss", style: .cancel, handler: nil))
}
The debug setting should be set to NO in live applications.
Any errors will be set to the error variable passed in. You can find a full example of AppDelegate.swift in the sample app.