razorpay-react-checkout 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -0
- package/package.json +10 -3
package/README.md
CHANGED
|
@@ -35,6 +35,41 @@ const App = () => (
|
|
|
35
35
|
);
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
+
#### With Default Options (v1.1.0+)
|
|
39
|
+
|
|
40
|
+
Pass default Razorpay options to the provider. These options will be merged with options passed to `openRazorpay()`.
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
import { RazorpayProvider } from 'razorpay-react-checkout';
|
|
44
|
+
|
|
45
|
+
const App = () => (
|
|
46
|
+
<RazorpayProvider
|
|
47
|
+
options={{
|
|
48
|
+
key: 'rzp_test_xxxxxxxx',
|
|
49
|
+
amount: 50000,
|
|
50
|
+
currency: 'INR',
|
|
51
|
+
name: 'Acme Corp',
|
|
52
|
+
}}
|
|
53
|
+
>
|
|
54
|
+
<Checkout />
|
|
55
|
+
</RazorpayProvider>
|
|
56
|
+
);
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Then in your component, you only need to pass the handler:
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
const { openRazorpay } = useRazorpay();
|
|
63
|
+
|
|
64
|
+
const handlePayment = () => {
|
|
65
|
+
openRazorpay({
|
|
66
|
+
handler: (response) => {
|
|
67
|
+
console.log('Payment successful:', response);
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
```
|
|
72
|
+
|
|
38
73
|
### Using Hook
|
|
39
74
|
|
|
40
75
|
```tsx
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "razorpay-react-checkout",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"description": "TypeScript-first, SSR-safe React SDK for Razorpay with hooks
|
|
3
|
+
"version": "1.1.2",
|
|
4
|
+
"description": "TypeScript-first, SSR-safe React SDK for Razorpay with hooks, Next.js support, and seamless integration for modern web applications. Designed for developers seeking simplicity and performance.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"exports": {
|
|
@@ -73,5 +73,12 @@
|
|
|
73
73
|
"engines": {
|
|
74
74
|
"node": ">=16.0.0",
|
|
75
75
|
"npm": ">=8.0.0"
|
|
76
|
-
}
|
|
76
|
+
},
|
|
77
|
+
"contributors": [
|
|
78
|
+
{
|
|
79
|
+
"name": "Arsallan Shahab",
|
|
80
|
+
"email": "marsallan@proton.me",
|
|
81
|
+
"url": "https://github.com/arsallanShahab"
|
|
82
|
+
}
|
|
83
|
+
]
|
|
77
84
|
}
|