问题描述
我正在尝试通过Google Pay应用进行交易。到目前为止,我已经实现了这一点:
let paValue = "Client_upi_key" //payee address upi id
let pnValue = "Merchant Name" // payee name
let trValue = "1234ABCD" //tansaction Id
let urlValue = "http://url/of/the/order/in/your/website" //url for refernec
let mcValue = "1234" // retailer category code :- user id
let tnValue = "Purchase in Merchant" //transction Note
let amValue = "1" //amount to pay
let cuValue = "INR" //currency
let str = "gpay://upi/pay?pa=\(paValue)&pn=\(pnValue)&tr=\(trValue)&mc=\(mcValue)&tn=\(tnValue)&am=\(amValue)&cu=\(cuValue)"
guard let urlString = str.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
else {
return
}
guard let url = URL(string: urlString) else {
return
}
UIApplication.shared.open(url)
现在,我要返回我的应用,并希望收到来自Google Pay的一些响应,例如transactionID,userID等。在这种情况下,有没有像Android这样的方法可以使用Intent?
解决方法
据我所知,Google Pay API仅在Android和Web上可用。从current docs来看,仅显示这些选项。
如果您正在寻找一个简单的支付API,我知道Stripe很容易实现。您也可以尝试Apple Pay SDK。