Created
July 5, 2017 15:38
-
-
Save ArchieR7/5d62145db53f403de29a86943ad2b68d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func applePay() { | |
| let request = PKPaymentRequest() | |
| request.merchantIdentifier = "merchant.tw.archie" | |
| request.merchantCapabilities = .capability3DS | |
| request.countryCode = "US" | |
| request.currencyCode = "USD" | |
| request.supportedNetworks = [.visa] | |
| request.paymentSummaryItems = [PKPaymentSummaryItem.init(label: "Archie's shake hand", amount: 2000, type: .final)] | |
| request.shippingType = .storePickup | |
| let contact = PKContact() | |
| contact.emailAddress = "xpopchi@gmail.com" | |
| var name = PersonNameComponents() | |
| name.nickname = "Archie" | |
| contact.name = name | |
| let phone = CNPhoneNumber(stringValue: "0912345678") | |
| contact.phoneNumber = phone | |
| request.billingContact = contact | |
| let applePayController = PKPaymentAuthorizationViewController(paymentRequest: request) | |
| applePayController.delegate = self | |
| present(applePayController, animated: true, completion: nil) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment