Package detail

react-native-razorpay

razorpay27.6kMIT2.3.0

React Native wrapper for Razorpay

react-native, razorpay, payments

readme

react-native-razorpay

npm NPM Version NPM Downloads install size

NPM

React Native wrapper around our Android and iOS mobile SDKs

The following documentation is only focussed on the react-native wrapper around our Android and iOS sdks. To know more about our react-native SDK, refer to the following documentation -

https://razorpay.com/docs/payment-gateway/react-native-integration/

To know more about Razorpay payment flow and steps involved, read up here: https://docs.razorpay.com/docs

Prerequisites

  • Learn about the Razorpay Payment Flow.
  • Sign up for a Razorpay Account and generate the API Keys from the Razorpay Dashboard. Using the Test keys helps simulate a sandbox environment. No actual monetary transaction happens when using the Test keys. Use Live keys once you have thoroughly tested the application and are ready to go live.

Installation

Using npm:

npm install --save react-native-razorpay

or using yarn:

yarn add react-native-razorpay

For Expo Users:

npx expo install react-native-razorpay

Requirements

  • iOS 10.0+ / macOS 10.12+ / tvOS 10.0+ / watchOS 3.0+
  • Xcode 11+
  • Swift 5.1+

Linking

Automatic

<summary>iOS</summary> ### For React Native 0.60+ sh # install npm install react-native-razorpay --save cd ios && open podfile # Change the platform from iOS 9.0 to 10.0 pod install && cd .. # CocoaPods on iOS needs this extra step # run yarn react-native run-ios ### For React Native 0.59 and lower 1. $ npm install react-native-razorpay --save // Install the Razorpay React Native Standard SDK using the npm command. 2. react-native link react-native-razorpay // Link the SDK with React Native Project using Xcode. 3. Drag the Razorpay.framework file from the Libraries folder and drop it under the root folder, for more info follow this link, after this go to Target > General Settings> Framework, Libraries and Embedded Content section, set the Embed status of Razorpay.framework to Embed & Sign. 6. Also make sure the razorpay framework is added in the embedded binaries section and you have Always Embed Swift Standard Binaries set to yes in build settings.

Manual

