Reputation: 15
Im trying to integrate UPI payment in my app. i have seen some apps where they are providing google pay and phone pe buttons, if they are installed in the device. on clicking button, particular app is opening. I need to implement similar experience in my ios app.
i have tried generating URL as specified in NPCI doc https://www.npci.org.in/sites/all/themes/npcl/images/PDF/UPI_Linking_Specs_ver_1.5.1.pdf
i tried using UIApplication.shared.open(url, options: [:], completionHandler to open the UPI app. every time its opening whatsapp only.
How can we open phone pe / google pay app based on users selection without entering payer's UPI id.
Upvotes: 1
Views: 3986
Reputation: 11
It is opening WhatsApp because Generic Intent does not work on iOS.
For Gpay you could try below codes:
@IBAction func Gpay(sender: AnyObject) {
guard let url = NSURL(string: "tez://upi/pay?pa=test@dcb&cu=INR&mc=0000&appName=TEST&tn=To&am=1.0&pn=TEST&tr=TEST-1574159602900") else {
return
}
UIApplication.shared.open(url as URL)
}
Upvotes: 1
Reputation: 847
You can get deeplink url of PhonePe as below
PhonePeSDK.shared().deeplinkUrl
Upvotes: 0