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
| import UIKit | |
| class BSPopupView: UIView { | |
| override init(frame: CGRect) { | |
| super.init(frame: frame) | |
| setup() | |
| } | |
| required init?(coder aDecoder: NSCoder) { |
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 paymentAuthorizationViewControllerDidFinish(_ controller: PKPaymentAuthorizationViewController) { | |
| // Dismiss payment authorization view controller | |
| dismiss(animated: true, completion: { | |
| }) | |
| } |
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 paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didAuthorizePayment payment: PKPayment, completion: @escaping (PKPaymentAuthorizationStatus) -> Void) { | |
| STPAPIClient.shared().createToken(with: payment) { (token: STPToken?, error: Error?) in | |
| guard let token = token, error == nil else { | |
| // Present error to user... | |
| return | |
| } | |
| submitTokenToBackend(token, completion: { (error: Error?) in | |
| if let error = error { | |
| // Present error to user... |
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 handleApplePayButtonTapped(){ | |
| let merchIdentifier = "merchant.com.yourApp" | |
| let paymentRequest = Stripe.paymentRequest(withMerchantIdentifier: merchIdentifier, country: "US", currency: "USD") | |
| paymentRequest.paymentSummaryItems = [ | |
| PKPaymentSummaryItem(label: "Something", amount: 50.00), | |
| PKPaymentSummaryItem(label: "Your Company", amount: 50.00)] | |
| if Stripe.canSubmitPaymentRequest(paymentRequest) { | |
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
| extension YourViewController: PKPaymentAuthorizationViewControllerDelegate { } |
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
| import Stripe | |
| ... | |
| ... | |
| STPPaymentConfiguration.shared().publishableKey =“pk_test_xxxxxxxxxxxx” |
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
| let address = STPAddress() | |
| address.line1 = "Some Street" | |
| address.city = "Some City" | |
| address.postalCode = "55202" | |
| address.state = "CA" | |
| address.country = "US" | |
| address.phone = "1234567890" | |
| address.email = "[email protected]" | |
| address.name = "Farhan Syed" |
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
| class ViewController: UIViewController { | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| // Do any additional setup after loading the view. | |
| view.backgroundColor = UIColor.white | |
| } |
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
| import UIKit | |
| class View: UIView { | |
| override init(frame: CGRect) { | |
| super.init(frame: frame) | |
| addViews() | |
| } | |
| required init?(coder aDecoder: NSCoder) { |
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
| let sortedArray = companyArray.sorted(by: { $0 < $1 }) | |
| print(sortedArray) |