Comments (28)
https://razorpay.com/docs/payment-gateway/payment-methods/upi-intent/ios/
There is an iOS intent flow in RazorPay SDK. It doesn't look like there is a spec (even roughly so like in android) for it though. Even, they seem to be supporting only three apps as of now.
Also not sure if we can emulate something similar on Flutter or not.
from upi_pay.
Great. I found these key custom schemes from this URL:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>tez</string>
<string>phonepe</string>
<string>paytmmp</string>
</array>
Was struggling as could not find these details of the apps published anywhere e.g. comgooglemaps for Google Maps is documented by Google and was able to launch Google Maps using this custom scheme using url_launcher package's launch() call to comgooglemaps://
. Was trying with upi://
as per the NPCI spec but no apps bothered to respond to it.
Will experiment and document.
from upi_pay.
I found custom schemes implemented by several apps using the method described here: https://www.amerhukic.com/finding-the-custom-url-scheme-of-an-ios-app.
I looked at these apps I have evaluated on Android (37) plus few more: Airtel Pay, Amazon Pay, Axis Pay, Bandhan Bank, Baroda Pay, BHIM, BOI UPI, Cent UPI, Cointab, CORP UPI, CSB Pay, DCB UPI, Freecharge, Google Pay, ICICI Mobile, IDFC UPI, IndianBank UPI, IndusPay, KBL UPI, KVB Upay, LVB Upaay, MahaUPI, Mi Pay, Mobikwik, Oriental Pay, PayTM, Paywiz, Phone Pe, PSB, RBL UPI, SBI Pay, SyndUPI, Truecaller, UCO UPI, UltraCash, Vijaya UPI, Yes Pay
Found these apps to implement custom schemes on iOS (16): PayTM, PhonePe, Amazon, iMobile, MobiKwik, Freecharge, KVB Upay, UBI UPI, UCO UPI, Vijaya UPI, BharatPe, SyndUPI, LOTZA Pay, Airtel, BHIM, Cent UPI
These apps have upi
as one of their custom schemes implemented: Google Pay, Mobikwik, PayTM, PhonePe, Freecharge, Lotza Pay, UBI UPI
These apps have only upi
as their custom scheme: KVB Upay, SyndUPI, Vijaya UPI
These apps do not have upi
scheme but some generic app name based schemes implemented: Amazon, iMobile, Airtel, BharatPe, BHIM, Cent UPI, UCO UPI
I experimented with few using url_launcher
to see if I can get to a success payment and some kind of callback.
- What the URL is going to be?
At this point, at least I do not see a way to figure out what query string structure is actually expected and parsed by these apps, beyond this finding of custom schemes. Though one can guess that if UPI "listening" has been implemented by these apps, the parameters should be standard and as per the UPI specs. However; there is no clarity about the URL path e.g. is it phonepe://upi?
, phonepe://pay?
, phonepe://upi/pay?
or something else. The link https://internal-absorbed-celsius.glitch.me/ shared earlier helped me with this. The logical patterns seem to be: upi://pay?
for upi
custom schemes, and <non-upi-scheme>://upi/pay?
for other custom schemes. And the few apps I tried with non-upi schemes, it worked out that way. I've not tested theupi://
custom schemes yet.
- Does the pre-filled payment form open up?
It did. For Google Pay and Phone Pe.
- Does the payment go through?
Yes, it did go through with Google Pay.
- Did the callback URL work?
I put in a working URL to one of my servers as the callback URL. But it was not called by Google Pay once the payment went through.
The twist, which I discovered a bit later, is that I was testing on my iPhone 6. Most of the apps get installed but do not even proceed once they detect it's iPhone 6 (as per NPCI guidelines). I did not want to continue this research/debugging any further because I'm not sure if few apps did not respond properly due to this etc.
from upi_pay.
One of my ideas was to implement a custom scheme in my app and pass a callback URL using that custom scheme (once the callback is verified to work for regular https URLs); but the UPI spec says that the callback URL must have http/https scheme. Had the URL with custom scheme worked, we would have had an experience of the whole workflow getting executed inside one's mobile, similar to how it works in Android.
At this point, not exploring any further till I get an iPhone version that is free of NCPI non-support worries.
from upi_pay.
Hey @reeteshranjan that is some exceptional dive deep points. Thanks for all the effort and time you have put in. I will try and explore along the same lines in iPhone X and see if we can get anything up that will be decent enough to be packaged in a lib. But, the callback bit seems like a deal breaker so far to me.
@pepsighan it will be great if you could share your thoughts whenever you can.
from upi_pay.
I have captured the results of testing on iPhone 7 here:
https://docs.google.com/spreadsheets/d/1y8m2zrrhM7yZnvYJYgTUtueCatP76j6_WSJYFE6JmvQ/edit?usp=sharing
This is ongoing work. I'm stopped for today as my bank accounts either exhausted daily transaction limits (owing to this testing 🙂) or some other issues.
Since many apps support upi
custom scheme (and some support only that), to test each of them without any ambiguity for iOS, I offloaded all but the one I wanted to test, and then launching a URL of the form upi://pay?pa=...
did launch the solo app.
from upi_pay.
In their latest release, Jio has added support. On iOS, they have implemented custom schemes myJio
and prefs
. Did try it out and payment form did not open up.
from upi_pay.
I haven't used Swift/Objective-C before. Don't have much idea. I am open to a discussion and PRs if anyone can take that up.
from upi_pay.
@drenther Any updates on iOS front?
from upi_pay.
I personally don't work with iOS as of now. Would be happy to take a PR if anyone is willing to?
from upi_pay.
I can do iOS programming. So far did not find any documentation on an iOS mechanism similar to Android intents though.
from upi_pay.
All these custom schemes work and with code like this on iOS you can launch the corresponding apps. Will see if the UPI parameters work.
final urlString = 'paytmmp://';
final bool check = await canLaunch(urlString);
try {
await launch(urlString);
} catch(error) {
print(error.toString());
}
from upi_pay.
Great findings, looks like we can support iOS to some extent. Any edge cases you can think of? @pepsighan @reeteshranjan
from upi_pay.
I think they should work fine for each individual app. The work will be to find custom schemes for each individual app for all to be supported. I don't have an iPhone but google pay's custom schemes are given here: https://internal-absorbed-celsius.glitch.me/. You may try if these work.
from upi_pay.
Hey @reeteshranjan that is some exceptional dive deep points. Thanks for all the effort and time you have put in.
Thank you @drenther! Happy to help. I love contributing to open source. Do check out my github and my organizations based repositories. Hopefully, you can find something that is useful.
from upi_pay.
Some apps demanded iOS 13.5+. All the tests have been done on iOS 14.
from upi_pay.
Have started a communication with Google Pay about the callback not working. Hopefully it will point an error in my integration method such as anything being wrong with value of the url
parameter. I did try 2 versions: URL encoded and unencoded and both failed. Thinking whether they would filter out any non-www domains as some sort of additional security filtering, I did setup a www URL with a working URL call welcoming GET and POST calls. But no luck.
from upi_pay.
Summary of experiments so far
Apps researched
These apps were chosen as they supported custom schemes including/excluding upi
: Airtel, Amazon, BHIM Cent UPI, BHIM JK Bank UPI, BHIM@SyndUPI, BHIM UCO UPI, Cointab, Freecharge, iMobile, Google Pay, Mobikwik, Paytm, Phonepe, Truecaller, WhatsApp
Custom Schemes
- Airtel:
myairtel
- Amazon:
com.amazon.mobile.shopping
,com.amazon.mobile.shopping.web
,amazonToAlipay
,com.amazon.mobile.sso
- BHIM Cent UPI:
CentUPI
- BHIM JK Bank UPI:
upi
- BHIM@SyndUPI:
upi
- BHIM UCO UPI:
ucoupi
- Cointab:
upi
- Freecharge:
upi
,freecharge
,com.freecharge.ios
,freechargeapp
,fc
- iMobile:
ICICI
,iMobileNative
,icicibank
,imobileapp
,Imblgc
- Google Pay:
upi
,comgooglepaisa
,tez
,gpay
- Mobikwik:
upi
,mobikwik
- Paytm:
upi
,paytm
,paytmmp
,com.one97.paytm
- PhonePe:
upi
,phonepe
,com.phonepe.PhonePeApp
- Truecaller:
truecaller
,truesdk
- WhatsApp:
upi
,whatsapp
,whatsapp-consumer
Behaviour around custom schemes other than upi
The point of looking at these was that an app can unambiguously invoke a payment app of its user's choice. However; invoking URLs made using these custom schemes does not lead to a complete payment process. No pre-filled payment form view is shown on invocation in most cases barring few exceptions.
Exceptions
- Google Pay: Performs successful payments including pre-filled forms for
tez://upi/pay?
andgpay://upi/pay?
URLs - Paytm: Performs successful payments including pre-filled forms for
paytmmp://upi/pay?
URLs
Special Mentions
- WhatsApp: For
whatsapp://pay?
URLs the WhatsApp payments page gets opened
Behaviour around upi
custom scheme
Ambiguity resolution
- If there is only 1 app on iOS that implements
upi
custom scheme, it gets successfully launched - In case of multiple apps being present, iOS choses one and it seems the one that was installed first is picked (more experiments needed to confirm). In any case, there is no way for an app to specify a choice among those installed.
Apps that perform payment process
Few apps exhibited the following behaviour for upi
custom scheme URLs:
- App gets launched
- Pre-filled payment form is presented
- Payment gets through successfully
- Callback url is not invoked
The apps are: BHIM JK Bank UPI, Cointab, Freecharge, Google Pay, Paytm, PhonePe, WhatsApp
Apps that did not respond well
- BHIM@SyndUPI, BHIM UCO UPI: No payment form is presented
- Mobikwik: It seems to have a bug where for me it keeps losing the bank accounts configured and keeps saying add them and while adding says already added and then payment does not move forward
Notes on behaviour around callback URL
None of the apps invoked the callback URL specified in url
parameter.
Paytm is the one app that showed that it's trying to at least parse the URL. And it has some structural requirement on the callback URL that's not met with but it's not clearly notified by Paytm, and it gives a generic error "ref-url invalid length"
for different values of url
parameter.
Hacky methods of using refUrl
(from earlier version of UPI linking spec) and callbackUrl
(from Paytm payment API documentation) along with url
parameter were tried; but were futile.
Discovery implementation
An app needs to specify the URL schemes it wishes to invoke in its project's Info.plist
as shown above.
Discovery can be implemented by then calling canOpenUrl
, as documented here https://developer.apple.com/documentation/uikit/uiapplication/1622952-canopenurl for each of these to see if these apps are installed. A simple tutorial here: https://useyourloaf.com/blog/querying-url-schemes-with-canopenurl/.
Limitations
This method does not return package bundleId of apps discovered, so while it's easy to figure out if these apps are available: Freecharge, Google Pay, Mobikwik, Paytm, PhonePe, and WhatsApp; it's impossible to figure out if the ones that implement and listen for upi
custom scheme only are installed: BHIM JK Bank UPI, Cointab.
Hence, discovery needs to properly notify the user around this.
from upi_pay.
Please see and review latest commits in #17. I have implemented the iOS support which is about discovering (as many as possible, see comments above about upi
and other unique custom schemes) and launching any of the apps for UPI transactions.
from upi_pay.
See https://github.com/reeteshranjan/upi_pay/blob/master/APPS.md for latest verification status of a number of apps across android and ios.
from upi_pay.
closing this since #17 merged and published on pub.dev as v0.3.0
from upi_pay.
- Paytm: Performs successful payments including pre-filled forms for
paytmmp://upi/pay?
URLs
@reeteshranjan I was trying to use the url scheme "paytmmp://upi/pay?" but it is not working on android. What is the current status on iOS?
from upi_pay.
- Paytm: Performs successful payments including pre-filled forms for
paytmmp://upi/pay?
URLs@reeteshranjan I was trying to use the url scheme "paytmmp://upi/pay?" but it is not working on android. What is the current status on iOS?
Custom scheme based calls are for iOS only. On Android, intent calls are needed.
from upi_pay.
- Paytm: Performs successful payments including pre-filled forms for
paytmmp://upi/pay?
URLs@reeteshranjan I was trying to use the url scheme "paytmmp://upi/pay?" but it is not working on android. What is the current status on iOS?
Missed responding about iOS status. I tested the paytmmp
custom scheme last when this quoted comment was made. Post that I don't know what is the status of this. Please test for yourself.
from upi_pay.
- Paytm: Performs successful payments including pre-filled forms for
paytmmp://upi/pay?
URLs@reeteshranjan I was trying to use the url scheme "paytmmp://upi/pay?" but it is not working on android. What is the current status on iOS?
Custom scheme based calls are for iOS only. On Android, intent calls are needed.
Actually I am building a web app using flutter. On android, the custom schemes are a hit and a miss. For example, gpay://upi/pay?
is working my Pixel 4a, but it is not working on the android phones. But, upi://pay?
is working flawlessly everywhere. Just want to share this information with you. Also, I wanted to say thanks for the prompt response :)
from upi_pay.
@ngaurav thank you for your interaction here. But this package / repo and the issues there-of are to track bug reports and enhancement requests. We do appreciate this kind of discussions though and to support that in a more appropriate way, I have opened the discussions feature on the repo. Feel free to create a "UPI on Web" thread and continue community driven exploration of the same there.
Thanks @reeteshranjan (as always :) ) for your quick and insightful responses and @ngaurav
from upi_pay.
- Paytm: Performs successful payments including pre-filled forms for
paytmmp://upi/pay?
URLs@reeteshranjan I was trying to use the url scheme "paytmmp://upi/pay?" but it is not working on android. What is the current status on iOS?
Custom scheme based calls are for iOS only. On Android, intent calls are needed.
Actually I am building a web app using flutter. On android, the custom schemes are a hit and a miss. For example,
gpay://upi/pay?
is working my Pixel 4a, but it is not working on the android phones. But,upi://pay?
is working flawlessly everywhere. Just want to share this information with you. Also, I wanted to say thanks for the prompt response :)
@drenther just closing this here.
Yes, it's correct that upi://pay?
works everywhere, as that's the expected behaviour of apps implementing the UPI linking spec. Other custom schemes, their support for UPI payment etc. is completely the choice of the app developer and that's why you don't see a standard behaviour. So if you are looking for code working across multiple apps, you need to use upi://pay?
.
About my comment about custom schemes vs intents, which might have been misleading: what I meant was that 'custom scheme' is an iOS specific term, and though the eventual URI formed out of intent calls are the same, the mechanism and coding is very different.
from upi_pay.
Is #38 relevant and important for you?
If yes, could you please respond to my twitter thread with UPI and NPCI handles included in your response asking how these must be solved and how it helps you? https://twitter.com/reeteshr08/status/1488746633068089345
from upi_pay.
Related Issues (20)
- I am not getting the list UPI apps on my Android 10 device HOT 3
- Getting onlu one upi App data
- Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Activity? HOT 6
- Execution failed for task ':upi_pay:compileDebugKotlin'. > A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction HOT 3
- Whenever we open Any UPI app It's redirect to last app url. HOT 3
- Can only use lower 16 bits for requestCode HOT 2
- I am not getting the list of UPI apps on my Android 12 HOT 1
- error HOT 2
- Getting Error In PhonePe Payment HOT 1
- Your money has not been debited. You've exceeded the bank limit for this payment. Retry with a smaller amount. HOT 2
- The plugin `upi_pay` uses a deprecated version of the Android embedding. HOT 1
- deprecated version of the Android embedding error
- This plugin is not working on iOS. HOT 1
- Android V2 embedding (deprecated APIs) HOT 1
- The plugin `upi_pay` uses a deprecated version of the Android embedding. HOT 1
- Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Activity? HOT 1
- Migrating the plugin to the V2 embedding
- The plugin `upi_pay` uses a deprecated version of the Android embedding. HOT 1
- Migeration & Crash Issue HOT 2
- This package is depricated and will be removed in future flutter release HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from upi_pay.