0
我目前使用braintree作为我的应用程序的支付系统im问题在于,我无法确定卡是在拒绝还是被接受之前进行的另一个viewcontroller请看看我目前的功能。先谢谢你。如何查明卡在Braintree支付中是否被拒绝
func postNonceToServer(paymentMethodNonce: String) {
let paymentURL = NSURL(string: "http://salesandsolutionsplus.com/braintree_php_api/public_html/checkout.php")!
let postAmount = formInfo["servicePrice"]!
let request = NSMutableURLRequest(URL: paymentURL)
request.HTTPBody = "payment_method_nonce=\(paymentMethodNonce)&amount=\(postAmount)".dataUsingEncoding(NSUTF8StringEncoding)
request.HTTPMethod = "POST"
NSURLSession.sharedSession().dataTaskWithRequest(request) { (data, response, error) -> Void in
// TODO: Handle success or failure
let dbRef = FIRDatabase.database().reference()
let value = self.formInfo
if error != nil {
print(error)
return
}
dbRef.child("streetServices/Posts").childByAutoId().setValue(value, withCompletionBlock: { (error, fir) in
if error != nil {
print("alert error")
print(error)
return
}
// present confirmation after payment process
let next = self.storyboard?.instantiateViewControllerWithIdentifier("vc3") as! ConfirmationViewController
self.presentViewController(next, animated: true, completion: nil)
})
}.resume()
}