我正在Xamarin中創建一個演示專案,并且我想使用google pay(gPay)作為付款選項。我檢查了互聯網上的許多站點/視頻,它為 android 實作提供了解決方案,但它們都沒有iOS 實作。從android,我知道這個用google-pay的支付將通過深度鏈接完成,它需要在專案的本機結構中實作才能使其作業或打開其他應用程式并從支付應用程式中獲得回應付款程序完成后。你能幫我解決這個問題嗎?
謝謝。
uj5u.com熱心網友回復:
var urlString : String
if selectedItem == "GPay" {
urlString = responseObj.url.replacingOccurrences(of: "upiapp://", with: "gpay://upi/")
}
else if selectedItem == "PhonePe" {
urlString = responseObj.url.replacingOccurrences(of: "upiapp://", with: "phonepe://")
}
else if selectedItem == "Paytm" {
urlString = responseObj.url.replacingOccurrences(of: "upiapp://pay", with: "paytmmp://upi/pay")
}
else{
urlString = responseObj.url
}
let url = URL(string: urlString)!
if UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}else{
let alert = UIAlertController(title: "Alert", message: "The app is not installed, please install and try again", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Ok", style: .default) { action in
})
self.present(alert, animated: true, completion: nil)
}
//note : responseObj.url give backend.
example url
"upiapp://pay?pa=xxx&pn=xxx&tr=xxx&am=3000&cu=xxx&mc=xxx";
pa = id.
pn = name
tr = translation id
am = amount
cu = “INR” — india
mc = user id
或使用該支付集成吊艙
https://razorpay.com/docs/payments/payment-methods/upi-intent/ios/
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/437766.html
