Created
September 24, 2015 22:19
-
-
Save agentcoops/f2dcb68d016c8beb92c2 to your computer and use it in GitHub Desktop.
IOS 7 Swift
This file contains 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: ((PKPaymentAuthorizationStatus) -> Void)) { | |
self.handlePaymentAuthorizationWithPayment(payment, completion:completion); | |
} | |
func handlePaymentAuthorizationWithPayment(payment: PKPayment, completion: ((PKPaymentAuthorizationStatus) -> Void)!) { | |
STPAPIClient.sharedClient().createTokenWithPayment( | |
payment, | |
completion: { (token: STPToken?, error: NSError?) in | |
if ((error) != nil) { | |
completion(PKPaymentAuthorizationStatus.Failure) | |
} | |
self.createBackendChargeWithToken(token!, completion: completion) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment