I am trying to make a payment via Apple pay using world pay and their SDK HERE https://github.com/Worldpay/worldpay-lib-ios. Within my app this payment is done via a notification, the user clicks on the notification, my app opens and the apple pay view is presented.
When I try to make my payment request (follow code below) with this line
let request = wp.createPaymentRequest(withMerchantIdentifier: ApplePaySwagMerchantID)
However my app crashes with:
2017-03-30 20:38:20.026378 CarGo[757:79619] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Worldpay createPaymentRequestWithMerchantIdentifier:]: unrecognized selector sent to instance 0x1740fea00'
I'm not really sure what could be causing this or how to go about debugging it?
my complete method which runs in the app delegate:
func makePayment(locationString: String){
let defaults = UserDefaults.standard
let topWindow: UIWindow = UIWindow(frame: UIScreen.main.bounds)
topWindow.rootViewController = UIViewController()
topWindow.windowLevel = UIWindowLevelAlert + 1
topWindow.makeKeyAndVisible()
let wp: Worldpay = Worldpay.sharedInstance();
wp.clientKey = "xxxxxxx";
wp.reusable = true;
let request = wp.createPaymentRequest(withMerchantIdentifier: ApplePaySwagMerchantID)
request?.supportedNetworks = SupportedPaymentNetworks
request?.countryCode = "GB"
request?.currencyCode = "GBP"
request?.merchantCapabilities = PKMerchantCapability.capability3DS
var decimalValue = NSDecimalNumber(string: defaults.string(forKey: locationString))
decimalValue = decimalValue.multiplying(by: 100)
self.transactionsDescription = "Toll Payment: " + locationString
self.transactionCost = decimalValue.intValue
request?.paymentSummaryItems = [
PKPaymentSummaryItem(label: "Toll Payment: " + locationString, amount:NSDecimalNumber(string: defaults.string(forKey: locationString)))
]
let applePayController = PKPaymentAuthorizationViewController(paymentRequest: request!)
applePayController.delegate = self
topWindow.rootViewController?.present(applePayController, animated: true, completion: nil)
}
My bridge header file:
#import "Worldpay.h"
#import "APMController.h"
#import "WorldpayAPMViewController.h"
#import "ThreeDSController.h"
#import "WorldpayCardViewController.h"
#import "Worldpay+ApplePay.h"