Showing posts with label Apple Pay. Show all posts
Showing posts with label Apple Pay. Show all posts

Saturday, January 10, 2015

Apple Pay in Swift

Apple Pay lets you use iPhone 6 and Apple Watch to pay in stores and apps in an easy, secure, and private way."

Below method would be quick start for using this functionality in iOS8+ devices

/*  
Method to make apple pay
*/
func applePaymentProcess(){

if(PKPaymentAuthorizationViewController.canMakePayments()){

let pkRequest = PKPaymentRequest();
pkRequest.countryCode = "US"
pkRequest.currencyCode = "USD"
pkRequest.supportedNetworks = [PKPaymentNetworkAmex,PKPaymentNetworkMasterCard,PKPaymentNetworkVisa]
pkRequest.merchantCapabilities = PKMerchantCapability.CapabilityEMV
// pkRequest.merchantIdentifier =
let item1 = PKPaymentSummaryItem.init(label:"motoX", amount:34.5)
let item2 = PKPaymentSummaryItem.init(label:"motoG", amount:30.5)
pkRequest.paymentSummaryItems = [item1,item2]
var paymentPane = PKPaymentAuthorizationViewController.init(paymentRequest:pkRequest)
}
}

Git Hub Project : https://github.com/prashanthmadi/Apply-Pay-Sample-App---Swift