如何在xamarin 中集成google 支付以申请iOS?
How to integrate google pay in xamarin for application for iOS?
我正在 Xamarin 中创建一个演示项目,在其中,我想使用 google pay(gPay)作为付款选项。我在互联网上查了很多 sites/videos,它提供了 android 实现的解决方案,但其中 none 有 iOS 实现 。从 android,我了解到 google-pay 的付款将通过 深度链接 完成,需要在 [=16] 中实施=]项目的本机结构使其工作或打开其他应用程序并在支付过程完成后从支付应用程序获得响应。你能帮我解决这个问题吗?
谢谢。
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
或使用该支付集成 pod
https://razorpay.com/docs/payments/payment-methods/upi-intent/ios/
我正在 Xamarin 中创建一个演示项目,在其中,我想使用 google pay(gPay)作为付款选项。我在互联网上查了很多 sites/videos,它提供了 android 实现的解决方案,但其中 none 有 iOS 实现 。从 android,我了解到 google-pay 的付款将通过 深度链接 完成,需要在 [=16] 中实施=]项目的本机结构使其工作或打开其他应用程序并在支付过程完成后从支付应用程序获得响应。你能帮我解决这个问题吗?
谢谢。
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
或使用该支付集成 pod
https://razorpay.com/docs/payments/payment-methods/upi-intent/ios/