@dev_innovations_labs/phonepe-pg-sdk 1.0.0 โ†’ 1.0.1

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.
Files changed (2) hide show
  1. package/README.md +230 -0
  2. package/package.json +1 -11
package/README.md CHANGED
@@ -0,0 +1,230 @@
1
+ ::: {align="center"}
2
+ ```{=html}
3
+ <h1>
4
+ ```
5
+ ๐Ÿ“ฑ PhonePe PG SDK
6
+ ```{=html}
7
+ </h1>
8
+ ```
9
+ ```{=html}
10
+ <h3>
11
+ ```
12
+ @dev_innovations_labs/phonepe-pg-sdk
13
+ ```{=html}
14
+ </h3>
15
+ ```
16
+ ```{=html}
17
+ <p>
18
+ ```
19
+ A unified PhonePe Payment Gateway SDK for
20
+ `<b>`{=html}Node.js`</b>`{=html}, `<b>`{=html}React Web`</b>`{=html},
21
+ and `<b>`{=html}React Native`</b>`{=html} using the latest Checkout v2
22
+ APIs.
23
+ ```{=html}
24
+ </p>
25
+ ```
26
+ `<img src="https://img.shields.io/npm/v/@dev_innovations_labs/phonepe-pg-sdk?color=blue&style=for-the-badge" />`{=html}
27
+ `<img src="https://img.shields.io/npm/dm/@dev_innovations_labs/phonepe-pg-sdk?style=for-the-badge" />`{=html}
28
+ `<img src="https://img.shields.io/badge/PhonePe-PG%20SDK-purple?style=for-the-badge" />`{=html}
29
+ :::
30
+
31
+ ------------------------------------------------------------------------
32
+
33
+ # ๐Ÿ–ผ๏ธ Screenshots
34
+
35
+ ### ๐ŸŒ Web Checkout
36
+
37
+ ![Web
38
+ Checkout](https://dummyimage.com/800x400/000/fff&text=Web+Checkout+Preview)
39
+
40
+ ### ๐Ÿ“ฑ React Native Checkout
41
+
42
+ ![React Native
43
+ Checkout](https://dummyimage.com/800x400/333/fff&text=React+Native+WebView+Checkout)
44
+
45
+ ------------------------------------------------------------------------
46
+
47
+ # ๐Ÿš€ Features
48
+
49
+ - ๐Ÿ” OAuth Token Generation (Checkout v2)
50
+ - ๐Ÿ’ณ Initiate Payments (Web, Mobile, UPI, Cards)
51
+ - ๐Ÿ”„ WebView Support for React Native
52
+ - ๐Ÿงช Status Check API
53
+ - ๐ŸŒ Sandbox & Production Environments
54
+ - ๐ŸŽฏ TypeScript Fully Supported
55
+ - ๐Ÿงฉ Multi-platform Unified SDK
56
+ - ๐Ÿงต Auto-environment normalization
57
+
58
+ ------------------------------------------------------------------------
59
+
60
+ # ๐Ÿ“ฆ Installation
61
+
62
+ ``` bash
63
+ npm install @dev_innovations_labs/phonepe-pg-sdk
64
+ ```
65
+
66
+ ------------------------------------------------------------------------
67
+
68
+ # โš™๏ธ Environments
69
+
70
+ Input Interpreted As
71
+ ------------------------------ ----------------
72
+ production, Production, prod production
73
+ sandbox, Sandbox, SANDBOX sandbox
74
+
75
+ ------------------------------------------------------------------------
76
+
77
+ # ๐Ÿ“š Usage
78
+
79
+ ------------------------------------------------------------------------
80
+
81
+ ## ๐ŸŸฆ 1. Node.js Example
82
+
83
+ ``` ts
84
+ import { PhonePeNode } from "@dev_innovations_labs/phonepe-pg-sdk";
85
+
86
+ const phonepe = new PhonePeNode({
87
+ clientId: "YOUR_CLIENT_ID",
88
+ clientSecret: "YOUR_SECRET",
89
+ environment: "production"
90
+ });
91
+
92
+ const res = await phonepe.createPayment({
93
+ merchantId: "M123",
94
+ merchantOrderId: "uuid-123",
95
+ amount: 10000,
96
+ redirectUrl: "https://yourapp.com/redirect",
97
+ callbackUrl: "https://yourapp.com/callback"
98
+ });
99
+
100
+ console.log(res.redirectUrl);
101
+ ```
102
+
103
+ ------------------------------------------------------------------------
104
+
105
+ ## ๐ŸŒ 2. React Web Example
106
+
107
+ ``` jsx
108
+ import { PhonePeCheckoutWeb } from "@dev_innovations_labs/phonepe-pg-sdk";
109
+
110
+ export default function Checkout() {
111
+ return (
112
+ <PhonePeCheckoutWeb
113
+ environment="sandbox"
114
+ clientId="YOUR_CLIENT_ID"
115
+ clientSecret="YOUR_SECRET"
116
+ request={{
117
+ merchantId: "M123",
118
+ merchantOrderId: "uuid-321",
119
+ amount: 10000,
120
+ redirectUrl: "https://yourapp.com/redirect",
121
+ callbackUrl: "https://yourapp.com/callback"
122
+ }}
123
+ onSuccess={(r) => console.log("Success", r)}
124
+ onError={(e) => console.log("Error", e)}
125
+ />
126
+ );
127
+ }
128
+ ```
129
+
130
+ ------------------------------------------------------------------------
131
+
132
+ ## ๐Ÿ“ฑ 3. React Native Example
133
+
134
+ ``` jsx
135
+ import { PhonePeCheckoutNative } from "@dev_innovations_labs/phonepe-pg-sdk/native";
136
+
137
+ export default function App() {
138
+ return (
139
+ <PhonePeCheckoutNative
140
+ environment="production"
141
+ clientId="YOUR_CLIENT_ID"
142
+ clientSecret="YOUR_SECRET"
143
+ request={{
144
+ merchantId: "M123",
145
+ merchantOrderId: "uuid-xyz",
146
+ amount: 10000,
147
+ redirectUrl: "https://yourapp.com/redirect",
148
+ callbackUrl: "https://yourapp.com/callback"
149
+ }}
150
+ onSuccess={(data) => console.log("Success", data)}
151
+ onError={(e) => console.log("Error", e)}
152
+ />
153
+ );
154
+ }
155
+ ```
156
+
157
+ ------------------------------------------------------------------------
158
+
159
+ # ๐Ÿ“ก Status API
160
+
161
+ ``` ts
162
+ const status = await phonepe.checkStatus("uuid-1234");
163
+ console.log(status);
164
+ ```
165
+
166
+ ------------------------------------------------------------------------
167
+
168
+ # ๐Ÿ“˜ API Table
169
+
170
+ API Platform Description
171
+ -------------------------- -------------- -------------------------------
172
+ `createPayment()` Node/Web/RN Initiates PhonePe Checkout v2
173
+ `checkStatus()` Node Checks transaction status
174
+ `PhonePeCheckoutWeb` React Web In-App iFrame Checkout
175
+ `PhonePeCheckoutNative` React Native Mobile WebView Checkout
176
+ `normalizeEnvironment()` Internal Normalizes env strings
177
+
178
+ ------------------------------------------------------------------------
179
+
180
+ # ๐Ÿงฉ Folder Structure
181
+
182
+ src/
183
+ index.ts
184
+ native.ts
185
+ PhonePeNode.ts
186
+ PhonePeReact.tsx
187
+ PhonePeReactNative.tsx
188
+ utils.ts
189
+ types.ts
190
+ dist/
191
+
192
+ ------------------------------------------------------------------------
193
+
194
+ # ๐Ÿ— Roadmap
195
+
196
+ - [ ] Add PhonePe payouts API
197
+ - [ ] Add checksum support for PG v1
198
+ - [ ] Add UI components for receipts
199
+ - [ ] Add webhooks helpers
200
+
201
+ ------------------------------------------------------------------------
202
+
203
+ # ๐Ÿ‘จโ€๐Ÿ’ป Contributors
204
+
205
+ Name Role
206
+ ----------------------- ----------------
207
+ Dev Innovations Labs Lead Developer
208
+ Open Source Community Coming Soon
209
+
210
+ ------------------------------------------------------------------------
211
+
212
+ # ๐Ÿ“ Changelog
213
+
214
+ ### v1.0.0
215
+
216
+ - Initial release\
217
+ - Multi-platform SDK\
218
+ - React Web + RN support\
219
+ - Token + Payment + Status APIs\
220
+ - Normalized environment handling
221
+
222
+ ------------------------------------------------------------------------
223
+
224
+ # ๐Ÿ“„ License
225
+
226
+ MIT ยฉ Dev Innovations Labs
227
+
228
+ ```{=html}
229
+ </div>
230
+ ```
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@dev_innovations_labs/phonepe-pg-sdk",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "type": "module",
5
-
6
5
  "keywords": [
7
6
  "phonepe",
8
7
  "phonepe-pg",
@@ -17,15 +16,12 @@
17
16
  "typescript",
18
17
  "web-payments"
19
18
  ],
20
-
21
19
  "main": "dist/index.js",
22
20
  "module": "dist/index.esm.js",
23
21
  "types": "dist/index.d.ts",
24
-
25
22
  "author": {
26
23
  "name": "Dev Innovations Labs"
27
24
  },
28
-
29
25
  "exports": {
30
26
  ".": {
31
27
  "import": "./dist/index.esm.js",
@@ -38,34 +34,28 @@
38
34
  "types": "./dist/native.d.ts"
39
35
  }
40
36
  },
41
-
42
37
  "scripts": {
43
38
  "build": "rollup -c"
44
39
  },
45
-
46
40
  "dependencies": {
47
41
  "axios": "^1.6.0",
48
42
  "uuid": "^9.0.0"
49
43
  },
50
-
51
44
  "peerDependencies": {
52
45
  "react": "*",
53
46
  "react-native": "*",
54
47
  "react-native-webview": "*"
55
48
  },
56
-
57
49
  "peerDependenciesMeta": {
58
50
  "react-native-webview": {
59
51
  "optional": true
60
52
  }
61
53
  },
62
-
63
54
  "devDependencies": {
64
55
  "typescript": "^5.3.3",
65
56
  "rollup": "^4.9.0",
66
57
  "rollup-plugin-typescript2": "^0.34.1"
67
58
  },
68
-
69
59
  "publishConfig": {
70
60
  "access": "public"
71
61
  }