Giter Site home page Giter Site logo

devsonuyadav / one-react-native-upi Goto Github PK

View Code? Open in Web Editor NEW
12.0 1.0 2.0 1.42 MB

This library uses intent to use UPI as a payment gateway without any payment fees. It communicates peer-to-peer which enables the application to support UPI payments by detecting the installed application on the user's phone. UPI application responds with a transcations summary in JSON format.

Java 52.79% JavaScript 7.13% Ruby 14.48% Shell 1.88% Swift 1.21% C 0.40% Objective-C 10.55% Objective-C++ 4.47% TypeScript 7.08%
android payment payments react react-native upi

one-react-native-upi's Introduction

Logo

one-react-native-upi

This library uses intent to use UPI as a payment gateway without any payment fees. It communicates peer-to-peer which enables the application to support UPI payments by detecting the installed application on the user's phone. UPI application responds with a transcations summary in JSON format.

Features

  • Light weight โš–๏ธ
  • Easy to integrate ๐Ÿ”Œ
  • Works on all UPI Apps ๐Ÿš€

Badges

MIT License

GPLv3 License

AGPL License

Screenshots

Demo

Note

This library is currently supported by Android only. Please add feature request in order to update the library with iOS support.

Installation

Install one-react-native-upi with npm

npm install one-react-native-upi

Install one-react-native-upi with yarn

yarn add one-react-native-upi

Add <queries> </queries> in AndroidManifest.xml within <manifest> </manifest> tag. You can add more application (UPI Apps) by knowing their packageName.

<queries>
   <package android:name="com.phonepe.app" />                        //Phonepe
    <package android:name="com.google.android.apps.nbu.paisa.user" /> // GPay
    <package android:name="net.one97.paytm" />                        // Paytm
    <package android:name="in.org.npci.upiapp" />                     // BHIM
    <package android:name="in.amazon.mShop.android.shopping" />       // AmazonPay
</queries>

Usage

To get installed UPI apps

import OneUpi from 'one-react-native-upi'
import {Button} from 'react-native


function App() {
  return  <Button
          title="Get installed apps"
          onPress={() =>
           const apps =  OneUpi.getInstalledUPIApps()
           console.log(apps)
         }
        />
}

OneUpi.getInstalledUPIApps() returns String[] of installed packageName. If the array is empty that means no apps are installed that supports upi payments

To initiate payment

import OneUpi from 'one-react-native-upi'
import {Button} from 'react-native



const config =  {
 upiId: 'yourmechantid@paytm',
 name: 'Sonu',
 note: 'Test payment',
 amount: '100',
 targetPackage: "in.org.npci.upiapp",
 }

 const onSuccess = (success) => {
     console.log({success})
 }
 const onFailure = (error) => {
     console.log({error})
 }

function App() {
  return  <Button
          title="Pay now"
          onPress={() =>
            OneUpi.initiate(
              config,
              onSuccess,
              onFailure,
            )
          }
        />
}

config

Field Type Default Required Description
upiId String "" โœ… Upi id of merchant. Personal UPI will not be processed.
name String "" โœ… Merchant name
note String "" โœ… Payment note
amount String "" โœ… Amount to be paid
targetPackage String "" Optional If not passed then it will open chooser
chooserText String Pay with Optional if you pass targetPackage, it will not be reflected

onSuccess response

Field Type Value Description
status String SUCCESS Payment Status
txnId String Dynamic value transaction ID
code String 00 success response code
approvalRefNo String Dynamic value Transaction Reference Number

onFailure response

Field Type Value Description
status String FAILED payment status
message String Reason for the failed payment

FAQ

Will it work with ios?

No, it currently supports android

Which apps are supported?

I have tested on PayTM, PhonePe, GPay, AmazonPay as of now .

Author

Support

For support, email [email protected].

License

MIT

one-react-native-upi's People

Contributors

devsonuyadav avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

tanveerbyn

one-react-native-upi's Issues

After installing this package i got error Task :one-react-native-upi:compileDebugJavaWithJavac FAILED

I have installed this package and have seen this error:

Task :one-react-native-upi:compileDebugJavaWithJavac FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
installed one-react-native-upi version is: "one-react-native-upi": "^0.1.2",

My current react native configuration:
buildscript {
ext {
buildToolsVersion = "33.0.0"
minSdkVersion = 21
compileSdkVersion = 33
targetSdkVersion = 33
ndkVersion = "23.1.7779620"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.3.1")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath ('com.google.gms:google-services:4.3.15')
}
}

allprojects {
repositories {
google()
mavenCentral()
}
}

uses a deprecated API

node_modules/one-react-native-upi/android/src/main/java/com/onereactnativeupi/com/onereactnativeupi/OneReactNativeUpiModule.java uses or overrides a deprecated API.

can anyone tell me why I'm facing this issue ?

Showing error in building app

E:\React-Native\AwesomeProject\node_modules\one-react-native-upi\android\src\main\java\com\onereactnativeupi\com\onereactnativeupi\OneReactNativeUpiModule.java:23: error: cannot find symbol
@ReactModule(name = OneReactNativeUpiModule.NAME)
^
symbol: class ReactModule
Note: E:\React-Native\AwesomeProject\node_modules\one-react-native-upi\android\src\main\java\com\onereactnativeupi\com\onereactnativeupi\OneReactNativeUpiModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':one-react-native-upi:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

Please tell me how to fix above error

Your Money has not been debited

Describe the bug
You have exceeded the bank limit for this Transaction. Retry with smaller Amount.
To Reproduce
Steps to reproduce the behaviour
App built Properly and it's working fine
I used this config

const config = {
upiId: 'yourmechantid@paytm',
name: 'Sonu',
note: 'Test payment',
amount: '100',
}

When I click on make payment button the function invokes the payments app and I choosed gpay and I entered password to open and and click on pay the error mentioned above came. But I recognised the receiver upi id and their bank name.
Expected behavior
When I tap on payment button payment function results either success or failure but the payment app throwing error.

unable to make a payment from google pay

Describe the bug
A clear and concise description of what the bug is.
the error: unable to make transaction on gpay.
You've exceeded the bank limit for this payment. retry with a smaller amount.
To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Need support for ios too

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
For IOS I am able to open the UPI apps using Linking.openURL(). But I am uncertain on how to get a callback once the transaction is completed

Additional context
Add any other context or screenshots about the feature request here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.