Skip to content
Hamon Riazy edited this page May 9, 2016 · 1 revision

In order to do ApplePay transactions, you first need to select what kind of transaction you want to do. While technically you can do Payments, PreAuths and RegisterCard transactions using ApplePay, it only really makes sense to do Payments and PreAuths. The first step is to create a transaction for one of these classes like illustrated below in your .paymentAuthorizationViewController(_:didAuthorizePayment:completion:) method where the delegate is called with a given PKPayment object.

let applePayTransaction = try! self.judoKitSession.payment(someJudoID, amount: someAmount, reference: someRef).pkPayment(payment)

in case you intend to do an ApplePay preAuth transaction, just call .preAuth(...) instead of .payment(...) on your JudoKit session object.

In order to send the transaction, just call .completion on the newly created transaction object.

applePayTransaction.completion { (response, error) in
    // handle completion
}

Clone this wiki locally