The return from the back-end Server is ignored, would like to send the charge.id, charge.status and price to the Stripe Dashboard.
The guard let token = token,error == nil else is never processed. The variables are empty.
Exp.
func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didAuthorizePayment payment: PKPayment,
completion: @escaping (PKPaymentAuthorizationStatus) -> Void) {
Skips to the end STPAPIClient.shared().createToken(with: payment) { (token: STPToken?, error: Error?) in
guard let token = token, error == nil else {
// Present error to user...
//completion(.failure)
return
}
self.submitTokenToBackend(token, completion: { (error: Error?) in
if error != nil {
// Present error to user...
// Notify payment authorization view controller
completion(.failure)
}
else {
// Save payment success
paymentSucceeded = true
// Notify payment authorization view controller
completion(.success)
}
})
} // end else
} //end func