gpt4 book ai didi

ios - PayPal 与 IOS swift 集成

转载 作者:可可西里 更新时间:2023-11-01 00:57:24 26 4
gpt4 key购买 nike

支付成功后如何获取created_time和id?

我只能得到确认“completedPayment.confirmation”

最佳答案

检查这个 PayPal 委托(delegate)方法

func payPalPaymentViewController(_ paymentViewController: PayPalPaymentViewController, didComplete completedPayment: PayPalPayment) 
{
print("PayPal Payment Success !")
paymentViewController.dismiss(animated: true, completion: { () -> Void in
// send completed confirmaion to your server
print("Here is your proof of payment:\n\n\(completedPayment.confirmation)\n\nSend this to your server for confirmation and fulfillment.")

let dict = completedPayment.confirmation
print("dict data is ====%@", dict)

let paymentResultDic = completedPayment.confirmation as NSDictionary
let dicResponse: AnyObject? = paymentResultDic.object(forKey: "response") as AnyObject?

let paycreatetime:String = dicResponse!["create_time"] as! String
let payauid:String = dicResponse!["id"] as! String
let paystate:String = dicResponse!["state"] as! String
let payintent:String = dicResponse!["intent"] as! String

print("id is --->%@",payauid)
print("created time ---%@",paycreatetime)
print("paystate is ----->%@",paystate)
print("payintent is ----->%@",payintent)

})
}

关于ios - PayPal 与 IOS swift 集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42808088/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com