razorpay / react-native-razorpay

React Native wrapper for Razorpay's mobile SDKs
https://www.npmjs.com/package/react-native-razorpay
MIT License
121 stars 107 forks source link

We need Expo support ! #379

Closed jitunayak closed 1 year ago

jitunayak commented 2 years ago

Describe the feature you'd like:

Currently most of the react native apps are based on EXPO framework. As it has some of the enterprise features such as eas build and easy to publish updates to Play Store/App Store. As of Razorpay only supports bare workflow which is react-native cli support. Razorpay has native modules dependency. So it can't be installed directly on expo. But after SDK 41. They have added support for building native modules with dev client (Separate binary just like Expo GO) but it will contain the native code modules in binary.

Suggested implementation:

Expo allows to implement native modules by building Config Plugins (Basically you tell expo what are the native code changes required ). When user run expo install razorpay. Expo will automatically configure native code changes with out ejecting the app.

Describe alternatives you've considered:

Similar implementation made in Stripe. Currently we are using stripe payments as it supports expo. They have their UPI payment option in beta. But i feel Razorpay is still better for Indian consumers.

Teachability, Documentation, Adoption, Migration Strategy:

https://docs.expo.dev/guides/config-plugins/

! This is expo thread request for Razorpay support. https://expo.canny.io/feature-requests/p/support-for-razorpay

sunn0e commented 2 years ago

Just came here to say this! Stripe has made it easier to use their SDK whereas Razorpay is still stuck with JS/html only solution in a webview. You just need to make a config plugin[0] for android specific code[1], ios does not need much effort[2]. Kindly look into this.

  1. https://docs.expo.dev/guides/config-plugins/
  2. https://docs.expo.dev/guides/config-plugins/
  3. https://www.npmjs.com/package/react-native-razorpay
devcoderbuzz commented 2 years ago

just following this. Not sure why no one is able to generate a plugin for this. :(

deepaktiwari09 commented 2 years ago

are you able to use it in expo?

devcoderbuzz commented 2 years ago

Can someone pls share the android plugin pls ??

AdarshJais commented 1 year ago

Any working solution for this issue?

kkyusufk commented 1 year ago

Hi, just adding my 2 cents. To integrate a project with expo, you need to create a JS-only module unless I am mistaken. The only way to use native modules like this one is to use EAS builds to build your application which will spit out your project in native code and then we can use native modules. https://docs.expo.dev/build/introduction/ Also, the reason why Stripe works with expo is because expo integrated stripe in their code base as a native module. This issue adds more clarity on how they achieved it https://github.com/stripe/stripe-react-native/issues/3

kkyusufk commented 1 year ago

Hey Folks, let me know if the above paragraph answered your questions so that we can close this issue.

AdarshJais commented 1 year ago

Hi @kkyusufk ,

Thanks for your 2 cents, It gives a bit of clarity on the approach but recently I read a comment from Michael Wood regarding creating a config plugin that could make the integration simpler.

Link: https://expo.canny.io/feature-requests/p/support-for-razorpay

Could you please review it once and let's know the best way to continue with Razorpay with the expo?

iprojectscloud-git commented 1 year ago

As of Expo SDK 46, and react-native-razorpay version 2.2.9, just installing the SDK with:

yarn add react-native-razorpay

and creating a dev client seems sufficient. There is no need to modify any .gradle or .java files. It all works automatically due to react native autolinking.

kkyusufk commented 1 year ago

@iprojectscloud-git thanks for the comment. You are absolutely right in case of android.

@AdarshJais We would be reviewing the README and add a new section for EXPO support as well as remove stuff which is not required. For now, We are confirming whether iOS needs some extra modification or not. I will update this issue once we have confirmed and updated the readme.

gerzonc commented 1 year ago

Not sure if @kkyusufk already got it listed yet, but I made a config plugin to add support for UPI Intent on iOS. Can anyone take a look on it and check if there is something missing or that requires further changes? Thanks!

gerzonc commented 1 year ago

Not sure if @kkyusufk already got it listed yet, but I made a config plugin to add support for UPI Intent on iOS. Can anyone take a look on it and check if there is something missing or that requires further changes? Thanks!

Seems like there is no need for config plugin, in fact, we could just customize infoPlist directly from app.json on Expo. So based on the docs, Expo has 100% support for react-native-razorpay without any issues

AdarshJais commented 1 year ago

Here you go: https://github.com/razorpay/react-native-razorpay/pull/420

Please follow the instructions provided in the modified Readme pull request, and let me know if you encounter any problems.