From 600c96b909747c69d7f66b1d506bc28b20d390cd Mon Sep 17 00:00:00 2001 From: Adarsh Jaiswal <40723757+AdarshJais@users.noreply.github.com> Date: Sun, 2 Oct 2022 14:49:15 +0530 Subject: [PATCH 1/5] Updated Readme for Expo User --- README.md | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e1e1ae7b..89028d90 100644 --- a/README.md +++ b/README.md @@ -198,9 +198,58 @@ If you are using proguard for your builds, you need to add following lines to pr } ``` +## For Expo user + +- By following these procedures, the integration with Expo project (only supported in Prebuild Application.) is quite easy. + +### Steps + +1. Import RazorpayCheckout module to your component: + + ```js + import RazorpayCheckout from 'react-native-razorpay'; + ``` +2. Run the eas build command based on your build enviremont + + -- choose the profile as per the build enviroment + + ```js + eas build --profile='select profile from eas.json' + ``` + +3. Since now you have prebuild application + 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. + ```js + { + 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}`); + }); + }}> + ``` + ## 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. +- While the orderId key is required in live mode, it should not be given in test mode. ## FAQ's From bb11a864f97aa57e57d8bdff0f5455abced5605f Mon Sep 17 00:00:00 2001 From: Adarsh Jaiswal <40723757+AdarshJais@users.noreply.github.com> Date: Sun, 2 Oct 2022 15:28:18 +0530 Subject: [PATCH 2/5] Update README.md --- README.md | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 89028d90..c5276544 100644 --- a/README.md +++ b/README.md @@ -204,11 +204,13 @@ If you are using proguard for your builds, you need to add following lines to pr ### Steps -1. Import RazorpayCheckout module to your component: - ```js - import RazorpayCheckout from 'react-native-razorpay'; - ``` +1. Run the installation command + + ```js + yarn add react-native-razorpay or npm install --save react-native-razorpay + ``` + 2. Run the eas build command based on your build enviremont -- choose the profile as per the build enviroment @@ -216,8 +218,14 @@ If you are using proguard for your builds, you need to add following lines to pr ```js eas build --profile='select profile from eas.json' ``` - -3. Since now you have prebuild application + +3. Import RazorpayCheckout module to your component: + + ```js + import RazorpayCheckout from 'react-native-razorpay'; + ``` + +4. Since now you have prebuild application 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. From 874756fa40d49efac043dda4ba03d04ada330d99 Mon Sep 17 00:00:00 2001 From: Adarsh Jaiswal <40723757+AdarshJais@users.noreply.github.com> Date: Sun, 2 Oct 2022 15:29:20 +0530 Subject: [PATCH 3/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c5276544..807293d2 100644 --- a/README.md +++ b/README.md @@ -213,7 +213,7 @@ If you are using proguard for your builds, you need to add following lines to pr 2. Run the eas build command based on your build enviremont - -- choose the profile as per the build enviroment + - choose the profile as per the build enviroment ```js eas build --profile='select profile from eas.json' From c46bbeaf3a028e3b391c6d0539173f791261a7f6 Mon Sep 17 00:00:00 2001 From: Adarsh Jaiswal <40723757+AdarshJais@users.noreply.github.com> Date: Sun, 2 Oct 2022 15:29:55 +0530 Subject: [PATCH 4/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 807293d2..99e7d04b 100644 --- a/README.md +++ b/README.md @@ -257,7 +257,7 @@ If you are using proguard for your builds, you need to add following lines to pr ## Things to be taken care -- While the orderId key is required in live mode, it should not be given in test mode. +- While the orderId key is required in live mode, it should not be passed in test mode. ## FAQ's From 4b334d19f0a8112557fda8a4d331a0da6b6cb708 Mon Sep 17 00:00:00 2001 From: Adarsh Jaiswal <40723757+AdarshJais@users.noreply.github.com> Date: Sun, 2 Oct 2022 15:31:47 +0530 Subject: [PATCH 5/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 99e7d04b..f4fb6fa9 100644 --- a/README.md +++ b/README.md @@ -213,7 +213,7 @@ If you are using proguard for your builds, you need to add following lines to pr 2. Run the eas build command based on your build enviremont - - choose the profile as per the build enviroment + - choose the profile from eas.json as per the build enviroment ```js eas build --profile='select profile from eas.json'