Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 {
- completion(.failure)
- return
- }
- API_Client.sharedInstance.attachToCustomerAndCharge(tokenId: token.stripeID) { (error) in
- if error != nil {
- // Notify payment authorization view controller
- completion(.failure)
- }
- else {
- // Notify payment authorization view controller
- completion(.success)
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment