diff --git a/.npmignore b/.npmignore new file mode 100644 index 000000000..90c978b36 --- /dev/null +++ b/.npmignore @@ -0,0 +1 @@ +example/ diff --git a/README.md b/README.md index 6caa47c8c..67802632a 100644 --- a/README.md +++ b/README.md @@ -87,35 +87,39 @@ link iOS SDK as explained in the previous section: ### Steps 1. Import RazorpayCheckout module to your component: -```js -import RazorpayCheckout from 'react-native-razorpay'; -``` + ```js + 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. -```js - { - var options = { - description: 'Credits towards consultation', - image: 'https://i.imgur.com/3g7nmJC.png', - currency: 'INR', - key: 'rzp_test_1DP5mmOlF5G5ag', - amount: '5000', - name: 'foo', - prefill: { - email: 'akshay@razorpay.com', - contact: '8955806560', - name: 'Akshay Bhalotia' - }, - theme: {color: '#F37254'} - } - RazorpayCheckout.open(options).then(data => - { alert("Success: " + data.payment_id) } - ).catch(data => - { alert("Error: " + data.code + " | " + data.description) } - ); -}}> -``` + ```js + { + var options = { + description: 'Credits towards consultation', + image: 'https://i.imgur.com/3g7nmJC.png', + currency: 'INR', + key: 'rzp_test_1DP5mmOlF5G5ag', + amount: '5000', + name: 'foo', + prefill: { + email: 'akshay@razorpay.com', + contact: '8955806560', + name: 'Akshay Bhalotia' + }, + theme: {color: '#F37254'} + } + RazorpayCheckout.open(options).then((data) => { + // handle success + alert(`Success: ${data.payment_id}`); + }).catch((error) => { + // handle failure + alert(`Error: ${error.code} | ${error.description}`); + }); + }}> + ``` + A descriptive [list of valid options for checkout][options] is available (under Manual Checkout column). diff --git a/package.json b/package.json index 11b29d395..67d3c2ec7 100644 --- a/package.json +++ b/package.json @@ -8,15 +8,16 @@ "test": "echo \"Error: no test specified\" && exit 1", "postinstall": "./download_ios_framework.sh" }, - "repository": { - "type": "git", - "url": "git+https://github.com/razorpay/react-native-razorpay.git" - }, + "repository": { + "type": "git", + "url": "git+https://github.com/razorpay/react-native-razorpay.git" + }, "keywords": [ "react-native", - "razorpay" + "razorpay", + "payments" ], "author": "Razorpay Developers (https://razorpay.com/)", - "license": "", - "homepage" : "https://github.com/razorpay/react-native-razorpay#readme" + "license": "MIT", + "homepage" : "https://github.com/razorpay/react-native-razorpay#readme" }