<summary>iOS (via CocoaPods)</summary> Add the following line to your build targets in your Podfile pod 'react-native-razorpay', :path => '../node_modules/react-native-razorpay' Then run pod install
<summary>iOS (without CocoaPods)</summary> In XCode, in the project navigator: Right click Libraries Add Files to [your project's name] Go to node_modules/react-native-razorpay Add the .xcodeproj file In XCode, in the project navigator, select your project. Add the libRNDeviceInfo.a from the deviceinfo project to your project's Build Phases ➜ Link Binary With Libraries Click .xcodeproj file you added before in the project navigator and go the Build Settings tab. Make sure All is toggled on (instead of Basic). Look for Header Search Paths and make sure it contains both $(SRCROOT)/../react-native/React and $(SRCROOT)/../../React Mark both as recursive (should be OK by default). Run your project (Cmd+R)
<summary>Android </summary> 1. Open up android/app/src/main/java/[...]/MainApplication.java - Add import com.razorpay.rn.RazorpayPackage; to the imports at the top of the file - Add new RazorpayPackage() to the list returned by the getPackages() method 2. Append the following lines to android/settings.gradle: gradle include ':react-native-razorpay' project(':react-native-razorpay').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-razorpay/android') 3. Insert the following lines inside the dependencies block in android/app/build.gradle: gradle implementation project(':react-native-razorpay')

Note for Expo Applications:

After adding the react-native-razorpay package,the option to prebuild the app must be used(this generates the android/ios platform folders in the project to use native-modules). Command for which,

npx expo prebuild

After which the application will be installed on the device/emulator.

npx expo run:[ios|android] --device

Usage

Sample code to integrate with Razorpay can be found in index.js in the included example directory.

To run the example, simply do the following in example directory and then link iOS SDK as explained in the previous section:

$ npm i

Steps

  1. Import RazorpayCheckout module to your component:

     import RazorpayCheckout from 'react-native-razorpay';
  2. Call RazorpayCheckout.open method with the payment options. The method returns a JS Promise where then part corresponds to a successful payment and the catch part corresponds to payment failure.

     <TouchableHighlight onPress={() => {
       var options = {
         description: 'Credits towards consultation',
         image: 'https://i.imgur.com/3g7nmJC.png',
         currency: 'INR',
         key: '', // Your api key
         amount: '5000',
         name: 'foo',
         prefill: {
           email: 'void@razorpay.com',
           contact: '9191919191',
           name: 'Razorpay Software'
         },
         theme: {color: '#F37254'}
       }
       RazorpayCheckout.open(options).then((data) => {
         // handle success
         alert(`Success: ${data.razorpay_payment_id}`);
       }).catch((error) => {
         // handle failure
         alert(`Error: ${error.code} | ${error.description}`);
       });
     }}>

A descriptive list of valid options for checkout is available (under Manual Checkout column).

Proguard Rules

If you are using proguard for your builds, you need to add following lines to proguard files

-keepattributes *Annotation*
-dontwarn com.razorpay.**
-keep class com.razorpay.** {*;}
-optimizations !method/inlining/
-keepclasseswithmembers class * {
  public void onPayment*(...);
}

Things to be taken care

  • The react native plugin is wrapper around native SDK, so it doesn't work with the tools like expo which doesn't support native modules.

FAQ's

  • For UPI Intent in iOS, the info.plist in iOS should be modified to include LSApplicationQueriesSchemes
    • For Bare React-Native Apps:
      • info.plist can directly be modified from the xcode project. LSApplicationQueriesSchemes takes as array value and can currently include only ["tez","phonepe","paytmmp"]
    • For Expo Apps:
      • Directly modifying info.plist is discouraged, and hence this should be added in app.json
        "ios": {
          "infoPlist": {
            "LSApplicationQueriesSchemes": [
               "tez",
               "phonepe",
               "paytmmp"
            ]
          }
        }
      • P.S: The apps won't be visible if the application is run with metro builder. The info.plist is generated successfully and integrated only when the app is built as standalone app.
  • Still having trouble with integrating our payment gateway? Follow this link for more info.

Contributing

See the CONTRIBUTING document. Thank you, contributors!

License

react-native-razorpay is Copyright (c) 2020 Razorpay Software Pvt. Ltd. It is distributed under the MIT License.

We ♥ open source software! See our other supported plugins / SDKs or contact us to help you with integrations.

changelog

Changelog

Unreleased

Full Changelog

Closed issues:

  • image not found in react-native-customui #270
  • Razorpay - Facing the issue image not loaded #269
  • App is getting crashed in android when i call open function. #265
  • [CRITICAL] Payment amt value mapping varies in RazorPay UI #264
  • React native app is crashing after confirming payment with razorpay test key? #261
  • Unable to build iOS project, Xcode stucks while compiling react-native-razorpay module #258
  • Use of undeclared identifier 'Razorpay' in RazorpayCheckout.m #256
  • Country code issue on Razorpay checkout page #255
  • Library not loaded #254
  • Facing an issue pasted Below after doing Archive and failed to Distribute App. #253
  • Undefined symbol: _OBJC_CLASS_$_GeneratedPluginRegistrant while building flutter app in ios #252
  • ld:framework not found razorpay_flutter #251
  • dyld: Library not loaded: @rpath/libswiftCore.dylib #250
  • Getting success callback event for failed payment #249
  • error: no such file or directory /libRazorpayCheckout.a #248
  • How would I go about implementing custom checkout? #246
  • React Native IOS not working - No podspec file was found #241
  • Failed to verify bitcode: Linker option verification failed for bundle #238
  • [Need clarification] Why is the discrepancy between module names and module import #236
  • Getting a Blank Screen for a while before rendering razorpay content #235
  • Payment Failed with following response #233
  • found an unexpected Mach-O header code: 0x72613c21 in Xcode 11 #232
  • [iOS]: Could not find or use auto-linked framework 'Razorpay' #230
  • linker command failed with exit code 1 (use -v to see invocation) #228
  • razor pay carshing app in iOS react-native #224
  • Always getting dyld: Library not loaded: @rpath/libswiftCore.dylib #221
  • Razor pay not working in react native >=0.60 #219
  • Min SDK version issue #214
  • Error while Archiving Objective c app(Found an unexpected Mach-O header code: 0x72613c21) #212
  • Do not find .podspec file #202
  • app crashes in production in app review process #200
  • iPhone / iPad version 10.3 crashed. #196
  • Unable to link manually as well #193
  • React Native RazorPay android Undefined|Undefiend showing when click pay Button #184
  • Crash on iOS when adding a credit/debit card #180
  • Facing the issue image not loaded #174
  • Execution failed for task ':app:preDebugBuild' #158
  • Submit to App Store issues: Unsupported Architecture x86 #60

Merged pull requests:

v2.1.33 (2020-02-05)

Full Changelog

Closed issues:

  • Undefined symbol: _OBJC_CLASS_$__TtC8Razorpay8Razorpay #243
  • 'Razorpay/Razorpay-Swift.h' file not found #242
  • Payment Amount Is Not Proper Show #240
  • RN 0.60+ autolinking support for IOS #239
  • dyld: Library not loaded: @rpath/Razorpay.framework/Razorpay image not found #231
  • Invariant Violation: Native module cannot be null. #227
  • (Android) App crashing on release- Java ClassNotFoundException #225
  • Razorpay.framework did not contain a "archived-expanded-entitlements.xcent" resource. #220
  • react-native-razorpay not working in release apk #218
  • code signing "razorpay.framework" failed. view distribution logs for more information. #213
  • Unable to start activity ComponentInfo com.razorpay.CheckoutActivity : Didn't find class "com.razorpay.G_G #210
  • React native razorpay version for > RN 60.0 - Auto link support #207
  • Assemble not working with :react-native:0.20.+. #204
  • Razorpay on ios not opening payment module #186

Merged pull requests:

v2.1.25 (2019-07-15)

Full Changelog

Closed issues:

  • Metro Bundler Is not Refreshing after adding "$(PROJECT_DIR)/../node_modules/react-native-razorpay/ios/" to the "framework search paths" in Build Settings #199
  • iOS payment.open always returns with error code 1. #198
  • Archive = IOS Razorpay bit code missing #197
  • App get crash in iPad #195
  • Code signing "Razorpay.framework" failed.(React Native ) #194
  • App crashes on launch with error dyld`__abort_with_payload: #191
  • FrameWork not found Razorpay #190
  • Incompatible Swift version (unknown ABI version 0x07) #189
  • razorpay not working in iOS using Xcode 10 #187
  • minSdkVersion 16 cannot be smaller than version 19 #183
  • Breaks in production mode: Android #182
  • New version fails too #179
  • Not taking local Image path #178
  • Build error Xcode 10.2: Incompatible Swift #177
  • iOS App Thinning issue #176

Merged pull requests:

  • fix: use react-native convention for version overrides, allows AndroidX to work #201 (mikehardy)

v2.0.21 (2019-04-16)

Full Changelog

Closed issues:

  • Razorpay is getting crash #175
  • Razorpay dyId: library not loaded: @rpath/libswiftCore.dylib #171
  • Razorpay not compiling on xcode 10.2 #170
  • ld: warning: Could not find auto-linked framework 'Razorpay' #169
  • You should manually set the same version via Dependency Resolution #166
  • Not able to open payment screen in release build in android #165
  • dyld: Library not loaded: @rpath/libswiftCore.dylib error On Xcode 10.2 #163
  • No response after payment success/failure #160
  • Unable to link library in fresh project #156
  • iOS Archiving "bitcode bundle" issue #154
  • java.lang.RuntimeException: Unable to start activity ComponentInfo{com.razorTest.razorpayMe/host.exp.exponent.MainActivity}: java.lang.IllegalArgumentException: unexpected url #153
  • Native module can not be null. for ios #141

Merged pull requests:

v2.0.20 (2019-02-11)

Full Changelog

Closed issues:

  • UnhandledPromiseRejectionWarning: Error: jest-haste-map: @providesModule naming collision: #150
  • Razorpay sdk support for 32 bit IOS devices #148
  • Unable to start activity ComponentInfo{com.packageName/com.razorpay.CheckoutActivity} #140
  • "JavaScript" in pop-up title #135
  • Loading bank page stuck #113
  • Stucked on the Loading Page - Android #109
  • Yarn add causes error "expected hoisted manifest" #108

Merged pull requests:

v2.0.19 (2019-01-27)

Full Changelog

Closed issues:

  • Framework not found: RazorPay #149
  • Archiving on iOS Failed - Several issues with the iOS integration #147
  • Unable to open RazorpayCheckout when called from Modal in iOS - works in android #146
  • TypeError: _reactNativeRazorpay.default.open is not a function. #145
  • yarn add react-native-razorpay updates my project's yarn.lock #144
  • Package Upgrade as per Google Policy #143
  • Duplicate module name: react-native #139
  • Razorpay iOS not working #43

v2.0.18 (2019-01-02)

Full Changelog

Closed issues:

  • Subscription option? #142

v2.0.17 (2018-12-20)

Full Changelog

v2.0.16 (2018-12-03)

Full Changelog

Closed issues:

  • Bundle error #138
  • Update android permission --> RECEIVE_SMS #137
  • Latest version crashing on iOS #136
  • Don't check in node_modules in example folder #133
  • On EMI Option Screen is not scrollable UI Related Issues #132
  • Duplicate module name: react-native #129
  • After installation got the below error.can anyone help? #117
  • Dyld Library Error. #83
  • [iOS] broken build because of libRazorpayCheckout.a #63

Merged pull requests:

v2.0.14 (2018-10-09)

Full Changelog

Closed issues:

  • Blank Window is shows while calling razorpay.open() #130
  • CodeSign issue with razorpay module #128
  • Cannot read property 'buildConfigurationList' of undefined #127
  • cocoa pod integration support added for iOS integration #126
  • dyld: Symbol not found: _$SBOWV #125
  • Duplicate module name: react-animated #124
  • Ionic ios app integrated with Razorpay - error code sign Razorpay.framework #123
  • Suddenly : Code signing "Razorpay.framework" failed #122
  • getting error undefined | undefined while calling RazorpayCheckout.open(options) #121
  • dyld: Symbol not found: __T0BOWV #120
  • while building the app grtting following error #118
  • build errors #116
  • XCODE 10 razorpay support #111

Merged pull requests:

v2.0.13 (2018-09-30)

Full Changelog

Merged pull requests:

v2.0.10 (2018-09-28)

Full Changelog

Closed issues:

  • React/RCTEventEmitter.h not found in iOS #112
  • Module compiled with Swift 4.1 cannot be imported by the Swift 4.2 compiler: .../Framework/Razorpay.framework/Modules/Razorpay.swiftmodule/x86_64.swiftmodule #110
  • Card payment redirects to different page #107
  • dyld: Library not loaded: @rpath/libswiftCore.dylib #106
  • [Android] adding a 3 digit hex code crashes razor pay on android #105
  • Razer payment react native---Cannot read property 'open' of undefined #104
  • Application crash after closing the razorpay view #100
  • Duplicate module name: react-animated #93
  • "Invalid Segment Alignment. The app binary at '/Frameworks/Razorpay.framework/Razorpay' does not have proper segment alignment. #53
  • Removing react native dependency from package.json #42

Merged pull requests:

v2.0.9 (2018-08-20)

Full Changelog

v2.0.8 (2018-08-01)

Full Changelog

Closed issues:

  • Need it working with Older version of RN -0.45, what changes I need to make ? #98
  • Cannot find module while installing #97
  • RazorpayCheckout.open() getting stuck #96
  • Cannot read property 'buildConfigurationList' of undefined #95
  • The SDK Build Tools revision (24.0.0) is too low for project ':react-native-razorpay'. Minimum required is 25.0.0 #92
  • libRazorpaycheckout does not contain bitcode #88
  • Is there a way to prevent bounces effect in iOS #86
  • 'native module cannot be null' #22

Merged pull requests:

v2.0.7 (2018-06-11)

Full Changelog

Closed issues:

  • Does it support Paytm wallet ? #85
  • NativeModules.RazorpayCheckout is undefined #54

Merged pull requests:

v2.0.6 (2018-06-05)

Full Changelog

Closed issues:

  • Getting architechtural issues #75
  • getting the following error while installing rules for eslint: #74
  • Xcode 9.3 error but it is working in Xcode 9.2 #70

Merged pull requests:

v2.0.5 (2018-05-07)

Full Changelog

Closed issues:

  • Something went wrong while linking. Error: Cannot read property 'buildConfigurationList' of undefined #68

Merged pull requests:

v2.0.4 (2018-04-19)

Full Changelog

Closed issues:

  • can you guys please make bitcode enabled cocoapod available. #67
  • Different success objects on iOS and Android. Change documentation #40

v2.0.3 (2018-04-09)

Full Changelog

v2.0.2 (2018-04-06)

Full Changelog

Closed issues:

  • How to integrate paytm wallet option with latest sdk #64
  • Improvement: Please Update Documentation for iOS Integration #62
  • Having ssl problem and sdk download link not working. #56

Merged pull requests:

v2.0.1 (2018-03-16)

Full Changelog

Closed issues:

  • Pod support for iOS #51

Merged pull requests:

  • 2.0.0 Release - response of both ios and android are now in same format #59 (AbhinavArora95)

v2.0.0 (2018-02-22)

Full Changelog

Merged pull requests:

v1.5.1 (2018-02-20)

Full Changelog

Closed issues:

  • com.razorpay.rn does not exist #55
  • iOS Pay button does not work & Project does not build in xcode #50
  • SDK link dead #49
  • Razorpay is not working for android #48
  • Latest iOS SDK has missing ExternalWalletSelectionProtocol.h #44

Merged pull requests:

v1.4.2 (2018-01-04)

Full Changelog

Closed issues:

  • UI breaks while focusing on TextInput #46
  • Razorpay framework url download error #39
  • Incompatible minsdk #36
  • Exception '-[Razorpay setExternalWalletSelectionDelegate:]: unrecognized selector sent to instance 0x7ff38a6ea620' #32
  • Android: Payment view got dismissed on App enters background. #31
  • Razorpay Payment Window Not Open #29
  • handle modal dismiss #28
  • yarn add react-native-razorpay is not working #27
  • Bit Code #26
  • Build Error #25
  • Not working on ios after intallation #23
  • Error During npm install #21
  • BIT_CODE error while archiving #20
  • Problem in building package #19
  • Not installed #18

Merged pull requests:

1.2.0 (2017-03-08)

Full Changelog

Implemented enhancements:

Merged pull requests:

1.1.1 (2017-03-08)

Full Changelog

Merged pull requests:

1.1.0 (2017-03-07)

Full Changelog

Merged pull requests:

  • [Urgent] Orders API, External Wallet Support #13 (pronav)
  • [android] Add support for external wallets and orders API flow #12 (mb-14)

1.0.1 (2016-12-27)

Full Changelog

Closed issues:

  • Not working with latest react-native 0.39 #8
  • npm install is not working #7
  • Question: Is this production ready? #6

Merged pull requests:

  • Update Checkout Android SDK to v1.2.0, add compatibilty changes for RN 0.39 #9 (mb-14)

1.0.0 (2016-10-25)

Full Changelog

Merged pull requests:

* This Changelog was automatically generated by github_changelog_generator