Skip to content

Commit

Permalink
Merge pull request #4 from razorpay/e/minor_edits
Browse files Browse the repository at this point in the history
Make minor edits
  • Loading branch information
selvagsz committed Oct 25, 2016
2 parents 2eac0a3 + c6d8a1a commit ffa7e99
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 33 deletions.
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
example/
56 changes: 30 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
<TouchableHighlight onPress={() => {
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
<TouchableHighlight onPress={() => {
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).

Expand Down
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 <developers@razorpay.com> (https://razorpay.com/)",
"license": "",
"homepage" : "https://github.com/razorpay/react-native-razorpay#readme"
"license": "MIT",
"homepage" : "https://github.com/razorpay/react-native-razorpay#readme"
}

0 comments on commit ffa7e99

Please sign in to comment.